FT: Add set_vlan()/get_vlan() callback functions
These are needed to allow wpa_auth_ft.c to control VLAN assignment for STAs. Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
This commit is contained in:
parent
3a3e28320b
commit
47a039b01b
2 changed files with 60 additions and 0 deletions
|
@ -14,6 +14,8 @@
|
||||||
#include "common/wpa_common.h"
|
#include "common/wpa_common.h"
|
||||||
#include "common/ieee802_11_defs.h"
|
#include "common/ieee802_11_defs.h"
|
||||||
|
|
||||||
|
struct vlan_description;
|
||||||
|
|
||||||
#define MAX_OWN_IE_OVERRIDE 256
|
#define MAX_OWN_IE_OVERRIDE 256
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
@ -257,6 +259,10 @@ struct wpa_auth_callbacks {
|
||||||
size_t data_len);
|
size_t data_len);
|
||||||
#ifdef CONFIG_IEEE80211R_AP
|
#ifdef CONFIG_IEEE80211R_AP
|
||||||
struct wpa_state_machine * (*add_sta)(void *ctx, const u8 *sta_addr);
|
struct wpa_state_machine * (*add_sta)(void *ctx, const u8 *sta_addr);
|
||||||
|
int (*set_vlan)(void *ctx, const u8 *sta_addr,
|
||||||
|
struct vlan_description *vlan);
|
||||||
|
int (*get_vlan)(void *ctx, const u8 *sta_addr,
|
||||||
|
struct vlan_description *vlan);
|
||||||
int (*send_ft_action)(void *ctx, const u8 *dst,
|
int (*send_ft_action)(void *ctx, const u8 *dst,
|
||||||
const u8 *data, size_t data_len);
|
const u8 *data, size_t data_len);
|
||||||
int (*add_tspec)(void *ctx, const u8 *sta_addr, u8 *tspec_ie,
|
int (*add_tspec)(void *ctx, const u8 *sta_addr, u8 *tspec_ie,
|
||||||
|
|
|
@ -836,6 +836,58 @@ hostapd_wpa_auth_add_sta(void *ctx, const u8 *sta_addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int hostapd_wpa_auth_set_vlan(void *ctx, const u8 *sta_addr,
|
||||||
|
struct vlan_description *vlan)
|
||||||
|
{
|
||||||
|
struct hostapd_data *hapd = ctx;
|
||||||
|
struct sta_info *sta;
|
||||||
|
|
||||||
|
sta = ap_get_sta(hapd, sta_addr);
|
||||||
|
if (!sta || !sta->wpa_sm)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (vlan->notempty &&
|
||||||
|
!hostapd_vlan_valid(hapd->conf->vlan, vlan)) {
|
||||||
|
hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
|
||||||
|
HOSTAPD_LEVEL_INFO,
|
||||||
|
"Invalid VLAN %d%s received from FT",
|
||||||
|
vlan->untagged, vlan->tagged[0] ? "+" : "");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ap_sta_set_vlan(hapd, sta, vlan) < 0)
|
||||||
|
return -1;
|
||||||
|
/* Configure wpa_group for GTK but ignore error due to driver not
|
||||||
|
* knowing this STA. */
|
||||||
|
ap_sta_bind_vlan(hapd, sta);
|
||||||
|
|
||||||
|
if (sta->vlan_id)
|
||||||
|
hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
|
||||||
|
HOSTAPD_LEVEL_INFO, "VLAN ID %d", sta->vlan_id);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int hostapd_wpa_auth_get_vlan(void *ctx, const u8 *sta_addr,
|
||||||
|
struct vlan_description *vlan)
|
||||||
|
{
|
||||||
|
struct hostapd_data *hapd = ctx;
|
||||||
|
struct sta_info *sta;
|
||||||
|
|
||||||
|
sta = ap_get_sta(hapd, sta_addr);
|
||||||
|
if (!sta)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (sta->vlan_desc)
|
||||||
|
*vlan = *sta->vlan_desc;
|
||||||
|
else
|
||||||
|
os_memset(vlan, 0, sizeof(*vlan));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void hostapd_rrb_receive(void *ctx, const u8 *src_addr, const u8 *buf,
|
static void hostapd_rrb_receive(void *ctx, const u8 *src_addr, const u8 *buf,
|
||||||
size_t len)
|
size_t len)
|
||||||
{
|
{
|
||||||
|
@ -955,6 +1007,8 @@ int hostapd_setup_wpa(struct hostapd_data *hapd)
|
||||||
.send_ft_action = hostapd_wpa_auth_send_ft_action,
|
.send_ft_action = hostapd_wpa_auth_send_ft_action,
|
||||||
.add_sta = hostapd_wpa_auth_add_sta,
|
.add_sta = hostapd_wpa_auth_add_sta,
|
||||||
.add_tspec = hostapd_wpa_auth_add_tspec,
|
.add_tspec = hostapd_wpa_auth_add_tspec,
|
||||||
|
.set_vlan = hostapd_wpa_auth_set_vlan,
|
||||||
|
.get_vlan = hostapd_wpa_auth_get_vlan,
|
||||||
#endif /* CONFIG_IEEE80211R_AP */
|
#endif /* CONFIG_IEEE80211R_AP */
|
||||||
};
|
};
|
||||||
const u8 *wpa_ie;
|
const u8 *wpa_ie;
|
||||||
|
|
Loading…
Reference in a new issue