From: Seevalamuthu Mariappan Date: Thu, 11 Jun 2020 11:37:35 +0000 (+0530) Subject: nl80211: Fix sending proper VLAN ID attr value when using VLAN offload X-Git-Tag: hostap_2_10~1084 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cc6153a8a4555407562a4200f298554e6a27eea1;p=thirdparty%2Fhostap.git nl80211: Fix sending proper VLAN ID attr value when using VLAN offload 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 --- diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index ea16d8daf..d70b56ba8 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -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);