]> git.ipfire.org Git - thirdparty/hostap.git/commit
Remove VLAN interface on STA free
authorMichael Braun <michael-dev@fami-braun.de>
Fri, 10 Apr 2015 12:49:50 +0000 (14:49 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 13 Apr 2015 14:08:10 +0000 (17:08 +0300)
commitc8e6beabb6f9c3f6a9904b78f7a6bec55117eda2
treefefe23ee673db626891f1074eda03591f33f12c5
parentde31fb052c896d016e00b7bb36fa6dc7bac52f56
Remove VLAN interface on STA free

Currently, vlan_remove_dynamic() is only called when the station VLAN ID
is changed (ap_sta_bind_vlan), but not when the station is freed. So
dynamic VLAN interfaces are not removed actually except within 1x
reauthentification VLAN ID change, although most of the code is already
there.

This patch fixes this by calling vlan_remove_dynamic() in ap_free_sta().

It cannot just use sta->vlan_id for this, as this might have been
changed without calling ap_sta_bind_vlan() (ap/ieee802_11.c:handle_auth
fetches from RADIUS cache for WPA-PSK), thus reference counting might
not have been updated. Additionally, reference counting might get wrong
due to old_vlanid = 0 being passed unconditionally, thus increasing the
reference counter multiple times.

So tracking the currently assigned (i.e., dynamic_vlan counter
increased) VLAN is done in a new variable sta->vlan_id_bound. Therefore,
the old_vlan_id argument of ap_sta_bind_vlan() is no longer needed and
setting the VLAN for the sta in driver happens unconditionally.

Additionally, vlan->dynamic_vlan is only incremented when it actually
is a dynamic VLAN.

Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
src/ap/ieee802_11.c
src/ap/ieee802_1x.c
src/ap/sta_info.c
src/ap/sta_info.h