From: Roy Marples Date: Mon, 15 Sep 2014 23:05:20 +0000 (+0000) Subject: It's possible to configure a Linux kernel with nl80211 where the X-Git-Tag: v6.4.4~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f7d83c0dfcb2f59cdff41e7892ea507ecac2f639;p=thirdparty%2Fdhcpcd.git It's possible to configure a Linux kernel with nl80211 where the 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. --- diff --git a/configure b/configure index 4a94e15d..eb793c52 100755 --- 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 diff --git a/if-linux.c b/if-linux.c index f4a6265d..59a15634 100644 --- a/if-linux.c +++ b/if-linux.c @@ -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 {