[PATCH] FT: Use the VLAN ID of the PSK with ft_psk_generate_local=1
Oldřich Jedlička
oldium.pro at gmail.com
Fri Nov 20 11:35:22 PST 2026
A PSK in wpa_psk_file can have a VLAN ID (vlanid=<VLAN ID>). After the
4-way handshake, wpa_auth_update_vlan() assigns the STA to the VLAN of
the PSK that matched. With ft_psk_generate_local=1, FT-PSK finds the
PSK in wpa_ft_psk_pmk_r1() without fetching its VLAN ID, and
wpa_ft_set_vlan() then sets the VLAN that the STA entry on the target
AP has, which is normally none. The STA thus leaves the VLAN of its PSK
when it roams with FT.
Fetch the VLAN ID together with the PSK. If the matching PSK has a VLAN
ID, use it as the VLAN of the STA in place of the VLAN of the STA
entry, which wpa_auth_update_vlan() replaces in the same way. Leave the
VLAN as it is with CONFIG_NO_VLAN, where wpa_auth_update_vlan() does
not change it either.
This is based on a fix by regae in an OpenWrt fork:
https://github.com/regae/openwrt/commit/f5c03f58cf7ee11d5eee3805d78d83786c21adaa
Signed-off-by: Oldřich Jedlička <oldium.pro at gmail.com>
Co-Authored-By: Claude Fable 5.2 <noreply at anthropic.com>
---
src/ap/wpa_auth_ft.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/src/ap/wpa_auth_ft.c b/src/ap/wpa_auth_ft.c
index e12f2ad8e..77619332e 100644
--- a/src/ap/wpa_auth_ft.c
+++ b/src/ap/wpa_auth_ft.c
@@ -664,12 +664,12 @@ static int wpa_ft_action_send(struct wpa_authenticator *wpa_auth,
static const u8 * wpa_ft_get_psk(struct wpa_authenticator *wpa_auth,
const u8 *addr, const u8 *p2p_dev_addr,
- const u8 *prev_psk)
+ const u8 *prev_psk, int *vlan_id)
{
if (wpa_auth->cb->get_psk == NULL)
return NULL;
return wpa_auth->cb->get_psk(wpa_auth->cb_ctx, addr, p2p_dev_addr,
- prev_psk, NULL, NULL);
+ prev_psk, NULL, vlan_id);
}
@@ -2953,12 +2953,13 @@ static int wpa_ft_psk_pmk_r1(struct wpa_state_machine *sm,
const u8 *ssid = wpa_auth->conf.ssid;
size_t ssid_len = wpa_auth->conf.ssid_len;
int pairwise;
+ int vlan_id = 0;
pairwise = sm->pairwise;
for (;;) {
pmk = wpa_ft_get_psk(wpa_auth, sm->addr, sm->p2p_dev_addr,
- pmk);
+ pmk, &vlan_id);
if (pmk == NULL)
break;
@@ -2980,6 +2981,16 @@ static int wpa_ft_psk_pmk_r1(struct wpa_state_machine *sm,
*out_pairwise = pairwise;
os_memcpy(sm->PMK, pmk, PMK_LEN);
sm->pmk_len = PMK_LEN;
+#ifndef CONFIG_NO_VLAN
+ if (out_vlan && vlan_id) {
+ /* The VLAN ID of the PSK replaces the VLAN of the STA
+ * as in wpa_auth_update_vlan() after the 4-way
+ * handshake. */
+ os_memset(out_vlan, 0, sizeof(*out_vlan));
+ out_vlan->notempty = 1;
+ out_vlan->untagged = vlan_id;
+ } else
+#endif /* CONFIG_NO_VLAN */
if (out_vlan &&
wpa_ft_get_vlan(sm->wpa_auth, sm->addr, out_vlan) < 0) {
wpa_printf(MSG_DEBUG, "FT: vlan not available for STA "
--
2.25.1
More information about the Hostap
mailing list