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.
This commit is contained in:
@@ -38,9 +38,6 @@
|
|||||||
/* Define to 1 if libsystemd is available */
|
/* Define to 1 if libsystemd is available */
|
||||||
#mesondefine HAVE_LIBSYSTEMD
|
#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. */
|
/* Define to 1 if you have the `secure_getenv' function. */
|
||||||
#mesondefine HAVE_SECURE_GETENV
|
#mesondefine HAVE_SECURE_GETENV
|
||||||
|
|
||||||
|
24
configure.ac
24
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)
|
AC_MSG_ERROR(Linux kernel development header linux/nl80211.h not installed or not functional)
|
||||||
fi
|
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
|
||||||
dnl Default to using wpa_supplicant but allow IWD as wifi backend
|
dnl Default to using wpa_supplicant but allow IWD as wifi backend
|
||||||
dnl
|
dnl
|
||||||
|
16
meson.build
16
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')
|
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
|
endif
|
||||||
config_h.set10('WITH_WIFI', enable_wifi)
|
config_h.set10('WITH_WIFI', enable_wifi)
|
||||||
|
|
||||||
|
@@ -938,7 +938,6 @@ wifi_find_frequency (NMPlatform *platform, int ifindex, const guint32 *freqs)
|
|||||||
static void
|
static void
|
||||||
wifi_indicate_addressing_running (NMPlatform *platform, int ifindex, gboolean running)
|
wifi_indicate_addressing_running (NMPlatform *platform, int ifindex, gboolean running)
|
||||||
{
|
{
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static guint32
|
static guint32
|
||||||
|
@@ -792,7 +792,6 @@ wifi_nl80211_get_qual (WifiData *data)
|
|||||||
return sta_info.signal;
|
return sta_info.signal;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAVE_NL80211_CRITICAL_PROTOCOL_CMDS
|
|
||||||
static gboolean
|
static gboolean
|
||||||
wifi_nl80211_indicate_addressing_running (WifiData *data, gboolean running)
|
wifi_nl80211_indicate_addressing_running (WifiData *data, gboolean running)
|
||||||
{
|
{
|
||||||
@@ -801,16 +800,21 @@ wifi_nl80211_indicate_addressing_running (WifiData *data, gboolean running)
|
|||||||
int err;
|
int err;
|
||||||
|
|
||||||
msg = nl80211_alloc_msg (nl80211,
|
msg = nl80211_alloc_msg (nl80211,
|
||||||
running ? NL80211_CMD_CRIT_PROTOCOL_START :
|
running
|
||||||
NL80211_CMD_CRIT_PROTOCOL_STOP,
|
? 98 /* NL80211_CMD_CRIT_PROTOCOL_START */
|
||||||
|
: 99 /* NL80211_CMD_CRIT_PROTOCOL_STOP */,
|
||||||
0);
|
0);
|
||||||
/* Despite the DHCP name, we're using this for any type of IP addressing,
|
/* Despite the DHCP name, we're using this for any type of IP addressing,
|
||||||
* DHCPv4, DHCPv6, and IPv6 SLAAC.
|
* 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) {
|
if (running) {
|
||||||
/* Give DHCP 5 seconds to complete */
|
/* 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);
|
err = nl80211_send_and_recv (nl80211, msg, NULL, NULL);
|
||||||
@@ -820,7 +824,6 @@ nla_put_failure:
|
|||||||
nlmsg_free (msg);
|
nlmsg_free (msg);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
struct nl80211_wowlan_info {
|
struct nl80211_wowlan_info {
|
||||||
gboolean enabled;
|
gboolean enabled;
|
||||||
@@ -1077,9 +1080,7 @@ wifi_nl80211_init (int ifindex)
|
|||||||
.get_rate = wifi_nl80211_get_rate,
|
.get_rate = wifi_nl80211_get_rate,
|
||||||
.get_qual = wifi_nl80211_get_qual,
|
.get_qual = wifi_nl80211_get_qual,
|
||||||
.get_wowlan = wifi_nl80211_get_wowlan,
|
.get_wowlan = wifi_nl80211_get_wowlan,
|
||||||
#if HAVE_NL80211_CRITICAL_PROTOCOL_CMDS
|
|
||||||
.indicate_addressing_running = wifi_nl80211_indicate_addressing_running,
|
.indicate_addressing_running = wifi_nl80211_indicate_addressing_running,
|
||||||
#endif
|
|
||||||
.deinit = wifi_nl80211_deinit,
|
.deinit = wifi_nl80211_deinit,
|
||||||
};
|
};
|
||||||
WifiDataNl80211 *nl80211;
|
WifiDataNl80211 *nl80211;
|
||||||
|
Reference in New Issue
Block a user