diff options
author | R. Christian McDonald <rcm@rcm.sh> | 2023-09-11 22:26:08 -0700 |
---|---|---|
committer | Cy Schubert <cy@FreeBSD.org> | 2023-09-15 07:07:45 -0700 |
commit | a313183071ac551368e87214ebf5ef6e5fa589d0 (patch) | |
tree | 7a31aefcb09d61b4e6f1047f4f5342cb2849448d | |
parent | security/wpa_supplicant-devel: wpa: Enable receiving priority tagged (VID 0) ... (diff) |
net/hostapd: wpa: Enable receiving priority tagged (VID 0) frames
Certain internet service providers transmit vlan 0 priority tagged
EAPOL frames from the ONT towards the residential gateway. VID 0
should be ignored, and the frame processed according to the priority
set in the 802.1P bits and the encapsulated EtherType (i.e. EAPOL).
The pcap filter utilized by l2_packet is inadquate for this use case.
Here we modify the pcap filter to accept both unencapsulated and
encapsulated (with VLAN 0) EAPOL EtherTypes. This preserves the
original filter behavior while also matching on encapsulated EAPOL.
Sponsored by: Rubicon Communications, LLC ("Netgate")
Reviewed by: cy
Obtained from: src bb5d6d14d81b
PR: 273696
(cherry picked from commit 33410dc2fce35423090de7566b10b2ce4ba5795c)
-rw-r--r-- | net/hostapd/Makefile | 2 | ||||
-rw-r--r-- | net/hostapd/files/patch-src_l2__packet_l2__packet__freebsd.c | 30 |
2 files changed, 29 insertions, 3 deletions
diff --git a/net/hostapd/Makefile b/net/hostapd/Makefile index 1e6d5841681a..e4951adea292 100644 --- a/net/hostapd/Makefile +++ b/net/hostapd/Makefile @@ -1,6 +1,6 @@ PORTNAME= hostapd PORTVERSION= 2.10 -PORTREVISION= 7 +PORTREVISION= 8 CATEGORIES= net MASTER_SITES= https://w1.fi/releases/ diff --git a/net/hostapd/files/patch-src_l2__packet_l2__packet__freebsd.c b/net/hostapd/files/patch-src_l2__packet_l2__packet__freebsd.c index 9d290e5dff5c..e0aa170fa91f 100644 --- a/net/hostapd/files/patch-src_l2__packet_l2__packet__freebsd.c +++ b/net/hostapd/files/patch-src_l2__packet_l2__packet__freebsd.c @@ -1,5 +1,5 @@ --- src/l2_packet/l2_packet_freebsd.c.orig 2022-01-16 12:51:29.000000000 -0800 -+++ src/l2_packet/l2_packet_freebsd.c 2023-09-11 22:00:09.826831000 -0700 ++++ src/l2_packet/l2_packet_freebsd.c 2023-09-11 22:21:12.054042000 -0700 @@ -8,7 +8,10 @@ */ @@ -12,7 +12,15 @@ #include <net/bpf.h> #endif /* __APPLE__ */ #include <pcap.h> -@@ -76,24 +79,28 @@ +@@ -20,6 +23,7 @@ + #include <sys/sysctl.h> + #endif /* __sun__ */ + ++#include <net/ethernet.h> + #include <net/if.h> + #include <net/if_dl.h> + #include <net/route.h> +@@ -76,24 +80,33 @@ { struct l2_packet_data *l2 = eloop_ctx; pcap_t *pcap = sock_ctx; @@ -43,6 +51,24 @@ buf = (unsigned char *) (ethhdr + 1); - len = hdr.caplen - sizeof(*ethhdr); + len = hdr->caplen - sizeof(*ethhdr); ++ /* handle 8021Q encapsulated frames */ ++ if (ethhdr->h_proto == htons(ETH_P_8021Q)) { ++ buf += ETHER_VLAN_ENCAP_LEN; ++ len -= ETHER_VLAN_ENCAP_LEN; ++ } } l2->rx_callback(l2->rx_callback_ctx, ethhdr->h_source, buf, len); } +@@ -122,10 +135,10 @@ + os_snprintf(pcap_filter, sizeof(pcap_filter), + "not ether src " MACSTR " and " + "( ether dst " MACSTR " or ether dst " MACSTR " ) and " +- "ether proto 0x%x", ++ "( ether proto 0x%x or ( vlan 0 and ether proto 0x%x ) )", + MAC2STR(l2->own_addr), /* do not receive own packets */ + MAC2STR(l2->own_addr), MAC2STR(pae_group_addr), +- protocol); ++ protocol, protocol); + if (pcap_compile(l2->pcap, &pcap_fp, pcap_filter, 1, pcap_netp) < 0) { + fprintf(stderr, "pcap_compile: %s\n", pcap_geterr(l2->pcap)); + return -1; |