Re: [PATCH] l2_packet_freebsd: Enable receiving priority tagged (VID=0) frames

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 09, 2023 at 04:27:12PM +0000, R. Christian McDonald wrote:
> 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 on FreeBSD to accept both unencapsulated
> and encapsulated (with VLAN 0) EAPOL EtherTypes. This preserves the
> original filter behavior while also matching on encapsulated EAPOL.
> 
> Additional work is required to support this handling on other platforms.
> 
> We also modify the rx_receive handler to offset the packet buffer
> and length when handling dot1q encapsualted frames so the existing
> packet parsing code works as-is.

I applied this part.

> Finally, we bring along another patch from FreeBSD that handles the
> case where the interface can disappear either by `ifconfig destroy`
> or if a USB NIC is forcibly removed or experiences USB faults. This
> patch uses `pcap_next_ex`, setting the packet pointer to NULL, and
> terminating the event loop.

But this is not really expected wpa_supplicant/hostapd behavior, so I
dropped this:

> diff --git a/src/l2_packet/l2_packet_freebsd.c b/src/l2_packet/l2_packet_freebsd.c
> @@ -82,7 +83,11 @@ static void l2_packet_receive(int sock, void *eloop_ctx, void *sock_ctx)
>  	unsigned char *buf;
>  	size_t len;
>  
> -	packet = pcap_next(pcap, &hdr);
> +	if (pcap_next_ex(pcap, &hdr, &packet) == -1) {
> +		wpa_printf(MSG_ERROR, "Error reading packet, has device disappeared?");
> +		packet = NULL;
> +		eloop_terminate();
> +	}

This seems to be a completely independent change and as such, should be
in its own patch, but calling eloop_terminate() does not feel correct
for this type of a case. A better approach would be to detect interface
removal in src/drivers/driver_*.c and report it to upper layers (as is
already done for nl80211).

-- 
Jouni Malinen                                            PGP id EFC895FA

_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux