wlantest: Process VLAN tagged Data frames

This allows Data frames to be fully processed for the case where VLAN
tags are used on the wireless link.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2019-09-20 23:54:05 +03:00 committed by Jouni Malinen
parent 83b83b461d
commit 722c7d1958
2 changed files with 30 additions and 0 deletions

View file

@ -344,6 +344,9 @@ static inline void WPA_PUT_LE64(u8 *a, u64 val)
#ifndef ETH_P_OUI #ifndef ETH_P_OUI
#define ETH_P_OUI 0x88B7 #define ETH_P_OUI 0x88B7
#endif /* ETH_P_OUI */ #endif /* ETH_P_OUI */
#ifndef ETH_P_8021Q
#define ETH_P_8021Q 0x8100
#endif /* ETH_P_8021Q */
#ifdef __GNUC__ #ifdef __GNUC__

View file

@ -52,6 +52,29 @@ static const char * data_stype(u16 stype)
} }
static void rx_data_eth(struct wlantest *wt, const u8 *bssid,
const u8 *sta_addr, const u8 *dst, const u8 *src,
u16 ethertype, const u8 *data, size_t len, int prot,
const u8 *peer_addr);
static void rx_data_vlan(struct wlantest *wt, const u8 *bssid,
const u8 *sta_addr, const u8 *dst, const u8 *src,
const u8 *data, size_t len, int prot,
const u8 *peer_addr)
{
u16 tag;
if (len < 4)
return;
tag = WPA_GET_BE16(data);
wpa_printf(MSG_MSGDUMP, "VLAN tag: Priority=%u ID=%u",
tag >> 12, tag & 0x0ffff);
/* ignore VLAN information and process the original frame */
rx_data_eth(wt, bssid, sta_addr, dst, src, WPA_GET_BE16(data + 2),
data + 4, len - 4, prot, peer_addr);
}
static void rx_data_eth(struct wlantest *wt, const u8 *bssid, static void rx_data_eth(struct wlantest *wt, const u8 *bssid,
const u8 *sta_addr, const u8 *dst, const u8 *src, const u8 *sta_addr, const u8 *dst, const u8 *src,
u16 ethertype, const u8 *data, size_t len, int prot, u16 ethertype, const u8 *data, size_t len, int prot,
@ -68,6 +91,10 @@ static void rx_data_eth(struct wlantest *wt, const u8 *bssid,
case 0x890d: case 0x890d:
rx_data_80211_encap(wt, bssid, sta_addr, dst, src, data, len); rx_data_80211_encap(wt, bssid, sta_addr, dst, src, data, len);
break; break;
case ETH_P_8021Q:
rx_data_vlan(wt, bssid, sta_addr, dst, src, data, len, prot,
peer_addr);
break;
} }
} }