From nobody Sun Jun 25 04:08:20 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 4QpcsK1CtDz4gMDC; Sun, 25 Jun 2023 04:08:21 +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 4QpcsJ68TYz3qT8; Sun, 25 Jun 2023 04:08:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687666100; 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=w1mX4P/vA5sx/PRimKzxzsYq7+wIaG5DOYOzyG41pdo=; b=Db+7xt+H8UeNQ9zCAROBUb1hET/P36W5qaXiP6iGANaTifuUIuaDUQITqc6bU6w+qkEhyy tZ8bdCSBNpQje1i8BnZRqTqbe3YyLA74/5fWBimzB1qn9Uzh36tmVjwf7JSrFxg6vwPIyY wbRLaRJVP/e3dj0Yatdt+4ZmLOxaiMnvIjupDhjbHLgbncGkojGpQf0i9X2gEkM2sMCvlD IxAyNqgC54bKiD1SKeZZv5hDR7YJoQKpPvqIR7oLQfxnR4Tw7f9ZoOMlr9cYBLzg6z8bWs XOusrXsTbORMQqVZ0cKQGsIKmrMQOa30AO2heFfFV0zISjIWKGx/2PKGpD52Iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687666100; 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=w1mX4P/vA5sx/PRimKzxzsYq7+wIaG5DOYOzyG41pdo=; b=VY+riWT4GNKL03mETeQ7VDdj/+Gz/8iw0AMxROxJvEEjygLN2nYkaDJxQJaHv199icxQLu u809l78EbTGfjmKXgt8K+QhnJa7X2vZAE+oEQM3+wGLOXQK2zEF79rMoqkIC+hrKVr7qHl zg4ZawtDj8m2tCwFnHNzwR79DC80Ouumxd0+rlVZgzXASCDXunoBYjEYmUjTckW0Bpbpu8 T9uj25JVCjcDsrxMgjKHBmuGOq7KgZo9xuI9E2LzhPxut73oosn62r9/+FOXTDkHdoHbrS hFsv5rf9zaPZWd9yDQ8W4v0vmrfxfOiAllDj6oGB5Zfwz47fSietmgGJRhznAA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1687666100; a=rsa-sha256; cv=none; b=UpJBL78+O0BfU4vwGMvGoFBTppVqmv78v+CWFO4I3emxjcqKdJNCyBK6eWqMNO+XDZ6l2E ENmC0uA0eF659lK0KTKok0gLC3ydph0rLhiDK+bR4ya2YTfZugP6LYwuf1JIIZX2ZDB7Cg ufrQNXmCNECD+W21BDsDoYuyTMzdP8k9xuynQb4W5Lok+cJNPDAL0pEqoku/0LHjZ9/7CW JZYFXzEVe5sMmN8VzQ49hF51VhbtPnRe9+fb306YcHG6sgjTpaokBWTVsyYvYFpitlCaYK tXgRxwXyDPFCOtlW4P233eWYv98t3e9b7PKJYyaXxhTeGKPfPRQ+Zkl/OTlaLA== 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 4QpcsJ4xtvz1CGY; Sun, 25 Jun 2023 04:08:20 +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 35P48KrD001521; Sun, 25 Jun 2023 04:08:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35P48KH4001520; Sun, 25 Jun 2023 04:08:20 GMT (envelope-from git) Date: Sun, 25 Jun 2023 04:08:20 GMT Message-Id: <202306250408.35P48KH4001520@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: cc6d0b4bd2c9 - stable/12 - 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/12 X-Git-Reftype: branch X-Git-Commit: cc6d0b4bd2c9e0dfa1e78fae9ae3497f1d7b7481 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=cc6d0b4bd2c9e0dfa1e78fae9ae3497f1d7b7481 commit cc6d0b4bd2c9e0dfa1e78fae9ae3497f1d7b7481 Author: R. Christian McDonald AuthorDate: 2023-06-11 23:22:53 +0000 Commit: Cy Schubert CommitDate: 2023-06-25 04:08:04 +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;