]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
It's possible to configure a Linux kernel with nl80211 where the
authorRoy Marples <roy@marples.name>
Mon, 15 Sep 2014 23:05:20 +0000 (23:05 +0000)
committerRoy Marples <roy@marples.name>
Mon, 15 Sep 2014 23:05:20 +0000 (23:05 +0000)
SSID won't be reported, but is available via WEXT.
This is very silly, but dhcpcd still needs to work.
Thus enable both protocols and use nl80211 if WEXT fails.

configure
if-linux.c

index 4a94e15d573e61c7859ba58cbd0a7ce3944d4962..eb793c52a593ed6450548a4d64fba78468a7d6a0 100755 (executable)
--- a/configure
+++ b/configure
@@ -432,9 +432,14 @@ EOF
                echo "#define HAVE_NL80211_H" >>$CONFIG_H
        else
                echo "no"
-               echo "DHCPCD_SRCS+=     if-linux-wext.c" >>$CONFIG_MK
        fi
        rm -f _nl80211.c _nl80211
+
+       # Even though we have nl80211, we only use it as a fallback
+       # because it's currently possible to configure a kernel
+       # where the SSID associated to won't be reported by nl80211
+       # but will be via WEXT.
+       echo "DHCPCD_SRCS+=     if-linux-wext.c" >>$CONFIG_MK
 fi
 
 abort=false
index f4a6265d1ccc44b1aa519b265aebf72daa53708a..59a156341f31e6d6893647c4f0a90f4adecfc03e 100644 (file)
@@ -970,8 +970,8 @@ out:
        return ifp->ssid_len;
 }
 
-int
-if_getssid(struct interface *ifp)
+static int
+if_getssid_nl80211(struct interface *ifp)
 {
        int family;
        struct nlmg nlm;
@@ -990,7 +990,8 @@ if_getssid(struct interface *ifp)
        return send_netlink(ifp->ctx, ifp,
            NETLINK_GENERIC, &nlm.hdr, &_if_getssid);
 }
-#else
+#endif
+
 int
 if_getssid(struct interface *ifp)
 {
@@ -999,9 +1000,12 @@ if_getssid(struct interface *ifp)
        r = if_getssid_wext(ifp->name, ifp->ssid);
        if (r != -1)
                ifp->ssid_len = r;
+#ifdef HAVE_NL80211_H
+       else if (r == -1)
+               r = if_getssid_nl80211(ifp);
+#endif
        return r;
 }
-#endif
 
 struct nlma
 {