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>
This commit is contained in:
Jouni Malinen 2021-02-13 23:59:28 +02:00
parent 1b45b8d3f6
commit 58bbbb5981
1 changed files with 24 additions and 0 deletions

View File

@ -675,6 +675,7 @@ struct wiphy_idx_data {
int wiphy_idx;
enum nl80211_iftype nlmode;
u8 *macaddr;
u8 use_4addr;
};
@ -697,6 +698,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;
}
@ -752,6 +756,21 @@ 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,
NULL, NULL))
return -1;
return data.use_4addr;
}
static int nl80211_register_beacons(struct wpa_driver_nl80211_data *drv,
struct nl80211_wiphy_data *w)
{
@ -11788,6 +11807,11 @@ static int nl80211_set_4addr_mode(void *priv, const char *bridge_ifname,
ret = send_and_recv_msgs(drv, msg, NULL, NULL, 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)