summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-01-14 14:08:38 +0100
committerThomas Haller <thaller@redhat.com>2018-01-15 20:29:26 +0100
commita3f77b259cea16f32d6428cbba03f0409b1dd96e (patch)
tree50c0c18722f98dd71d636bd3ffd8606eee14133a
parentfeb1fc2e73cab36f2875b8e769890b1f37bbd33e (diff)
wifi: always build nl80211 CRIT_PROTOCOL support
netlink's API is stable, and strictly defined by the integer values that make up commands and attributes. There is little reason do disable a netlink feature based on compile time detection of the kernel headers. Either kernel supports it, or it will fail with an appropriate response. Also, support for NL80211_CMD_CRIT_PROTOCOL_START was merge to kernel in 2013. Maybe, we should now just always assume support (in the kernel headers is there). Anyway, don't do that yet, but instead avoid the defines and use the numeric values directly.
-rw-r--r--config.h.meson3
-rw-r--r--configure.ac24
-rw-r--r--meson.build16
-rw-r--r--src/platform/nm-fake-platform.c1
-rw-r--r--src/platform/wifi/wifi-utils-nl80211.c17
5 files changed, 9 insertions, 52 deletions
diff --git a/config.h.meson b/config.h.meson
index 704c0a48d2..e07e128a65 100644
--- a/config.h.meson
+++ b/config.h.meson
@@ -38,9 +38,6 @@
/* Define to 1 if libsystemd is available */
#mesondefine HAVE_LIBSYSTEMD
-/* Define if nl80211 has critical protocol support */
-#mesondefine HAVE_NL80211_CRITICAL_PROTOCOL_CMDS
-
/* Define to 1 if you have the `secure_getenv' function. */
#mesondefine HAVE_SECURE_GETENV
diff --git a/configure.ac b/configure.ac
index 8afebe4cc5..92e1588309 100644
--- a/configure.ac
+++ b/configure.ac
@@ -242,30 +242,6 @@ if test "$ac_have_nl80211" = no; then
AC_MSG_ERROR(Linux kernel development header linux/nl80211.h not installed or not functional)
fi
-if test "$with_wifi" = "yes"; then
- AC_MSG_CHECKING([Linux kernel nl80211 Critical Protocol Start/Stop])
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[#ifndef __user
- #define __user
- #endif
- #include <sys/types.h>
- #include <linux/types.h>
- #include <sys/socket.h>
- #include <linux/nl80211.h>]],
- [[unsigned a = NL80211_CMD_CRIT_PROTOCOL_START; a++;]])],
- [ac_have_nl80211_critproto=yes],
- [ac_have_nl80211_critproto=no])
- AC_MSG_RESULT($ac_have_nl80211_critproto)
-else
- ac_have_nl80211_critproto='no'
-fi
-if test "$ac_have_nl80211_critproto" = yes; then
- AC_DEFINE(HAVE_NL80211_CRITICAL_PROTOCOL_CMDS, 1, [Define if nl80211 has critical protocol support])
-else
- AC_DEFINE(HAVE_NL80211_CRITICAL_PROTOCOL_CMDS, 0, [Define if nl80211 has critical protocol support])
-fi
-
dnl
dnl Default to using wpa_supplicant but allow IWD as wifi backend
dnl
diff --git a/meson.build b/meson.build
index 8418cb1050..b3bb97189c 100644
--- a/meson.build
+++ b/meson.build
@@ -285,22 +285,6 @@ if enable_wifi
'''
assert(cc.compiles(nl80211_src), 'Linux kernel development header linux/nl80211.h not installed or not functional')
-
- nl80211_crit_proto_src = '''
- #ifndef __user
- #define __user
- #endif
- #include <sys/types.h>
- #include <linux/types.h>
- #include <sys/socket.h>
- #include <linux/nl80211.h>
- int main() {
- unsigned a = NL80211_CMD_CRIT_PROTOCOL_START;
- a++;
- }
- '''
-
- config_h.set10('HAVE_NL80211_CRITICAL_PROTOCOL_CMDS', cc.compiles(nl80211_crit_proto_src))
endif
config_h.set10('WITH_WIFI', enable_wifi)
diff --git a/src/platform/nm-fake-platform.c b/src/platform/nm-fake-platform.c
index be43015281..06dd7e1398 100644
--- a/src/platform/nm-fake-platform.c
+++ b/src/platform/nm-fake-platform.c
@@ -938,7 +938,6 @@ wifi_find_frequency (NMPlatform *platform, int ifindex, const guint32 *freqs)
static void
wifi_indicate_addressing_running (NMPlatform *platform, int ifindex, gboolean running)
{
- ;
}
static guint32
diff --git a/src/platform/wifi/wifi-utils-nl80211.c b/src/platform/wifi/wifi-utils-nl80211.c
index 5b84cfa892..35bd415114 100644
--- a/src/platform/wifi/wifi-utils-nl80211.c
+++ b/src/platform/wifi/wifi-utils-nl80211.c
@@ -792,7 +792,6 @@ wifi_nl80211_get_qual (WifiData *data)
return sta_info.signal;
}
-#if HAVE_NL80211_CRITICAL_PROTOCOL_CMDS
static gboolean
wifi_nl80211_indicate_addressing_running (WifiData *data, gboolean running)
{
@@ -801,16 +800,21 @@ wifi_nl80211_indicate_addressing_running (WifiData *data, gboolean running)
int err;
msg = nl80211_alloc_msg (nl80211,
- running ? NL80211_CMD_CRIT_PROTOCOL_START :
- NL80211_CMD_CRIT_PROTOCOL_STOP,
+ running
+ ? 98 /* NL80211_CMD_CRIT_PROTOCOL_START */
+ : 99 /* NL80211_CMD_CRIT_PROTOCOL_STOP */,
0);
/* Despite the DHCP name, we're using this for any type of IP addressing,
* DHCPv4, DHCPv6, and IPv6 SLAAC.
*/
- NLA_PUT_U16 (msg, NL80211_ATTR_CRIT_PROT_ID, NL80211_CRIT_PROTO_DHCP);
+ NLA_PUT_U16 (msg,
+ 179 /* NL80211_ATTR_CRIT_PROT_ID */,
+ 1 /* NL80211_CRIT_PROTO_DHCP */);
if (running) {
/* Give DHCP 5 seconds to complete */
- NLA_PUT_U16 (msg, NL80211_ATTR_MAX_CRIT_PROT_DURATION, 5000);
+ NLA_PUT_U16 (msg,
+ 180 /* NL80211_ATTR_MAX_CRIT_PROT_DURATION */,
+ 5000);
}
err = nl80211_send_and_recv (nl80211, msg, NULL, NULL);
@@ -820,7 +824,6 @@ nla_put_failure:
nlmsg_free (msg);
return FALSE;
}
-#endif
struct nl80211_wowlan_info {
gboolean enabled;
@@ -1077,9 +1080,7 @@ wifi_nl80211_init (int ifindex)
.get_rate = wifi_nl80211_get_rate,
.get_qual = wifi_nl80211_get_qual,
.get_wowlan = wifi_nl80211_get_wowlan,
-#if HAVE_NL80211_CRITICAL_PROTOCOL_CMDS
.indicate_addressing_running = wifi_nl80211_indicate_addressing_running,
-#endif
.deinit = wifi_nl80211_deinit,
};
WifiDataNl80211 *nl80211;