Set Beacon
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi,
I'm using NL80211_CMD_SET_BEACON command to set a specific Information Element to AP Beacon frames. To develop my code I'm using Ubuntu wiht kernel 2.6.38 and everything works fine. However, when I deploy my application it does not set the IE to the AP Beacon frames.
The machines I'm using to deploy have kernel 2.6.39-2-686-pae and the following NIC card:
*-network:1
description: Wireless interface
product: AR922X Wireless Network Adapter
vendor: Atheros Communications Inc.
physical id: 4
bus info: pci@0000:02:04.0
logical name: ath1
version: 01
width: 32 bits
clock: 66MHz
capabilities: pm bus_master cap_list ethernet physical wireless
logical
configuration: broadcast=yes driver=ath9k
driverversion=2.6.39-2-686-pae firmware=N/A ip=192.168.1.2 latency=168 link=yes multicast=yes
I have no more ideias how to fix this problem.
I'm using the next code to do that:
int set_beacon(const char *interface, meta_message_ptr &mih_msg)
{
struct nl_sock *nl_handle = NULL;
struct nl_cache *nl_cache = NULL;
struct genl_family *nl80211 = NULL;
struct nl_msg *msg;
mih::frame_vla fm;
if (connect((void **) &nl_handle,
(void **) &nl_cache,
(void **) &nl80211) < 0) {
ODTONE_LOG(1, "Falhei no connect");
return -1;
}
// Create and send message
if ((msg = nlmsg_alloc()) == NULL) {
ODTONE_LOG(1, "Falhei no alloc");
return -1;
}
// Set MIH Information Element
mih_msg->get_frame(fm);
uint8 *tail = (uint8 *)calloc(fm.get()->length() + 2, sizeof(uint8));
memset(tail, 51, 1); // Set Tag
memset(tail + 1, fm.get()->length(), 1); // Set Length
memcpy(tail + 2, fm.get()->get(), fm.get()->length()); // Set Value
genlmsg_put(msg, 0, 0, genl_family_get_id(nl80211), 0, 0,
NL80211_CMD_SET_BEACON, 0);
NLA_PUT(msg, NL80211_ATTR_BEACON_TAIL, fm.get()->length() + 2, tail);
NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, if_nametoindex(interface));
if(send_and_receive(nl_handle, msg, NULL, NULL) < 0) {
nla_put_failure:
nlmsg_free(msg);
ODTONE_LOG(1, "Falhei no send");
return -1;
}
nlmsg_free(msg);
ODTONE_LOG(1, "Set beacon");
return 0;
}Best regards,
Carlos Guimarães