]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Fix sending proper VLAN ID attr value when using VLAN offload
authorSeevalamuthu Mariappan <seevalam@codeaurora.org>
Thu, 11 Jun 2020 11:37:35 +0000 (17:07 +0530)
committerJouni Malinen <j@w1.fi>
Wed, 15 Jul 2020 21:25:14 +0000 (00:25 +0300)
The NL80211_ATTR_VLAN_ID attribute expects non-zero values, but vlan_id
with value 0 has been set in VLAN offload case. Due to this, station
connection failure is observed if the driver advertises VLAN_OFFLOAD
support:

nl80211: NL80211_ATTR_STA_VLAN (addr=8c:fd:f0:22:19:15 ifname=wlan0
         vlan_id=0) failed: -34 (Result not representable)
wlan0: STA 8c:fd:f0:22:19:15 IEEE 802.11: could not bind the STA
         entry to vlan_id=0

Fix this by setting only non-zero values.

Fixes: 0f903f37dca1 ("nl80211: VLAN offload support")
Signed-off-by: Seevalamuthu Mariappan <seevalam@codeaurora.org>
src/drivers/driver_nl80211.c

index ea16d8dafaa9382f046a218654b54d6b0d80ff76..d70b56ba88165a8aef2ed4a7ecb0ad9b69c3b641 100644 (file)
@@ -6975,7 +6975,7 @@ static int i802_set_sta_vlan(struct i802_bss *bss, const u8 *addr,
                   MAC2STR(addr), ifname, if_nametoindex(ifname), vlan_id);
        if (!(msg = nl80211_bss_msg(bss, 0, NL80211_CMD_SET_STATION)) ||
            nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, addr) ||
-           ((drv->capa.flags & WPA_DRIVER_FLAGS_VLAN_OFFLOAD) &&
+           (vlan_id && (drv->capa.flags & WPA_DRIVER_FLAGS_VLAN_OFFLOAD) &&
             nla_put_u16(msg, NL80211_ATTR_VLAN_ID, vlan_id)) ||
            nla_put_u32(msg, NL80211_ATTR_STA_VLAN, if_nametoindex(ifname))) {
                nlmsg_free(msg);