[PATCH v5 12/22] VLAN: Use new VLAN data type in src_drivers
Michael Braun
michael-dev
Tue Nov 19 11:47:40 PST 2013
Signed-hostap: Michael Braun <michael-dev at fami-braun.de>
---
src/drivers/driver.h | 3 ++-
src/drivers/driver_nl80211.c | 14 ++++++++------
src/drivers/driver_test.c | 5 +++--
3 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 2a80419..cb59b44 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -20,6 +20,7 @@
#define WPA_SUPPLICANT_DRIVER_VERSION 4
#include "common/defs.h"
+#include "common/vlan.h"
#include "utils/list.h"
#define HOSTAPD_CHAN_DISABLED 0x00000001
@@ -2056,7 +2057,7 @@ struct wpa_driver_ops {
* domains to be used with a single BSS.
*/
int (*set_sta_vlan)(void *priv, const u8 *addr, const char *ifname,
- int vlan_id);
+ struct vlan_description vlan_id);
/**
* commit - Optional commit changes handler (AP only)
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 9b2f81e..cbb0a51 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -8878,7 +8878,7 @@ static int i802_set_tx_queue_params(void *priv, int queue, int aifs,
static int i802_set_sta_vlan(struct i802_bss *bss, const u8 *addr,
- const char *ifname, int vlan_id)
+ const char *ifname, struct vlan_description vlan_id)
{
struct wpa_driver_nl80211_data *drv = bss->drv;
struct nl_msg *msg;
@@ -8891,7 +8891,8 @@ static int i802_set_sta_vlan(struct i802_bss *bss, const u8 *addr,
wpa_printf(MSG_DEBUG, "nl80211: %s[%d]: set_sta_vlan(" MACSTR
", ifname=%s[%d], vlan_id=%d)",
bss->ifname, if_nametoindex(bss->ifname),
- MAC2STR(addr), ifname, if_nametoindex(ifname), vlan_id);
+ MAC2STR(addr), ifname, if_nametoindex(ifname),
+ vlan_untagged(&vlan_id));
nl80211_cmd(drv, msg, 0, NL80211_CMD_SET_STATION);
NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX,
@@ -8905,7 +8906,7 @@ static int i802_set_sta_vlan(struct i802_bss *bss, const u8 *addr,
if (ret < 0) {
wpa_printf(MSG_ERROR, "nl80211: NL80211_ATTR_STA_VLAN (addr="
MACSTR " ifname=%s vlan_id=%d) failed: %d (%s)",
- MAC2STR(addr), ifname, vlan_id, ret,
+ MAC2STR(addr), ifname, vlan_untagged(&vlan_id), ret,
strerror(-ret));
}
nla_put_failure:
@@ -9076,13 +9077,13 @@ static int i802_set_wds_sta(void *priv, const u8 *addr, int aid, int val,
wpa_printf(MSG_ERROR, "nl80211: Failed to set WDS STA "
"interface %s up", name);
}
- return i802_set_sta_vlan(priv, addr, name, 0);
+ return i802_set_sta_vlan(priv, addr, name, VLAN_NULL);
} else {
if (bridge_ifname)
linux_br_del_if(drv->global->ioctl_sock, bridge_ifname,
name);
- i802_set_sta_vlan(priv, addr, bss->ifname, 0);
+ i802_set_sta_vlan(priv, addr, bss->ifname, VLAN_NULL);
return wpa_driver_nl80211_if_remove(priv, WPA_IF_AP_VLAN,
name);
}
@@ -10993,7 +10994,8 @@ static int driver_nl80211_sta_remove(void *priv, const u8 *addr)
static int driver_nl80211_set_sta_vlan(void *priv, const u8 *addr,
- const char *ifname, int vlan_id)
+ const char *ifname,
+ struct vlan_description vlan_id)
{
struct i802_bss *bss = priv;
return i802_set_sta_vlan(bss, addr, ifname, vlan_id);
diff --git a/src/drivers/driver_test.c b/src/drivers/driver_test.c
index 5742b98..fcf4e63 100644
--- a/src/drivers/driver_test.c
+++ b/src/drivers/driver_test.c
@@ -1127,10 +1127,11 @@ static int test_driver_set_privacy(void *priv, int enabled)
static int test_driver_set_sta_vlan(void *priv, const u8 *addr,
- const char *ifname, int vlan_id)
+ const char *ifname,
+ struct vlan_description vlan_id)
{
wpa_printf(MSG_DEBUG, "%s(addr=" MACSTR " ifname=%s vlan_id=%d)",
- __func__, MAC2STR(addr), ifname, vlan_id);
+ __func__, MAC2STR(addr), ifname, vlan_untagged(&vlan_id));
return 0;
}
More information about the Hostap
mailing list