interface association and vlans
Frank Loeffler
frank.loeffler at uni-jena.de
Wed Jul 22 07:56:14 PDT 2026
Hi,
I am currently looking into which interfaces stations are marked as
being associated with when they get moved into a vlan. My main
motivation is to find out which ap-interface a station associated with
and which linux-interface is finally is using, ideally using netlink
nl80211 and not directly by querying hostapd.
As far as I understand, querying which interface a station associated
with and which interface a station will use (send packets through to the
kernel) is pretty much the same thing without vlans. However, things get
a little more complicated with vlans.
nl80211.h (see, e. g.,
https://github.com/torvalds/linux/blob/master/include/uapi/linux/nl80211.h)
has to say the following about this:
> Stations are added per interface, but a special case exists with VLAN
> interfaces. When a station is bound to an AP interface, it may be
> moved into a VLAN identified by a VLAN interface index
> (%NL80211_ATTR_STA_VLAN). The station is still assumed to belong to
> the AP interface it was added to.
However, when I query that (atm via, e. g., `iw dev phy0-ap1 station
dump`), I do not get stations - but I do when I instead of `phy-ap1` use
the name of the vlan-interface. This is on openwrt 25.12.5 with hostapd
2025.08.26~ca266cc2-r2.
To me, this suggests that hostapd (only) adds stations to the vlan
interface, but not the interface they originally associated with. At the
same time, hostapd seems to remember that association internally: `ubus
call hostapd.phy1-ap0 get_clients` does return the stations in question,
despite this not being the vlan interface, but the one used for
wifi-association (the one that actually has an ssid).
This also seems to be supported by the hostapd source:
`ap_sta_bind_vlan_helper()` calls `i802_set_sta_vlan()` which in turn
calls `nl80211_bss_msg(bss, 0, NL80211_CMD_SET_STATION)` where bss is
the vlan interface, not the original interface.
Here my two questions:
1. Is my text above somewhat correct or did I make a mistake somewhere?
2. Shouldn't hostapd (also) mark stations as associated with the
original interface? The documentation from the linux kernel suggests to
me that it should/must - while the question of association with the vlan
interface is left open (optional?). I read this:
> The station is still assumed to belong to the AP interface it was added to.
as:
"The station has to belong to the AP interface. Nothing is said about
also belonging to another interface (the vlan interface) at the same
time, so it is optional."
thanks
Frank
More information about the Hostap
mailing list