Bug 477833

Summary: Feature Proposal/Request: Add Ability to explicitly choose driver-extension for wpa_supplicant
Product: [openSUSE] openSUSE 11.2 Reporter: Axel Köllhofer <AxelKoellhofer>
Component: NetworkAssignee: Marius Tomaschewski <mt>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Enhancement    
Priority: P5 - None    
Version: Factory   
Target Milestone: ---   
Hardware: All   
OS: SUSE Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: Proposed ifup-wireless patch adding WIRELESS_WPA_DRIVER and new drivers

Description Axel Köllhofer 2009-02-19 20:04:53 UTC
User-Agent:       Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.10 (like Gecko) SUSE

Background:

Since Version 0.6.7, wpa_supplicant offers the new (generic) extension "nl80211" for "new" wireless drivers based on mac80211.

The ifup-wireless script chooses the appropriate driver-extension for wpa_supplicant by looking at the kernel module used for the device.

case $ACTION in
    up)
        case "${DRIVER}" in
            ath_pci)
                WPA_DRIVER=wext
                ;;
            at76c5*)
                WPA_DRIVER=atmel
                PREFER_WPA_SUPPLICANT=no
                ;;
            prism54)
                WPA_DRIVER=prism54
                PREFER_WPA_SUPPLICANT=no
                ;;
            ipw2200|ipw3945|hostap_*)
                WPA_DRIVER=wext
                ;;
            ipw2100)
                WPA_DRIVER=wext
                ;;
            ndiswrapper|*.sys)
                WPA_DRIVER=wext
                ;;
            rt2500*)
                WPA_DRIVER=wext
                ;;
            *)
                WPA_DRIVER=unsupported
                PREFER_WPA_SUPPLICANT=no
                ;;
        esac

However, this would not work here, as there are now two different extensions available for the same kernel module, so the basic idea is to give the user the possibility to explicitly choose the driver used by wpa_supplicant.

I am not a "scripting guru", but this little hack in /etc/sysconfig/network/scripts/wireless makes this at least possible.

    mkdir -p /var/run/wpa_supplicant
    message "`printf "    %-9s starting wpa_supplicant" $INTERFACE`"

########### lines added start ###########
    if [ -n "$WIRELESS_WPA_DRIVER" ]; then
            WPA_DRIVER="$WIRELESS_WPA_DRIVER"
    else
        WPA_DRIVER=$WPA_DRIVER
    fi
########### lines added end ##############

    eval wpa_supplicant -i$INTERFACE -c$WPA_SUPP_CONF -D$WPA_DRIVER $SUPPARGS

Now, by setting the variable "WIRELESS_WPA_DRIVER='name_of_wpa_driver' in the respective /etc/sysconfig/network/ifcfg-*wireless-devie'-file, one can define which extension wpa_supplicant will use when connecting via ifup.

I think this is quite useful and hopefully also easy to implement (at least into ifup) without breaking already existing functionality, as ifup will use the existing method for determination of the wpa-extension, when this variable is not set. 

In addition, users who have to use "exotic" drivers for their wireless hardware (old "otus"-driver for Atheros draft-n USB-dongles or "legacy" drivers for Ralink-devices rt61/rt73, which both need their own wpa-extensions "otus" or "ralink") would have an easy method of accomplishing this task (of course, they will still need to build a wpa_supplicant capable of using those "non-standard" wpa-extensions, but thats a different story).



Reproducible: Always

Steps to Reproduce:
1.
2.
3.
Comment 1 Axel Köllhofer 2009-02-19 20:16:16 UTC
 ....but this little hack in
/etc/sysconfig/network/scripts/wireless ....

Sorry for the typo, of course this should be

/etc/sysconfig/network/scripts/ifup-wireless
Comment 2 Helmut Schaa 2009-02-27 12:39:03 UTC
Fine with me. However, we do not have wpa_supplicant 0.6.7 in factory yet ;)
Comment 3 Marius Tomaschewski 2009-02-27 12:54:58 UTC
Yes, this makes sense to allow the user to provide/override our choice.
Comment 4 Axel Köllhofer 2009-02-28 21:44:06 UTC
(In reply to comment #2)
> Fine with me. However, we do not have wpa_supplicant 0.6.7 in factory yet ;)

I know, I am running my "own" customized rebuild of 0.6.8 (latest stable release) based on your SPEC for 0.6.4 here. 

I had to adapt some of your patches to apply cleanly, some of them I was not able to "rewrite" (I' m not a programmer) and I also enabled the extension "ralink", which is included since 0.6.0 (for use with ralink "legacy drivers" rt61 and rt73, some colleague of mine had problems with rt61pci under 2.6.25/openSUSE 11.0, as some of the rt2x00-drivers were not to stable in that version).

Perhaps you can consider also to enable the "ralink"-extension in your build, in most cases the new rt2x00-drivers are fine, but sometimes rt61-devices are a little problematic, so users will at least have the possibility to use legacy-drivers with ifup without having to rebuild wpa_supplicant. 

At least this would fit nicely with this enhancement, if somebody needs the feature, he' s got it at his hands, if not, no harm has been done and he will use "wext" and the new drivers automatically.
Comment 5 Marius Tomaschewski 2009-03-02 13:19:16 UTC
Axel,
it currently needs a little bit time to "sync" (rebuild, ...), but
I'll add a patch allowing to set the driver for ifup-wireless to
this factory devel project package here:

http://download.opensuse.org/repositories/home://mtomaschewski://Factory/openSUSE_Factory/
Comment 6 Axel Köllhofer 2009-03-02 21:32:07 UTC
Excellent, of course I will test the modified sysconfig-package as soon as it is available.

BTW:

I also made a few other (cosmetic?) changes to ifup-wirless, considering the warnings "WPA is configured but my be unsupported by this device" when using wext with some of the new drivers, which are known to work rather flawlessly now (mostly the mac80211-based ones).

I several fora, users were confused by this message and sometimes the respective thread went into the wrong direction, because they took this warning too seriously, although the real problem was located somewhere else.

If you are interested, the changes I made are very simple:

--- ifup-wireless.orig  2009-03-02 22:06:14.000000000 +0100
+++ ifup-wireless       2009-03-02 22:07:59.000000000 +0100
@@ -700,6 +700,30 @@
             rt2500*)
                 WPA_DRIVER=wext
                 ;;
+############################################################################################################
+########### Add a few new drivers which are known to work reliably with "wext" #############################
+############################################################################################################
+            rt61pci|rt73usb|rt2400pci)
+                WPA_DRIVER=wext
+                ;;
+            iwlagn|iwl3945|iwl4965)
+                WPA_DRIVER=wext
+                ;;
+            zd1211rw)
+                WPA_DRIVER=wext
+                ;;
+            ath5k|ath9k)
+                WPA_DRIVER=wext
+                ;;
+            b43|b43legacy|ssb)
+                WPA_DRIVER=wext
+                ;;
+            p54pci|p54usb)
+                WPA_DRIVER=wext
+                ;;
+############################################################################################################
+########### End section of new "wext"-compatible drivers ###################################################
+############################################################################################################
             *)
                 WPA_DRIVER=unsupported
                 PREFER_WPA_SUPPLICANT=no

The only section where I am not really sure is the part for the b43-drivers, as I don't know, if ifup-wireless detects the b43(legacy) or ssb as the actual "driver in use".

If you consider activating the "ralink"-extension in wpa_supplicant, the following section would also make sense:

             rt61|rt73)
                WPA_DRIVER=ralink
                ;;

This will run wpa_supplicant with "-Dralink" only if one of the legacy-drivers rt73 or rt61 is used (the only legacy-drivers supported by wpa_supplicant with "-Dralink"), and it is known to work with ifup (AFAIK Networkmanager does only play well with "wext", but these changes would only affect ifup anyway and if one has to use legacy-drivers, there is no other choice than switching to "good old ifup"), especially in cases, where the new drivers rt61pci or rt73usb (the latter is a lot less problematic) give problems. 

Another question arose when having a closer look at the "staging"-drivers now being included in the openSUSE-Kernel:

The "old" driver for Atmel USB-adaptors seems to have changed his name:

/lib/modules/2.6.27.19-3.2-pae/kernel/drivers/staging/at76_usb/at76_usb.ko

so this rule here

            at76c5*)
                WPA_DRIVER=atmel
                PREFER_WPA_SUPPLICANT=no
                ;;

will not work any more or even worse, it might give problems, as there is now also the "new" driver "at76c50x-usb.ko" based on mac80211 (and already included in compat-wireless) which normally should use "wext" instead of "atmel" for wpa_supplicant.

I am not 100% sure about this, but at least it might be a potential problem.
Comment 7 Helmut Schaa 2009-03-03 08:02:34 UTC
(In reply to comment #6)
> +            rt61pci|rt73usb|rt2400pci)
> +            iwlagn|iwl3945|iwl4965)
> +            zd1211rw)
> +            ath5k|ath9k)
> +            b43|b43legacy|ssb)
> +            p54pci|p54usb)

Fine with me. rt2500usb should be added as well.

> I don't know, if ifup-wireless detects the b43(legacy) or ssb as the actual
> "driver in use".

It should be b43 (or b43legacy). So we can just leave ssb out here.

> If you consider activating the "ralink"-extension in wpa_supplicant, the
> following section would also make sense:

Could you please open a new report for that one and directly assign it to me? Let's keep this bug for sysconfig related stuff.

> The "old" driver for Atmel USB-adaptors seems to have changed his name:
> 
> /lib/modules/2.6.27.19-3.2-pae/kernel/drivers/staging/at76_usb/at76_usb.ko

To be honest. I'd like to ignore that driver as it will soon be superseded by at76c50x-usb. Furthermore, from a quick look at the code it seems like at76_usb also implements wext (at least partially). But I have no card here to verify that.

> so this rule here
> 
>             at76c5*)
>                 WPA_DRIVER=atmel
>                 PREFER_WPA_SUPPLICANT=no
>                 ;;
> 
> will not work any more or even worse, it might give problems, as there is now
> also the "new" driver "at76c50x-usb.ko" based on mac80211 (and already included
> in compat-wireless) which normally should use "wext" instead of "atmel" for
> wpa_supplicant.

Yep. Let's just use wext for "at76*".
Comment 8 Axel Köllhofer 2009-03-03 09:38:48 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > +            rt61pci|rt73usb|rt2400pci)
> > +            iwlagn|iwl3945|iwl4965)
> > +            zd1211rw)
> > +            ath5k|ath9k)
> > +            b43|b43legacy|ssb)
> > +            p54pci|p54usb)
> 
> Fine with me. rt2500usb should be added as well.

I think that one is already covered here

             rt2500*)
                 WPA_DRIVER=wext
                 ;;

but perhaps it might be better to use the full driver names (like in the other examples):

             rt2500usb|rt2500pci)
                 WPA_DRIVER=wext
                 ;;


> Could you please open a new report for that one and directly assign it to me?
> Let's keep this bug for sysconfig related stuff.


OK, I'll try that (if I find out how to directly assign a Bug to somebody, shouldn't be too difficult.)

> 
> To be honest. I'd like to ignore that driver as it will soon be superseded by
> at76c50x-usb. Furthermore, from a quick look at the code it seems like at76_usb
> 
> Let's just use wext for "at76*".

Ok, you're the boss. :-)
Comment 9 Marius Tomaschewski 2009-08-12 11:49:41 UTC
Created attachment 312202 [details]
Proposed ifup-wireless patch adding WIRELESS_WPA_DRIVER and new drivers

Axel,

sorry that it took so long. Can you verify the patch? I'm about to apply
it to the "Base:System/sysconfig" project and submit to openSUSE:Factory
then (soon).

Thanks for all your work!
Comment 10 Marius Tomaschewski 2009-08-12 11:51:35 UTC
I think the new code is easier to read than the patch:

        test -n "$WIRELESS_WPA_DRIVER"    && \
        WPA_DRIVER="$WIRELESS_WPA_DRIVER" || \
        case "${DRIVER}" in
            prism54)
                WPA_DRIVER=prism54
                PREFER_WPA_SUPPLICANT=no
                ;;
            ipw2200|ipw2100|ipw3945|hostap_*)
                WPA_DRIVER=wext
                ;;
            ndiswrapper|*.sys)
                WPA_DRIVER=wext
                ;;
            rt2500usb|rt2500pci)
                WPA_DRIVER=wext
                ;;
            rt61pci|rt73usb|rt2400pci)
                WPA_DRIVER=wext
                ;;
            iwlagn|iwl3945|iwl4965)
                WPA_DRIVER=wext
                ;;
            zd1211rw)
                WPA_DRIVER=wext
                ;;
            ath5k|ath9k|ath_pci)
                WPA_DRIVER=wext
                ;;
            b43|b43legacy|ssb)
                WPA_DRIVER=wext
                ;;
            p54pci|p54usb)
                WPA_DRIVER=wext
                ;;
            at76*)
                WPA_DRIVER=wext
                ;;
            *)
                WPA_DRIVER=unsupported
                PREFER_WPA_SUPPLICANT=no
                ;;
        esac
Comment 11 Marius Tomaschewski 2009-08-12 12:11:21 UTC
submitted (the patch at the moment) to OBS Base:System/sysconfig.
Comment 12 Marius Tomaschewski 2009-08-13 12:49:18 UTC
submitted also rt61|rt73 => ralink driver mapping (bnc#481380)

created submit request to openSUSE:Factory id 17690
Comment 13 Axel Köllhofer 2009-10-01 18:14:43 UTC
Talking about late replies.

Just "stumbled" over this thread by coincidence after having completely forgotten about it.

To give some (late) feedback.

Applied the new ifup-wireless script to my installation (which is 11.1 at the moment) and switching wpa-drivers (in my case from wext to nl80211 and back using wpa_supplicant 0.6.9) works perfectly.
Comment 14 Marius Tomaschewski 2009-10-02 07:44:44 UTC
OK, thanks! It is submitted & available on 11.2.