Commit a3f77b25 authored by Thomas Haller's avatar Thomas Haller

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.
parent feb1fc2e
......@@ -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
......
......@@ -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
......
......@@ -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)
......
......@@ -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
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment