Userspace tools: Roadmap?
Looking at some of the Linux Wireless website pages it appears as though "iw" is meant to be the successor to the older pre-mac80211 userspace tools. In that category we have ifconfig, iproute2, iwconfig and iwpriv. For an AP there's also hostapd and wpa_supplicant. Probably some others I've missed, not to mention Network Manager. I can see how configuration and setup wouldn't necessarily be limited to "iw" using nl/cfg80211, but in the short term is that the tool of choice for migrating the functionality of the old tools to the new mac80211 infrastructure?
Here's my situation: I'm developing a driver for an old 80211 b/g chipset. It's ancient by modern standards. It operates only in the 2.4 GHz band, it doesn't have any mesh capabilities, it has a "broken" EEPROM, it supports only single RX and TX queues, and it's an ASIC design that doesn't use firmware. It has no "turbo" modes. The company that manufactured it went bust in 2005. It was used in a wide array of soho routers and access points several years ago but never caught on as a very popular" chip.
I want to write, from scratch, a mac80211 driver for this chipset using information I've gained over the last few years from specs and reverse engineering the binary-only driver that shipped with it (with a Linux 2.4.18 kernel). I have the framework of the driver set up and working. It loads, detects and initializes the hardware on the PCI bus, reads the hardware MAC address, sets up the TX and RX queues, and registers with the mac80211 stack. I see devices wmaster0 and wlan0 when I modprobe the driver. So far, so good. Eventually I want to support AP and MONITOR modes, too, but STA mode seems to be in a more advanced state right now so I am starting with that.
Userspace tools. I want to proceed as if Wireless Extensions never existed. Is that even possible? For instance, how do I command a channel change from userspace? iw doesn't have that. Should it? Or do I need to drop back to iwconfig? Is iw the preferred command-line way to do everything the old tools did, but using nl/cfg80211 instead of ioctls? When we get to AP mode, will hostapd be re-written to speak nl/cfg80211, or is a new config tool needed? The same questions apply to wpa_supplicant.
In general, what's the way forward for new userspace tools? nl80211 and cfg80211 are a given, I understand that, but what's the recommended approach from the perspective of a developer looking to make a clean break from Wireless Extensions with a new cleanroom driver written from scratch with no pre-existing baggage to worry about? Start making additions to iw's capabilities? Adapt some other existing tool to use nl/cfg80211, or write something completely new?
I've been following linux wireless developments since the big Summit of '06, but this is my first attempt at jumping in. Getting a handle on the "big picture view" of what everything is going to look like when mac80211 is a mature implementation is a bit difficult. I've noticed a lot of recent changes to the Linux Wireless website. All good stuff but not very comprehensive in scope. I realize nobody likes to write documentation :)
If somone could answer only 1 question (okay, it's a two-parter) the one I would most like answered is this: How does one, from userspace, ask the driver to switch to a specific channel, and what callback(s) from mac80211 should my driver expect to receive as a result? I think my driver can handle the task of changing the channel on the hardware and manage all the housekeeping that goes along with that; I just don't get how to issue that command from userspace.
TIA for any help, advice, pointers, flames, etc.
--
Dan
Signature · 1 line
http://www.fastmail.fm - Send your email first class
Hello,
Quoted 2 lines
will hostapd be re-written to speak
nl/cfg80211, or is a new config tool needed?
Just one little thing, regarding hostapd:
You can use hostapd with nl80211.
Adding this entry:
driver=nl8021
to hostapd.conf will cause it to work with nl80211 API (driver_nl80211.c)
You should also build hostapd withCONFIG_DRIVER_NL80211 set in the Makefile.
This is a known way to work with hostapd and master mode; see for example,
http://acx100.erley.org/nl80211_master_mode.html
(BTW, I am using the latest git of hostapd, but it could be relevant also for older versions).
Regarding iw: I think that adding support for changing channel in iw is possible and that there is no inherent reason not to do so. Are there any other things you should do with iw which do not exist (and exist with iwcofig) ?
Regards,
Rami Rosen
Quoted 76 lines · Dan E
Looking at some of the Linux Wireless website pages it appears as though "iw" is meant to be the successor to the older pre-mac80211 userspace tools. In that category we have ifconfig, iproute2, iwconfig and iwpriv. For an AP there's also hostapd and
wpa_supplicant. Probably some others I've missed, not to mention Network Manager. I can see how configuration and setup wouldn't necessarily be limited to "iw" using nl/cfg80211, but in the short term is that the tool of choice for migrating the functionality of the old tools to the new mac80211 infrastructure?Here's my situation: I'm developing a driver for an old 80211 b/g chipset. It's ancient by modern standards. It operates only in the 2.4 GHz band, it doesn't have any mesh capabilities, it has a "broken" EEPROM, it supports only single RX and TX queues, and it's an ASIC design that doesn't use firmware. It has no "turbo" modes. The company that manufactured it went bust in 2005. It was used in a wide array of soho routers and access points several years ago but never caught on as a very popular" chip.
I want to write, from scratch, a mac80211 driver for this chipset using information I've gained over the last few years from specs and reverse engineering the binary-only driver that shipped with it (with a Linux 2.4.18 kernel). I have the framework of the driver set up and working. It loads, detects and initializes the hardware on the PCI bus, reads the hardware MAC address, sets up the TX and RX queues, and registers with the mac80211 stack. I see devices wmaster0 and wlan0 when I modprobe the driver. So far, so good. Eventually I want to support AP and MONITOR modes, too, but STA mode seems to be in a more advanced state right now so I am starting with that.
Userspace tools. I want to proceed as if Wireless Extensions never existed. Is that even possible? For instance, how do I command a channel change from userspace? iw doesn't have that. Should it? Or do I need to drop back to iwconfig? Is iw the preferred command-line way to do everything the old tools did, but using nl/cfg80211 instead of ioctls? When we get to AP mode, will hostapd be re-written to speak nl/cfg80211, or is a new config tool needed? The same questions apply to
wpa_supplicant.In general, what's the way forward for new userspace tools? nl80211 and cfg80211 are a given, I understand that, but what's the recommended approach from the perspective of a developer looking to make a clean break from Wireless Extensions with a new cleanroom driver written from scratch with no pre-existing baggage to worry about? Start making additions to iw's capabilities? Adapt some other existing tool to use nl/cfg80211, or write something completely new?
I've been following linux wireless developments since the big Summit of '06, but this is my first attempt at jumping in. Getting a handle on the "big picture view" of what everything is going to look like when mac80211 is a mature implementation is a bit difficult. I've noticed a lot of recent changes to the Linux Wireless website. All good stuff but not very comprehensive in scope. I realize nobody likes to write documentation :)
If somone could answer only 1 question (okay, it's a two-parter) the one I would most like answered is this: How does one, from userspace, ask the driver to switch to a specific channel, and what callback(s) from mac80211 should my driver expect to receive as a result? I think my driver can handle the task of changing the channel on the hardware and manage all the housekeeping that goes along with that; I just don't get how to issue that command from userspace.
TIA for any help, advice, pointers, flames, etc.
--
Dan--
http://www.fastmail.fm - Send your email first class--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 9 lines · Dan E
Looking at some of the Linux Wireless website pages it appears as though "iw" is meant to be the successor to the older pre-mac80211 userspace tools. In that category we have ifconfig, iproute2, iwconfig and iwpriv. For an AP there's also hostapd and
wpa_supplicant. Probably some others I've missed, not to mention Network Manager. I can see how configuration and setup wouldn't necessarily be limited to "iw" using nl/cfg80211, but in the short term is that the tool of choice for migrating the functionality of the old tools to the new mac80211 infrastructure?
Not really, in the short term, you still are using iwconfig (wireless extensions) with anything but hostapd.
Quoted 1 line
Here's my situation: [snip]
nice
Quoted 2 lines
Userspace tools. I want to proceed as if Wireless Extensions never existed. Is that even possible?
No, it's not.
Quoted 2 lines
For instance, how do I command a
channel change from userspace? iw doesn't have that. Should it?
Yes, it should, and nl80211 even supports it, but iw itself doesn't yet. That's fairly easy to fix, too, but then iw won't support actually telling mac80211 to scan and associate etc.
Quoted 2 lines
Or do
I need to drop back to iwconfig?
For now.
Quoted 3 lines
Is iw the preferred command-line way
to do everything the old tools did, but using nl/cfg80211 instead of ioctls?
Not _yet_.
Quoted 3 lines
When we get to AP mode, will hostapd be re-written to speak
nl/cfg80211, or is a new config tool needed? The same questions apply towpa_supplicant.
That's already been done. The plan is to keep wext compatibility around though, obviously, so iwconfig will work in the foreseeable future.
Quoted 7 lines
In general, what's the way forward for new userspace tools? nl80211 and cfg80211 are a given, I understand that, but what's the recommended approach from the perspective of a developer looking to make a clean break from Wireless Extensions with a new cleanroom driver written from scratch with no pre-existing baggage to worry about? Start making additions to iw's capabilities? Adapt some other existing tool to use nl/cfg80211, or write something completely new?
If you're writing a mac80211-based driver, there's no point where you could possibly get in touch with the userspace API. You're writing the driver completely to mac80211's internal driver API, and mac80211 completely shields you from the userspace API. You'll never interact with either wireless extensions or nl80211.
Quoted 4 lines
If somone could answer only 1 question (okay, it's a two-parter) the one I would most like answered is this: How does one, from userspace, ask the driver to switch to a specific channel, and what callback(s) from mac80211 should my driver expect to receive as a result?
iwconfig wlan0 channel 7
then mac80211 calls your _ops->config() with the channel flag. Have you looked at the mac80211 book and the other documentation on
http://wireless.kernel.org/?
johannes
Quoted 3 lines · Johannes Berg
Not really, in the short term, you still are using iwconfig (wireless extensions) with anything but hostapd.
Ugh. I was afraid you were going to say that.
Quoted 4 lines
Quoted 2 lines
Userspace tools. I want to proceed as if Wireless Extensions never existed. Is that even possible?
No, it's not.
My fault for assuming too much about the urgency to get away from WE.
Quoted 3 lines
Yes, it should, and nl80211 even supports it, but iw itself doesn't yet. That's fairly easy to fix, too, but then iw won't support actually telling mac80211 to scan and associate etc.
Right. I had a few early problems with iw. For instance, the Linux Wireless web pages say you need "at least" libnl-1.0-pre8, but it won't build with libnl-1.2 or 2.0. I had to go with libnl-1.1 to make it happy. iw seems to be like a redheaded stepchild.
Quoted 11 lines
If you're writing a mac80211-based driver, there's no point where you could possibly get in touch with the userspace API. You're writing the driver completely to mac80211's internal driver API, and mac80211 completely shields you from the userspace API. You'll never interact with either wireless extensions or nl80211.
Quoted 4 lines
If somone could answer only 1 question (okay, it's a two-parter) the one I would most like answered is this: How does one, from userspace, ask the driver to switch to a specific channel, and what callback(s) from mac80211 should my driver expect to receive as a result?
Quoted 5 lines
iwconfig wlan0 channel 7
then mac80211 calls your
_ops->config()with the channel flag. Have you looked at the mac80211 book and the other documentation on
http://wireless.kernel.org/?
That's what I thought but I wasn't seeing any callbacks at all through my ieee80211_ops pointers. I did see the channel frequency change with 'iwconfig wlan0', but no callbacks. My fault, again, for not RTFM. I haven't gotten to the point yet on my driver where I expect 'ip link set up dev wlan0' (or 'ifconfig wlan0 up', if you prefer) and now I see that's why the config callback never happened. If I had RTFM I might have noticed adding 'commit' at the end of the iwconfig command would have done it without the 'up'.
Thanks for the info, Johannes. It answers a lot of my questions.
--
Dan
Signature · 1 line
http://www.fastmail.fm - Access your email from home and the web
Quoted 6 lines · Dan E
Quoted 4 lines
Quoted 2 lines
Userspace tools. I want to proceed as if Wireless Extensions never existed. Is that even possible?
No, it's not.
My fault for assuming too much about the urgency to get away from WE.
Well, nobody seems to really want to work on replacing already working features... I have a patch for scanning with iw though.
Quoted 8 lines
Quoted 3 lines
Yes, it should, and nl80211 even supports it, but iw itself doesn't yet. That's fairly easy to fix, too, but then iw won't support actually telling mac80211 to scan and associate etc.
Right. I had a few early problems with iw. For instance, the Linux Wireless web pages say you need "at least" libnl-1.0-pre8, but it won't build with libnl-1.2 or 2.0. I had to go with libnl-1.1 to make it happy. iw seems to be like a redheaded stepchild.
There's libnl 1.2 and 2.0? That's news to me! Patches welcome. Sorry, I guess it needs 1.0 or 1.1, will fix the page.
Quoted 6 lines
That's what I thought but I wasn't seeing any callbacks at all through my
ieee80211_opspointers. I did see the channel frequency change with 'iwconfig wlan0', but no callbacks. My fault, again, for not RTFM. I haven't gotten to the point yet on my driver where I expect 'ip link set up dev wlan0' (or 'ifconfig wlan0 up', if you prefer) and now I see that's why the config callback never happened.
Ah. Yes, if the hw isn't started mac80211 won't try to configure it :)
Quoted 3 lines
If I had RTFM I might
have noticed adding 'commit' at the end of the iwconfig command would have done it without the 'up'.
No, it wouldn't, commit is pointless, don't worry about it, you'll never need to use it with mac80211.
johannes
Quoted 4 lines · Johannes Berg
On Mon, 2008-12-08 at 18:18 -0500, Dan E wrote:
There's libnl 1.2 and 2.0? That's news to me! Patches welcome. Sorry, I guess it needs 1.0 or 1.1, will fix the page.
following is a patch that gets iw working with the development versions of libnl. I keep it uptodate at: http://wireless.erley.org/
The Makefile changes may not be the 'best' way to do it, but it works for me.
Pat Erley
---
Makefile +0 -2
@@ -10,10 +10,11 @@ MKDIR ?= mkdir -p INSTALL ?= install CC ?= "gcc" -CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration
pkg-config --cflags libnl-1
+NLVERSION = 2.0
+CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration pkg-config --cflags libnl-$(NLVERSION)
CFLAGS += -O2 -g
-LDFLAGS += pkg-config --libs libnl-1
-NLVERSION = 1.0
+LDFLAGS += pkg-config --libs libnl-$(NLVERSION)
+LIBS += -lnl -lnl-genl -lnl-nf -lnl-route
OBJS = iw.o info.o phy.o interface.o station.o util.o mpath.o reg.o
mesh.o genl.o
ALL = iw
@@ -29,7 +30,7 @@ endif
all: version_check $(ALL)
version_check:
- @if ! pkg-config --atleast-version=$(NLVERSION) libnl-1; then echo
"You need at least libnl version $(NLVERSION)"; exit 1; fi
+ @if ! pkg-config --atleast-version=$(NLVERSION) libnl-$(NLVERSION);
then echo "You need at least libnl version $(NLVERSION)"; exit 1; fi
version.h: version.sh
@@ -42,7 +43,7 @@ version.h: version.sh
iw: $(OBJS)
@$(NQ) ' CC ' iw
- $(Q)$(CC) $(LDFLAGS) $(OBJS) -o iw
+ $(Q)$(CC) $(LDFLAGS) $(OBJS) $(LIBS) -o iw
check:
$(Q)$(MAKE) all CC="REAL_CC=$(CC) CHECK=\"sparse -Wall\" cgcc"
iw.c +4 -5
@@ -29,7 +29,7 @@ static int nl80211_init(struct nl80211_state *state) {int err; - state->nl_handle =nl_handle_alloc (); + state->nl_handle =nl_socket_alloc ();if (!state->nl_handle) {fprintf (stderr,"Failed to allocate netlink handle.\n" );return -ENOMEM ;
@@ -41,8 +41,7 @@ static int nl80211_init(struct nl80211_state *state) goto out_handle_destroy; } - state->nl_cache =genl_ctrl_alloc_cache (state->nl_handle); -if (!state->nl_cache) { +if (genl_ctrl_alloc_cache (state->nl_handle, &(state->nl_cache))) {fprintf (stderr,"Failed to allocate generic netlink cache.\n" ); err = -ENOMEM ; goto out_handle_destroy;
@@ -60,7 +59,7 @@ static int nl80211_init(struct nl80211_state *state) out_cache_free:nl_cache_free (state->nl_cache); out_handle_destroy: -nl_handle_destroy (state->nl_handle); +nl_socket_free (state->nl_handle);return err; }
@@ -68,7 +67,7 @@ static void nl80211_cleanup(struct nl80211_state *state) {genl_family_put (state->nl80211);nl_cache_free (state->nl_cache); -nl_handle_destroy (state->nl_handle); +nl_socket_free (state->nl_handle); }__COMMAND (NULL ,NULL ,NULL ,0 ,0 ,0 ,CIB_NONE ,NULL );
Quoted 10 lines · pat-lkml
Quoted 4 lines · Johannes Berg
On Mon, 2008-12-08 at 18:18 -0500, Dan E wrote:
There's libnl 1.2 and 2.0? That's news to me! Patches welcome. Sorry, I guess it needs 1.0 or 1.1, will fix the page.following is a patch that gets iw working with the development versions of libnl. I keep it uptodate at: http://wireless.erley.org/
The
Makefilechanges may not be the 'best' way to do it, but it works for me.
Thanks, I think you even sent me that once before already, but that breaks with distro versions of libnl. I guess distros will end up shipping 1.1 as libnl1 like debian does for a while?
Is there any particular reason you need libnl from git? You could just check out 1.1, no?
johannes
Quoted 12 lines · Johannes Berg
Quoted 10 lines · pat-lkml
Quoted 4 lines · Johannes Berg
On Mon, 2008-12-08 at 18:18 -0500, Dan E wrote:
There's libnl 1.2 and 2.0? That's news to me! Patches welcome. Sorry, I guess it needs 1.0 or 1.1, will fix the page.following is a patch that gets iw working with the development versions of libnl. I keep it uptodate at: http://wireless.erley.org/
The
Makefilechanges may not be the 'best' way to do it, but it works for me.
Quoted 6 lines
Thanks, I think you even sent me that once before already, but that breaks with distro versions of libnl. I guess distros will end up shipping 1.1 as libnl1 like debian does for a while?
Is there any particular reason you need libnl from git? You could just check out 1.1, no?
The reason I'm using git for everything in there is just because I have it working. Once master mode is in a released mainline, and stable packages are released for all of the packages involved, I'll take the time to revise a new copy of the document that links to 'good' versions, and get it hosted on something more capable/dependable than my home dsl line. Also, someone else may have pushed a similar patch to you, as I have not sent one upstream.
As far as distros bundling libnl, I know gentoo is shipping 1.1, and am guessing it will be the version standardized on.
Pat
Attached is a newer 'better' version based off of how hostapd is handling this. This patch adds an option, CONFIG_LIBNL20, which enables LIBNL20 compatibility. I haven't ever been able to get iw to build with libnl-1.0 or libnl-1.1 on my system, so I haven't been able to test that, but it should work.
---
Makefile +0 -2
@@ -10,14 +10,25 @@ MKDIR ?= mkdir -p INSTALL ?= install CC ?= "gcc" -CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration
pkg-config --cflags libnl-1
+CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration
CFLAGS += -O2 -g
-LDFLAGS += pkg-config --libs libnl-1
-NLVERSION = 1.0
+NLVERSION = 2.0
OBJS = iw.o info.o phy.o interface.o station.o util.o mpath.o reg.o
mesh.o genl.o
ALL = iw
+ifeq ($(NLVERSION), 2.0)
+CFLAGS += pkg-config --cflags libnl-2.0 -DCONFIG_LIBNL20 +LDFLAGS += pkg-config --libs libnl-2.0
+LIBS += -lnl -lnl-genl -lnl-nf -lnl-route +NLTESTVERSION = 2.0
+else
+CFLAGS += pkg-config --cflags libnl-1
+LDFLAGS += pkg-config --libs libnl-1.0
+LIBS += -lnl
+NLTESTVERSION = 1
+endif
+
ifeq ($(V),1)
Q=
NQ=true
@@ -29,7 +40,7 @@ endif
all: version_check $(ALL)
version_check:
- @if ! pkg-config --atleast-version=$(NLVERSION) libnl-1; then echo
"You need at least libnl version $(NLVERSION)"; exit 1; fi
+ @if ! pkg-config --atleast-version=$(NLVERSION)
libnl-$(NLTESTVERSION); then echo "You need at least libnl version $(NLVERSION)"; exit 1; fi
version.h: version.sh
@@ -42,7 +53,7 @@ version.h: version.sh
iw: $(OBJS)
@$(NQ) ' CC ' iw
- $(Q)$(CC) $(LDFLAGS) $(OBJS) -o iw
+ $(Q)$(CC) $(LDFLAGS) $(OBJS) $(LIBS) -o iw
check:
$(Q)$(MAKE) all CC="REAL_CC=$(CC) CHECK=\"sparse -Wall\" cgcc"
iw.c +11 -1
@@ -23,6 +23,13 @@#include "iw.h" #include "version.h" +#ifdef CONFIG_LIBNL20 +/* libnl 2.0 compatibility code */ +#define nl_handle_alloc_cb nl_socket_alloc_cb +#define nl_handle_alloc nl_socket_alloc +#define nl_handle_destroy nl_socket_free +#endif /* CONFIG_LIBNL20 */ +static int debug =0 ;static int nl80211_init (struct nl80211_state *state)
@@ -40,9 +47,12 @@ static int nl80211_init(struct nl80211_state *state) err = -ENOLINK ; goto out_handle_destroy; } - +#ifdef CONFIG_LIBNL20 +if (genl_ctrl_alloc_cache (state->nl_handle, &(state->nl_cache))) { +#else state->nl_cache =genl_ctrl_alloc_cache (state->nl_handle);if (!state->nl_cache) { +#endif fprintf (stderr,"Failed to allocate generic netlink cache.\n" ); err = -ENOMEM ; goto out_handle_destroy;
Quoted 5 lines · pat-lkml
Attached is a newer 'better' version based off of how hostapd is handling this. This patch adds an option,
CONFIG_LIBNL20, which enables LIBNL20 compatibility. I haven't ever been able to get iw to build with libnl-1.0 or libnl-1.1 on my system, so I haven't been able to test that, but it should work.
...
Review
Quoted 8 lines
(quoted diff) +8
-0+ifeq ($(NLVERSION), 2.0) +CFLAGS += `pkg-config --cflags libnl-2.0` -DCONFIG_LIBNL20 +LDFLAGS += `pkg-config --libs libnl-2.0` +LIBS += -lnl -lnl-genl -lnl-nf -lnl-route +NLTESTVERSION = 2.0 +else +CFLAGS += `pkg-config --cflags libnl-1` +LDFLAGS += `pkg-config --libs libnl-1.0`
I think you mean "libnl-1" without ".0" here.
Review
Quoted 3 lines
(quoted diff) +3
-0+LIBS += -lnl +NLTESTVERSION = 1 +endif
It would be better to have a variable for pkg-config name of the library, that is "libnl-1" or "libnl-2.0".
LDCONFIG and LIBS could both be derived from pkg-config by using --libs-only-l, --libs-only-other and --libs-only-L. --libs-only-l goes to LIBS, --libs-only-L goes to LDFLAGS and I guess --libs-only-other could go to LDFLAGS as well.
Quoted 6 lines
version_check:(quoted diff) +0
-1- @if ! pkg-config --atleast-version=$(NLVERSION) libnl-1; then echo"You need at least libnl version $(NLVERSION)"; exit 1; fi
(quoted diff) +1
-0+ @if ! pkg-config --atleast-version=$(NLVERSION)libnl-$(NLTESTVERSION); then echo "You need at least libnl version $(NLVERSION)"; exit 1; fi
I would consider autodetection for libnl version here if it's not too hard.
iw.c line 31
Quoted 6 lines
iw.c +6
-0+#ifdef CONFIG_LIBNL20 +/* libnl 2.0 compatibility code */ +#define nl_handle_alloc_cb nl_socket_alloc_cb +#define nl_handle_alloc nl_socket_alloc +#define nl_handle_destroy nl_socket_free +#endif /* CONFIG_LIBNL20 */
Please use macros with arguments to ensure their correct number.
Quoted 1 line
From my experience with external Linux drivers (MadWifi in particular),
it's easier to follow the current API and provide compatibility for the old API, not the other way around. This way, it's easier to track further API changes. Also, the new API is usually easier to understand.
iw.c static int nl80211_init(struct nl80211_state *state) · line 55
Quoted 6 lines
iw.c +4
-0+#ifdef CONFIG_LIBNL20 +if (genl_ctrl_alloc_cache (state->nl_handle, &(state->nl_cache))) { +#else state->nl_cache =genl_ctrl_alloc_cache (state->nl_handle);if (!state->nl_cache) { +#endif
Perhaps you could provide a compatibility genl_ctrl_alloc_cache() macro for libnl1 and avoid this ifdef?
Signature · 2 lines
Regards, Pavel Roskin
Thanks for the review, Pavel.
I agree with all you've said, Pat, care to make a new patch?
johannes
Quoted 5 lines · Johannes Berg
Thanks for the review, Pavel.
I agree with all you've said, Pat, care to make a new patch?
johannes
Pavel reviewed a newer version for me while I was at work today. I didn't post it to the list as I didn't have access to this account. I'm going to implement the new set of changes and try to submit a new patch some time tonight. One question, is it preferred to make the code use the new API and add compatibility to make it use the old API, or vice versa? I've written a function that uses the new genl_ctrl_alloc_cache(arg1, &arg2) syntax wrapped in the old arg2 = genl_ctrl_alloc_cache(arg1) syntax already, but based on Pavel's suggestions, it seems it's preferred to go the other way?
Pat
Quoted 7 lines · pat-lkml
Quoted 5 lines · Johannes Berg
Thanks for the review, Pavel.
I agree with all you've said, Pat, care to make a new patch?
johannes
Quoted 9 lines
Pavel reviewed a newer version for me while I was at work today. I didn't post it to the list as I didn't have access to this account. I'm going to implement the new set of changes and try to submit a new patch some time tonight. One question, is it preferred to make the code use the new API and add compatibility to make it use the old API, or vice versa? I've written a function that uses the new
genl_ctrl_alloc_cache(arg1, &arg2)syntax wrapped in the old arg2 =genl_ctrl_alloc_cache(arg1)syntax already, but based on Pavel's suggestions, it seems it's preferred to go the other way?
I think I'd prefer using the new version as well, even though then you have to make up a bogus return value, but it seems easier just so we can at some point just remove the compat code for the old version. Maybe.
johannes
This converts iw to use libnl-2, and adds compatibility with libnl-1. There is not currently a good way to detect the libnl version during compilation, as the versioning in the netlink/version.h is defined as a string "2.0" rather than a major and a minor number, so we must detect it in the Makefile.
---
I'm still not very familiar with Makefile magic, so if there's a better way to do what I'm doing in the Makefile, just let me know. Also, I'm preparing a similar patch for crda.
---
Makefile +0 -2
@@ -10,14 +10,28 @@ MKDIR ?= mkdir -p INSTALL ?= install CC ?= "gcc" -CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration
pkg-config --cflags libnl-1
+CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration
CFLAGS += -O2 -g
-LDFLAGS += pkg-config --libs libnl-1
-NLVERSION = 1.0
OBJS = iw.o info.o phy.o interface.o station.o util.o mpath.o reg.o
mesh.o genl.o
ALL = iw
+NL1FOUND := $(shell pkg-config --atleast-version=1 libnl-1 && echo Y) +NL2FOUND := $(shell pkg-config --atleast-version=2 libnl-2.0 && echo Y) +
+ifeq ($(NL1FOUND),Y)
+NLLIBNAME = libnl-1
+endif
+
+ifeq ($(NL2FOUND),Y)
+CFLAGS += -DCONFIG_LIBNL20
+LIBS += -lnl-genl
+NLLIBNAME = libnl-2.0
+endif
+
+LDFLAGS += pkg-config --libs $(NLLIBNAME)
+CFLAGS += pkg-config --cflags $(NLLIBNAME)
+
ifeq ($(V),1)
Q=
NQ=true
@@ -29,8 +43,15 @@ endif
all: version_check $(ALL)
version_check:
- @if ! pkg-config --atleast-version=$(NLVERSION) libnl-1; then echo
"You need at least libnl version $(NLVERSION)"; exit 1; fi -
+ifeq ($(NL2FOUND),Y)
+ @echo "Found libnl-2.0"
+else
+ifeq ($(NL1FOUND),Y)
+ @echo "Found libnl-1"
+else
+ $(error No libnl found)
+endif
+endif
version.h: version.sh
@$(NQ) ' GEN version.h'
@@ -42,7 +63,7 @@ version.h: version.sh
iw: $(OBJS)
@$(NQ) ' CC ' iw
- $(Q)$(CC) $(LDFLAGS) $(OBJS) -o iw
+ $(Q)$(CC) $(LDFLAGS) $(OBJS) $(LIBS) -o iw
check:
$(Q)$(MAKE) all CC="REAL_CC=$(CC) CHECK=\"sparse -Wall\" cgcc"
iw.c +15 -5
@@ -23,13 +23,24 @@#include "iw.h" #include "version.h" +#ifndef CONFIG_LIBNL20 +/* libnl 2.0 compatibility code */ + +#define nl_socket_alloc (_h) nl_handle_alloc(_h) +#define nl_socket_free (_h) nl_handle_destroy(_h) +#define compat_genl_ctrl_alloc_cache (_nl_handle, _nl_cache) \ + return (_nl_cache = genl_ctrl_alloc_cache(_nl_handle)) == null + +#define genl_ctrl_alloc_cache (_h) compat_genl_ctrl_alloc_cache(_h) +#endif /* CONFIG_LIBNL20 */ +static int debug =0 ;static int nl80211_init (struct nl80211_state *state) {int err; - state->nl_handle =nl_handle_alloc (); + state->nl_handle =nl_socket_alloc ();if (!state->nl_handle) {fprintf (stderr,"Failed to allocate netlink handle.\n" );return -ENOMEM ;
@@ -41,8 +52,7 @@ static int nl80211_init(struct nl80211_state *state) goto out_handle_destroy; } - state->nl_cache =genl_ctrl_alloc_cache (state->nl_handle); -if (!state->nl_cache) { +if (genl_ctrl_alloc_cache (state->nl_handle, &(state->nl_cache))) {fprintf (stderr,"Failed to allocate generic netlink cache.\n" ); err = -ENOMEM ; goto out_handle_destroy;
@@ -60,7 +70,7 @@ static int nl80211_init(struct nl80211_state *state) out_cache_free:nl_cache_free (state->nl_cache); out_handle_destroy: -nl_handle_destroy (state->nl_handle); +nl_socket_free (state->nl_handle);return err; }
@@ -68,7 +78,7 @@ static void nl80211_cleanup(struct nl80211_state *state) {genl_family_put (state->nl80211);nl_cache_free (state->nl_cache); -nl_handle_destroy (state->nl_handle); +nl_socket_free (state->nl_handle); }__COMMAND (NULL ,NULL ,NULL ,0 ,0 ,0 ,CIB_NONE ,NULL );
Crap, please ignore, attached the wrong patch.
Quoted 148 lines · pat-lkml
This converts iw to use libnl-2, and adds compatibility with libnl-1. There is not currently a good way to detect the libnl version during compilation, as the versioning in the
netlink/version.his defined as a string "2.0" rather than a major and a minor number, so we must detect it in theMakefile.Signed-off-by Pat Erley <[email protected]>---
I'm still not very familiar with
Makefilemagic, so if there's a better way to do what I'm doing in theMakefile, just let me know. Also, I'm preparing a similar patch for crda.---
Makefile +0
-2@@ -10,14 +10,28 @@ MKDIR ?= mkdir -p INSTALL ?= install CC ?= "gcc" -CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration
pkg-config --cflags libnl-1Makefile +1
-3+CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration CFLAGS += -O2 -g -LDFLAGS += `pkg-config --libs libnl-1` -NLVERSION = 1.0 OBJS = iw.o info.o phy.o interface.o station.o util.o mpath.o reg.omesh.o genl.o
ALL = iwMakefile +16
-1+NL1FOUND := $(shell pkg-config --atleast-version=1 libnl-1 && echo Y) +NL2FOUND := $(shell pkg-config --atleast-version=2 libnl-2.0 && echo Y) + +ifeq ($(NL1FOUND),Y) +NLLIBNAME = libnl-1 +endif + +ifeq ($(NL2FOUND),Y) +CFLAGS += -DCONFIG_LIBNL20 +LIBS += -lnl-genl +NLLIBNAME = libnl-2.0 +endif + +LDFLAGS += `pkg-config --libs $(NLLIBNAME)` +CFLAGS += `pkg-config --cflags $(NLLIBNAME)` + ifeq ($(V),1) Q= NQ=true@@ -29,8 +43,15 @@ endif all: version_check $(ALL) version_check: - @if ! pkg-config --atleast-version=$(NLVERSION) libnl-1; then echo"You need at least libnl version $(NLVERSION)"; exit 1; fi
Makefile +10
-2- +ifeq ($(NL2FOUND),Y) + @echo "Found libnl-2.0" +else +ifeq ($(NL1FOUND),Y) + @echo "Found libnl-1" +else + $(error No libnl found) +endif +endif version.h: version.sh @$(NQ) ' GEN version.h'@@ -42,7 +63,7 @@ version.h: version.sh iw: $(OBJS) @$(NQ) ' CC ' iw - $(Q)$(CC) $(LDFLAGS) $(OBJS) -o iw + $(Q)$(CC) $(LDFLAGS) $(OBJS) $(LIBS) -o iw check: $(Q)$(MAKE) all CC="REAL_CC=$(CC) CHECK=\"sparse -Wall\" cgcc"iw.c +15
-6@@ -23,13 +23,24 @@#include "iw.h" #include "version.h" +#ifndef CONFIG_LIBNL20 +/* libnl 2.0 compatibility code */ + +#define nl_socket_alloc (_h) nl_handle_alloc(_h) +#define nl_socket_free (_h) nl_handle_destroy(_h) +#define compat_genl_ctrl_alloc_cache (_nl_handle, _nl_cache) \ + return (_nl_cache = genl_ctrl_alloc_cache(_nl_handle)) == null + +#define genl_ctrl_alloc_cache (_h) compat_genl_ctrl_alloc_cache(_h) +#endif /* CONFIG_LIBNL20 */ +static int debug =0 ;static int nl80211_init (struct nl80211_state *state) {int err; - state->nl_handle =nl_handle_alloc (); + state->nl_handle =nl_socket_alloc ();if (!state->nl_handle) {fprintf (stderr,"Failed to allocate netlink handle.\n" );return -ENOMEM ;@@ -41,8 +52,7 @@ static int nl80211_init(struct nl80211_state *state) goto out_handle_destroy; } - state->nl_cache =genl_ctrl_alloc_cache (state->nl_handle); -if (!state->nl_cache) { +if (genl_ctrl_alloc_cache (state->nl_handle, &(state->nl_cache))) {fprintf (stderr,"Failed to allocate generic netlink cache.\n" ); err = -ENOMEM ; goto out_handle_destroy;@@ -60,7 +70,7 @@ static int nl80211_init(struct nl80211_state *state) out_cache_free:nl_cache_free (state->nl_cache); out_handle_destroy: -nl_handle_destroy (state->nl_handle); +nl_socket_free (state->nl_handle);return err; }@@ -68,7 +78,7 @@ static void nl80211_cleanup(struct nl80211_state *state) {genl_family_put (state->nl80211);nl_cache_free (state->nl_cache); -nl_handle_destroy (state->nl_handle); +nl_socket_free (state->nl_handle); }__COMMAND (NULL ,NULL ,NULL ,0 ,0 ,0 ,CIB_NONE ,NULL ); --To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 1 line · pat-lkml
Crap, please ignore, attached the wrong patch.
That looked pretty good to me, except that it's on top of your previous patch. :)
johannes
This converts iw to use libnl-2, and adds compatibility with libnl-1. There is not currently a good way to detect the libnl version during compilation, as the versioning in the netlink/version.h is defined as a string "2.0" rather than a major and a minor number, so we must detect it in the Makefile.
---
I'm still not very familiar with Makefile magic, so if there's a better way to do what I'm doing in the Makefile, just let me know. Also, I'm preparing a similar patch for crda. I'm not 100% certain on the libnl-1.1 compatibility part as I can't get iw to build with libnl-1.1 on my system. However, with and without this patch error out in an identical manner
---
Makefile +0 -2
@@ -10,14 +10,28 @@ MKDIR ?= mkdir -p INSTALL ?= install CC ?= "gcc" -CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration
pkg-config --cflags libnl-1
+CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration
CFLAGS += -O2 -g
-LDFLAGS += pkg-config --libs libnl-1
-NLVERSION = 1.0
OBJS = iw.o info.o phy.o interface.o station.o util.o mpath.o reg.o
mesh.o genl.o
ALL = iw
+NL1FOUND := $(shell pkg-config --atleast-version=1 libnl-1 && echo Y) +NL2FOUND := $(shell pkg-config --atleast-version=2 libnl-2.0 && echo Y) +
+ifeq ($(NL1FOUND),Y)
+NLLIBNAME = libnl-1
+endif
+
+ifeq ($(NL2FOUND),Y)
+CFLAGS += -DCONFIG_LIBNL20
+LIBS += -lnl-genl
+NLLIBNAME = libnl-2.0
+endif
+
+LDFLAGS += pkg-config --libs $(NLLIBNAME)
+CFLAGS += pkg-config --cflags $(NLLIBNAME)
+
ifeq ($(V),1)
Q=
NQ=true
@@ -29,8 +43,15 @@ endif
all: version_check $(ALL)
version_check:
- @if ! pkg-config --atleast-version=$(NLVERSION) libnl-1; then echo
"You need at least libnl version $(NLVERSION)"; exit 1; fi -
+ifeq ($(NL2FOUND),Y)
+ @echo "Found libnl-2.0"
+else
+ifeq ($(NL1FOUND),Y)
+ @echo "Found libnl-1"
+else
+ $(error No libnl found)
+endif
+endif
version.h: version.sh
@$(NQ) ' GEN version.h'
@@ -42,7 +63,7 @@ version.h: version.sh
iw: $(OBJS)
@$(NQ) ' CC ' iw
- $(Q)$(CC) $(LDFLAGS) $(OBJS) -o iw
+ $(Q)$(CC) $(LDFLAGS) $(OBJS) $(LIBS) -o iw
check:
$(Q)$(MAKE) all CC="REAL_CC=$(CC) CHECK=\"sparse -Wall\" cgcc"
iw.c +15 -5
@@ -23,13 +23,24 @@#include "iw.h" #include "version.h" +#ifndef CONFIG_LIBNL20 +/* libnl 2.0 compatibility code */ + +#define nl_socket_alloc (_h) nl_handle_alloc(_h) +#define nl_socket_free (_h) nl_handle_destroy(_h) +#define compat_genl_ctrl_alloc_cache (_nl_handle, _nl_cache) \ + (_nl_cache = genl_ctrl_alloc_cache(_nl_handle)) == NULL + +#define genl_ctrl_alloc_cache (_h,_i) compat_genl_ctrl_alloc_cache(_h,_i) +#endif /* CONFIG_LIBNL20 */ +static int debug =0 ;static int nl80211_init (struct nl80211_state *state) {int err; - state->nl_handle =nl_handle_alloc (); + state->nl_handle =nl_socket_alloc ();if (!state->nl_handle) {fprintf (stderr,"Failed to allocate netlink handle.\n" );return -ENOMEM ;
@@ -41,8 +52,7 @@ static int nl80211_init(struct nl80211_state *state) goto out_handle_destroy; } - state->nl_cache =genl_ctrl_alloc_cache (state->nl_handle); -if (!state->nl_cache) { +if (genl_ctrl_alloc_cache (state->nl_handle, &(state->nl_cache))) {fprintf (stderr,"Failed to allocate generic netlink cache.\n" ); err = -ENOMEM ; goto out_handle_destroy;
@@ -60,7 +70,7 @@ static int nl80211_init(struct nl80211_state *state) out_cache_free:nl_cache_free (state->nl_cache); out_handle_destroy: -nl_handle_destroy (state->nl_handle); +nl_socket_free (state->nl_handle);return err; }
@@ -68,7 +78,7 @@ static void nl80211_cleanup(struct nl80211_state *state) {genl_family_put (state->nl80211);nl_cache_free (state->nl_cache); -nl_handle_destroy (state->nl_handle); +nl_socket_free (state->nl_handle); }__COMMAND (NULL ,NULL ,NULL ,0 ,0 ,0 ,CIB_NONE ,NULL );
Quoted 8 lines · pat-lkml
This converts iw to use libnl-2, and adds compatibility with libnl-1. There is not currently a good way to detect the libnl version during compilation, as the versioning in the
netlink/version.his defined as a
string "2.0" rather than a major and a minor number, so we must detect it in theMakefile.Signed-off-by Pat Erley <[email protected]>
Ok, I've committed a slightly different version of this (corrected the type, and made the compat code static inlines), can you verify it still works against 2.0?
johannes
Quoted 8 lines · Johannes Berg
Quoted 7 lines · pat-lkml
This converts iw to use libnl-2, and adds compatibility with libnl-1. There is not currently a good way to detect the libnl version during compilation, as the versioning in the
netlink/version.his defined as a
string "2.0" rather than a major and a minor number, so we must detect it in theMakefile.
Quoted 7 lines
Quoted 1 line
Signed-off-by Pat Erley <[email protected]>Ok, I've committed a slightly different version of this (corrected the type, and made the compat code static inlines), can you verify it still works against 2.0?
johannes
Yep, works fine with 2.0
Quoted 9 lines · pat-lkml
Quoted 8 lines · Johannes Berg
Quoted 7 lines · pat-lkml
This converts iw to use libnl-2, and adds compatibility with libnl-1. There is not currently a good way to detect the libnl version during compilation, as the versioning in the
netlink/version.his defined as a
string "2.0" rather than a major and a minor number, so we must detect it in theMakefile.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Signed-off-by Pat Erley <[email protected]>Ok, I've committed a slightly different version of this (corrected the type, and made the compat code static inlines), can you verify it still works against 2.0?
Yep, works fine with 2.0
Alright, thanks for the patch and testing!
johannes
Quoted 2 lines · Johannes Berg
There's libnl 1.2 and 2.0? That's news to me! Patches welcome. Sorry, I guess it needs 1.0 or 1.1, will fix the page.
Well at http://people.suug.ch/~tgr/libnl/ it still only lists 1.1 but the git repository shows a clear move to 2.0 (forget I mentioned 1.2, that was my own tracking label). The code had a bunch of commits in October. In retrospect, if I just downloaded the 1.1 tarball from that webpage instead of using the git HEAD everything would have been fine. Patches can probably wait until 2.0 is officially released.
Quoted 8 lines
Quoted 7 lines
That's what I thought but I wasn't seeing any callbacks at all through my
ieee80211_opspointers. I did see the channel frequency change with 'iwconfig wlan0', but no callbacks. My fault, again, for not RTFM. I haven't gotten to the point yet on my driver where I expect 'ip link set up dev wlan0' (or 'ifconfig wlan0 up', if you prefer) and now I see that's why the config callback never happened.
Quoted 8 lines
Ah. Yes, if the hw isn't started mac80211 won't try to configure it :)
Quoted 3 lines
If I had RTFM I might
have noticed adding 'commit' at the end of the iwconfig command would have done it without the 'up'.No, it wouldn't, commit is pointless, don't worry about it, you'll never need to use it with mac80211.
When I reboot, modprobe the driver, and do 'iwconfig wlan0 channel 9 commit' the .config callback does run. If I leave off the 'commit' it does not. I'm trying to validate as many callbacks as I can before moving on to the next step, enabling the interface.
An additional question, if I may... Is wlan0 considered a "virtual interface" or does that term only apply to additional interfaces created with iw? The whole vif thing has me a little confused.
Thanks for the help.
--
Dan
Signature · 2 lines
http://www.fastmail.fm - Accessible with your email software
or over the webQuoted 3 lines · Dan E
When I reboot, modprobe the driver, and do 'iwconfig wlan0 channel 9 commit' the .config callback does run. If I leave off the 'commit' it does not.
Strange. But .start also runs, right? Something must be turning up the interface.
Quoted 6 lines
I'm trying to validate as many callbacks as I can before moving on to the next step, enabling the interface.
An additional question, if I may... Is wlan0 considered a "virtual interface" or does that term only apply to additional interfaces created with iw? The whole vif thing has me a little confused.
Yes, wlan0 is a virtual interface too, the first one.
johannes
Quoted 8 lines · Johannes Berg
Quoted 3 lines · Dan E
When I reboot, modprobe the driver, and do 'iwconfig wlan0 channel 9 commit' the .config callback does run. If I leave off the 'commit' it does not.
Strange. But .start also runs, right? Something must be turning up the interface.
Eh, no you are right. It doesn't run. iwconfig was giving me an error message that I mistook for one of my callback printk debugging calls. I jumped to the wrong conclusion.
Quoted 8 lines
Quoted 6 lines
I'm trying to validate as many callbacks as I can before moving on to the next step, enabling the interface.
An additional question, if I may... Is wlan0 considered a "virtual interface" or does that term only apply to additional interfaces created with iw? The whole vif thing has me a little confused.
Yes, wlan0 is a virtual interface too, the first one.
So I should expect the callbacks (e.g. .add_interface and .remove_interface) when wlan0 gets created?
I cannot thank you enough for your help here. I'm finally starting to feel like I can get beyond a few mental blocks I've had regarding the underlying framework, and start concentrating on the real driver workings.
--
Dan
Signature · 1 line
http://www.fastmail.fm - I mean, what is it about a decent email service?
Quoted 6 lines · Dan E
Quoted 2 lines
Strange. But .start also runs, right? Something must be turning up the interface.
Eh, no you are right. It doesn't run. iwconfig was giving me an error message that I mistook for one of my callback printk debugging calls. I jumped to the wrong conclusion.
Heh ok.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
An additional question, if I may... Is wlan0 considered a "virtual interface" or does that term only apply to additional interfaces created with iw? The whole vif thing has me a little confused.
Yes, wlan0 is a virtual interface too, the first one.
So I should expect the callbacks (e.g. .add_interface and .remove_interface) when wlan0 gets created?
Yes. Well, no. You only get those callbacks once the interface is set UP.
johannes
Hello,
I tried to understand the following but could not:
Quoted 6 lines
Quoted 2 lines
For instance, how do I command a
channel change from userspace? iw doesn't have that. >Should it?Yes, it should, and nl80211 even supports it, but iw itself >doesn't yet. That's fairly easy to fix, too, but then iw won't support actually telling mac80211 to scan and associate etc.
Can you please explain why addition of channel changing in iw will cause iw to not be able to support scanning and association ? (wireless-tools has all this options).
Regards,
DavidS
Quoted 75 lines · Johannes Berg
Quoted 9 lines · Dan E
Looking at some of the Linux Wireless website pages it appears as though "iw" is meant to be the successor to the older pre-mac80211 userspace tools. In that category we have ifconfig, iproute2, iwconfig and iwpriv. For an AP there's also hostapd and
wpa_supplicant. Probably some others I've missed, not to mention Network Manager. I can see how configuration and setup wouldn't necessarily be limited to "iw" using nl/cfg80211, but in the short term is that the tool of choice for migrating the functionality of the old tools to the new mac80211 infrastructure?Not really, in the short term, you still are using iwconfig (wireless extensions) with anything but hostapd.
Quoted 1 line
Here's my situation: [snip]
nice
Quoted 2 lines
Userspace tools. I want to proceed as if Wireless Extensions never existed. Is that even possible?
No, it's not.
Quoted 2 lines
For instance, how do I command a
channel change from userspace? iw doesn't have that. Should it?Yes, it should, and nl80211 even supports it, but iw itself doesn't yet. That's fairly easy to fix, too, but then iw won't support actually telling mac80211 to scan and associate etc.
Quoted 2 lines
Or do
I need to drop back to iwconfig?For now.
Quoted 3 lines
Is iw the preferred command-line way
to do everything the old tools did, but using nl/cfg80211 instead of ioctls?Not _yet_.
Quoted 3 lines
When we get to AP mode, will hostapd be re-written to speak
nl/cfg80211, or is a new config tool needed? The same questions apply towpa_supplicant.That's already been done. The plan is to keep wext compatibility around though, obviously, so iwconfig will work in the foreseeable future.
Quoted 7 lines
In general, what's the way forward for new userspace tools? nl80211 and cfg80211 are a given, I understand that, but what's the recommended approach from the perspective of a developer looking to make a clean break from Wireless Extensions with a new cleanroom driver written from scratch with no pre-existing baggage to worry about? Start making additions to iw's capabilities? Adapt some other existing tool to use nl/cfg80211, or write something completely new?
If you're writing a mac80211-based driver, there's no point where you could possibly get in touch with the userspace API. You're writing the driver completely to mac80211's internal driver API, and mac80211 completely shields you from the userspace API. You'll never interact with either wireless extensions or nl80211.
Quoted 4 lines
If somone could answer only 1 question (okay, it's a two-parter) the one I would most like answered is this: How does one, from userspace, ask the driver to switch to a specific channel, and what callback(s) from mac80211 should my driver expect to receive as a result?
iwconfig wlan0 channel 7
then mac80211 calls your
_ops->config()with the channel flag. Have you looked at the mac80211 book and the other documentation on
http://wireless.kernel.org/?johannes
Quoted 10 lines · David Shwatrz
Quoted 6 lines
Quoted 2 lines
For instance, how do I command a
channel change from userspace? iw doesn't have that. >Should it?Yes, it should, and nl80211 even supports it, but iw itself >doesn't yet. That's fairly easy to fix, too, but then iw won't support actually telling mac80211 to scan and associate etc.
Can you please explain why addition of channel changing in iw will cause iw to not be able to support scanning and association ? (wireless-tools has all this options).
Eh, no, I worded that wrongly, I meant that it currently _doesn't_ support scan/associate. And nor does nl80211, so that's not easy to fix (well, scan is WIP)
johannes