mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-24 07:46:48 +00:00
hostapd: backport ignoring 4addr mode enabling error
This is a backport of the upstream commit 58bbbb598144 ("nl80211: Ignore
4addr mode enabling error if it was already enabled") which fixes same
issue as in the current fix contained in '130-wpa_supplicant-multi_ap_roam.patch',
but in a different way:
nl80211_set_4addr_mode() could fail when trying to enable 4addr mode on
an interface that is in a bridge and has 4addr mode already enabled.
This operation would not have been necessary in the first place and this
failure results in disconnecting, e.g., when roaming from one backhaul
BSS to another BSS with Multi AP.
Avoid this issue by ignoring the nl80211 command failure in the case
where 4addr mode is being enabled while it has already been enabled.
Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
[bump PKG_RELEASE, more verbose commit description]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
(cherry picked from commit fb860b4e41
)
This commit is contained in:
parent
7a0cd1ede4
commit
60823c67cb
@ -7,7 +7,7 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=hostapd
|
PKG_NAME:=hostapd
|
||||||
PKG_RELEASE:=31
|
PKG_RELEASE:=32
|
||||||
|
|
||||||
PKG_SOURCE_URL:=http://w1.fi/hostap.git
|
PKG_SOURCE_URL:=http://w1.fi/hostap.git
|
||||||
PKG_SOURCE_PROTO:=git
|
PKG_SOURCE_PROTO:=git
|
||||||
|
@ -0,0 +1,78 @@
|
|||||||
|
From c7cca9b08f3e1e49c4a4a59ec66c47d91448e6ae Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jouni Malinen <j@w1.fi>
|
||||||
|
Date: Sat, 13 Feb 2021 23:59:28 +0200
|
||||||
|
Subject: [PATCH] nl80211: Ignore 4addr mode enabling error if it was already
|
||||||
|
enabled
|
||||||
|
|
||||||
|
nl80211_set_4addr_mode() could fail when trying to enable 4addr mode on
|
||||||
|
an interface that is in a bridge and has 4addr mode already enabled.
|
||||||
|
This operation would not have been necessary in the first place and this
|
||||||
|
failure results in disconnecting, e.g., when roaming from one backhaul
|
||||||
|
BSS to another BSS with Multi AP.
|
||||||
|
|
||||||
|
Avoid this issue by ignoring the nl80211 command failure in the case
|
||||||
|
where 4addr mode is being enabled while it has already been enabled.
|
||||||
|
|
||||||
|
Signed-off-by: Jouni Malinen <j@w1.fi>
|
||||||
|
---
|
||||||
|
src/drivers/driver_nl80211.c | 23 +++++++++++++++++++++++
|
||||||
|
1 file changed, 23 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
|
||||||
|
index 72189da24..011a15e68 100644
|
||||||
|
--- a/src/drivers/driver_nl80211.c
|
||||||
|
+++ b/src/drivers/driver_nl80211.c
|
||||||
|
@@ -617,6 +617,7 @@ struct wiphy_idx_data {
|
||||||
|
int wiphy_idx;
|
||||||
|
enum nl80211_iftype nlmode;
|
||||||
|
u8 *macaddr;
|
||||||
|
+ u8 use_4addr;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -639,6 +640,9 @@ static int netdev_info_handler(struct nl_msg *msg, void *arg)
|
||||||
|
os_memcpy(info->macaddr, nla_data(tb[NL80211_ATTR_MAC]),
|
||||||
|
ETH_ALEN);
|
||||||
|
|
||||||
|
+ if (tb[NL80211_ATTR_4ADDR])
|
||||||
|
+ info->use_4addr = nla_get_u8(tb[NL80211_ATTR_4ADDR]);
|
||||||
|
+
|
||||||
|
return NL_SKIP;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -691,6 +695,20 @@ static int nl80211_get_macaddr(struct i802_bss *bss)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
+static int nl80211_get_4addr(struct i802_bss *bss)
|
||||||
|
+{
|
||||||
|
+ struct nl_msg *msg;
|
||||||
|
+ struct wiphy_idx_data data = {
|
||||||
|
+ .use_4addr = 0,
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ if (!(msg = nl80211_cmd_msg(bss, 0, NL80211_CMD_GET_INTERFACE)) ||
|
||||||
|
+ send_and_recv_msgs(bss->drv, msg, netdev_info_handler, &data))
|
||||||
|
+ return -1;
|
||||||
|
+ return data.use_4addr;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
static int nl80211_register_beacons(struct wpa_driver_nl80211_data *drv,
|
||||||
|
struct nl80211_wiphy_data *w)
|
||||||
|
{
|
||||||
|
@@ -11482,6 +11500,11 @@ static int nl80211_set_4addr_mode(void *priv, const char *bridge_ifname,
|
||||||
|
|
||||||
|
ret = send_and_recv_msgs(drv, msg, NULL, NULL);
|
||||||
|
msg = NULL;
|
||||||
|
+ if (ret && val && nl80211_get_4addr(bss) == 1) {
|
||||||
|
+ wpa_printf(MSG_DEBUG,
|
||||||
|
+ "nl80211: 4addr mode was already enabled");
|
||||||
|
+ ret = 0;
|
||||||
|
+ }
|
||||||
|
if (!ret) {
|
||||||
|
if (bridge_ifname[0] && val &&
|
||||||
|
i802_check_bridge(drv, bss, bridge_ifname, bss->ifname) < 0)
|
||||||
|
--
|
||||||
|
2.29.2
|
||||||
|
|
@ -1,37 +0,0 @@
|
|||||||
From 8a4893dd06eb236460db4937f3c54e246739ad28 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= <raphael.melotte@mind.be>
|
|
||||||
Date: Wed, 3 Feb 2021 14:23:17 +0100
|
|
||||||
Subject: [PATCH] wpa_supplicant: multi_ap: only enable 4addr mode if not
|
|
||||||
already enabled
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
If 4addr mode is already enabled, the call to enable it a second time
|
|
||||||
may fail. If this happens when roaming, it leads to deauthentication.
|
|
||||||
|
|
||||||
Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
|
|
||||||
---
|
|
||||||
wpa_supplicant/events.c | 10 ++++++----
|
|
||||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
|
||||||
|
|
||||||
--- a/wpa_supplicant/events.c
|
|
||||||
+++ b/wpa_supplicant/events.c
|
|
||||||
@@ -2589,11 +2589,13 @@ static void multi_ap_set_4addr_mode(stru
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (wpa_drv_set_4addr_mode(wpa_s, 1) < 0) {
|
|
||||||
- wpa_printf(MSG_ERROR, "Failed to set 4addr mode");
|
|
||||||
- goto fail;
|
|
||||||
+ if (wpa_s->enabled_4addr_mode == 0) {
|
|
||||||
+ if (wpa_drv_set_4addr_mode(wpa_s, 1) < 0) {
|
|
||||||
+ wpa_printf(MSG_ERROR, "Failed to set 4addr mode");
|
|
||||||
+ goto fail;
|
|
||||||
+ }
|
|
||||||
+ wpa_s->enabled_4addr_mode = 1;
|
|
||||||
}
|
|
||||||
- wpa_s->enabled_4addr_mode = 1;
|
|
||||||
return;
|
|
||||||
|
|
||||||
fail:
|
|
Loading…
Reference in New Issue
Block a user