From nobody Sun Jun 25 04:07:54 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Qpcrp6ztMz4gLlL; Sun, 25 Jun 2023 04:07:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Qpcrp6Bt7z3qHl; Sun, 25 Jun 2023 04:07:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687666074; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CPHAOYYsjx00R8v1FM+Xwq1z5ioToP12DeiZj8ryh/w=; b=lN56GLoY8Xo5VD626BXrYm6KgPbzoALKqFenk05iw7ayldL9DWTdSRSIgYK3Uvs+EKYplB Oip4p72btGkmYvSfazuYH/w7CkmtAfBp/sHlmQoGSAC5Kzc2scYUBjetjrLsfvLmQ/1voU yD0LbDUXVhQ5CWaLluHabycqya2alJdI4XQtLlBwZgtVZe4ZR8LGj68dWLpVHvyWd1RzHt vsTmxPNr34oERoQ5QSgpj9iMx/z9dwIptiaPar1+u1fRMcdxETfx9qK44UBSevjarlUKVP UdubjKKvLppaEwBQyO46cab7r6xWdqjnuH9ThmEn8l8UVFkSCNwxC/wzhQiaUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687666074; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CPHAOYYsjx00R8v1FM+Xwq1z5ioToP12DeiZj8ryh/w=; b=Bcv9apGX0I57zu0npfVX9mFcSYIEcxy5eEy3JBbIWg4jgrgM9g2zq5sGjhY/vLIVpUkTpM HLdgo5pD9ryg1TSKZMj9CXkgVOzpP9n4kYkdu27OPu5erSp/tgxmwBGIVPCS2bccy1pNQ0 YBuuBsqh83ca02yBuHJqchOnEECwPckFi/KssV+ym37VK46boORI/2O5LTmswsuf4/ld8N g9UaAnvX2bcFTewUlarMGffbKmvdGfhmQsNuhR1k+y5KgPDyXev1giPQGBXV/tnlTlUQgR yWR1k8vXNkQRraUTBRZOvyZ2k2v7KIkNFu9U1yqXz2XansvJ+nM4rD9tBubb4g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1687666074; a=rsa-sha256; cv=none; b=Nd9Jcuy/61QQzNQ8raINJLPuJIPF7Oddq3xVMUzNCm3lriywxDx6taYSYIPe9HYrvEM7Ue uH5i9pIgj7pk3wWD1rOckJxcRk9Ch6mUHwOoo6pZs69fO/jyCDhITmiTMzgaygQSIPYko4 g0gKSFIrQOZoYDB3Am+sRxlYif0oLpEYJtRPYrpaNipghfOnYMbgIpEKwFdKnOK9i/RcBk cMH6zNadGEHJA0BASHBHCI516Pm3WH75EwdVdTPp6zRh1h6/hoGRy8AQKe68P7EMI3xpnE ubW41wteGcDGrVGiJrHb29v6cGxThwy9rwk9+Qt89JIXrE/hZZ+CbiXc+TjWjQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Qpcrp51Jwz1CGX; Sun, 25 Jun 2023 04:07:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 35P47s7I001337; Sun, 25 Jun 2023 04:07:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35P47skF001336; Sun, 25 Jun 2023 04:07:54 GMT (envelope-from git) Date: Sun, 25 Jun 2023 04:07:54 GMT Message-Id: <202306250407.35P47skF001336@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Cy Schubert Subject: git: 1b33afb7e88b - stable/13 - wpa: Enable receiving priority tagged (VID 0) frames List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1b33afb7e88b2e36db2083c488de41dbe097ef49 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=1b33afb7e88b2e36db2083c488de41dbe097ef49 commit 1b33afb7e88b2e36db2083c488de41dbe097ef49 Author: R. Christian McDonald AuthorDate: 2023-06-11 23:22:53 +0000 Commit: Cy Schubert CommitDate: 2023-06-25 04:07:33 +0000 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 Differential Revision: https://reviews.freebsd.org/D40442 (cherry picked from commit bb5d6d14d81b0789d2e73da03571603426afef56) --- contrib/wpa/src/l2_packet/l2_packet_freebsd.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/contrib/wpa/src/l2_packet/l2_packet_freebsd.c b/contrib/wpa/src/l2_packet/l2_packet_freebsd.c index 7b96bd033c87..156a09a32a84 100644 --- a/contrib/wpa/src/l2_packet/l2_packet_freebsd.c +++ b/contrib/wpa/src/l2_packet/l2_packet_freebsd.c @@ -21,6 +21,7 @@ #include #endif /* __sun__ */ +#include #include #include #include @@ -99,6 +100,11 @@ static void l2_packet_receive(int sock, void *eloop_ctx, void *sock_ctx) } else { buf = (unsigned char *) (ethhdr + 1); 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); } @@ -127,10 +133,10 @@ static int l2_packet_init_libpcap(struct l2_packet_data *l2, 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;