c - Set wireless channel using netlink API -
I am developing a WiFi device in Ubuntu Linux 12.04 environment and let me switch the WiFi interface between different channels. the wanted. Currently I found the solution in Warshark source code ws80211_utils.c function ws80211_set_freq but I do not know what it is to implement how my source code and include what libc and how to compile So that I can test it. The problem is that you have a lot of logic and flags to use. Also, this is the first time I develop a netlink wifi device. If there is a good manual available, where to start for WiFi and how to use it, provide me a link. Thank you very much!
In the current Linux versions, "The right way to talk" is to keep in mind that for the wireless subsystem, Can not set arbitrarily a channel with each driver and every operating mode (master, client, monitor etc). Some drivers can change the channel only if the related interface is "down". In a mode such as a client ("managed"), the channel can not be set exactly as it is defined by the access point.
Also note that all wireless device drivers do not use Mac 80211 / cfg80211. To not use those drivers, you must either use the old wireless extension API or (worse) a driver-specific proprietary API.
Unfortunately, no up-to-date and full Nl80211 interface documentation. Please correct me if I am wrong!
Your approach to seeing other programs in the source code seems appropriately. You can also use the iw
option to set the channel:
$ iw --help Usage: iw [options] Command options: --debug Enable netlink debugging --version show version (3.2) command: ... Dev & lt; Devname & gt; Set up channel & lt; Channel & gt; [HT20 | HT40 + | HT40-] ...
In iw
s, line 91ff you can find the code when iw wlan0 set channel
implemented is done. However, this code is definitely not easy to read. It seems that there is a path to the NL80211_ATTR_WIPHY_FREQ
attribute in combination with the NL80211_CMD_SET_WIPHY
command.
You can use the nl80211 to find a skeleton program. In addition, code for aircrack-ng (, function linux_set_channel_nl80211
) can serve as a template.
Comments
Post a Comment