From nobody Wed May 08 13:07:43 2024 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 4VZFmv68J8z5J5sk; Wed, 08 May 2024 13:07:43 +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 4VZFmv5f5Rz4RLp; Wed, 8 May 2024 13:07:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715173663; 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=Xk25vM6gLKYqClpwtHUsXhnK9q6YqR5vs5gYSdGCtqg=; b=eeWkR+3Cdox9BmAPPR84HQejy8p8/C45Z4qwfxIcr52B8BleneXuGxl04IeSdcQyOrk2Yb Faca/KzJp6JpHChcNiw40EXkUIDtTQmyqoIBqyZqZbERxAl7ua0cCW9LIt010XEgitAXV2 rQMRSoVkkTjWzNmMi16Bx5ilbBnjoRhngaEC5eAm4CrWV1K31HLORioNKXTnVnPeYsPgzB ghluviPT329aQJFckeIRo4pogR5iBo2JnsjOvZ+jS/Til8kQV5HXg7bx0OslHNVgY9kiPV Rg+C5zBcoo/GSCq4StxY4NCd9/uQtq81GjGO0bYh4yAnEB4dNjP0dg8Nu+xVvw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715173663; a=rsa-sha256; cv=none; b=lYBTXdh0muLtQkf/QvnzssbmTArnkXXWe3176JFng21LCfMMV0Af96o6WUW02kCqf1rQd7 UsB3E3jNR/WsCo1/wUTxA704czVNLXYIhCJpJBsJ2HhbdaHdluWTK5EggR1dAXY67se2mG zCar2ZeVhaVtuSGZDrmVIL35K4YEEYovSAkGqG7ntHjti0ZHnNx8Kr5NCHe8gCOQWkyEJX bTI2fVAtf/H7YbFYLA5abHnu7x3AMC3lBSAtDpOEYaMztHcPNng2lpIPTVffVsSXP7jYr/ 5KDbh/ozSTtnTWHhuXbZstCXp6wcNoZzMzbiwBJxQFH0OU3HiouJZsRkgQsKNA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715173663; 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=Xk25vM6gLKYqClpwtHUsXhnK9q6YqR5vs5gYSdGCtqg=; b=ftujQhsuDC3mLKK/Ukq8pRza429TBeYa53kRBZ8VdOtEWjJ5l8gyk6546pzr7dYyk9xFrV XHB1FYlwaq3aWeDzeGeRu3eRmsoLG/HQE/ILaH3jmcGXzSbVRxFHj9+GLlbnYj9IV8ihAF AxWkoAH4jZ8Z/7XdIzAEOaxJsBZmAB66/lqZAFtLhaZUm8nYLjdiv2obWL3g8ZwcCIY1Ut dffJI/L3cyrBOX8MetqGRUBk/i+B+U+w5maoDDBa/K50RFj9y/TW/4vm/AqC+QKpALzvJS 1CT2uI7wxT5c7e5X91CN9UGl4IBDxNDk4g8u92KLy+JLVF4KX89DwHOckB7YCg== 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 4VZFmv5C8KzQMn; Wed, 8 May 2024 13:07:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 448D7hCY080245; Wed, 8 May 2024 13:07:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 448D7hO2080242; Wed, 8 May 2024 13:07:43 GMT (envelope-from git) Date: Wed, 8 May 2024 13:07:43 GMT Message-Id: <202405081307.448D7hO2080242@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 3f6515c20f38 - stable/14 - bpf: Make BPF interop consistent with if_loop 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: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 3f6515c20f381d6e136c8c322eadc69fd0e6c4aa Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3f6515c20f381d6e136c8c322eadc69fd0e6c4aa commit 3f6515c20f381d6e136c8c322eadc69fd0e6c4aa Author: Seth Hoffert AuthorDate: 2023-10-22 14:12:45 +0000 Commit: Mark Johnston CommitDate: 2024-05-08 13:06:15 +0000 bpf: Make BPF interop consistent with if_loop The pseudo_AF_HDRCMPLT check is already being done in if_loop and just needed to be ported over to if_ic, if_wg, if_disc, if_gif, if_gre, if_me, if_tuntap and ng_iface. This is needed in order to allow these interfaces to work properly with e.g., tcpreplay. PR: 256587 Reviewed by: markj MFC after: 2 weeks Pull Request: https://github.com/freebsd/freebsd-src/pull/876 (cherry picked from commit 2cb0fce24d64039090dc9243cdf0715ee80c91b1) --- sys/dev/iicbus/if_ic.c | 4 ++-- sys/dev/wg/if_wg.c | 3 ++- sys/net/if_disc.c | 2 +- sys/net/if_gif.c | 3 ++- sys/net/if_gre.c | 3 ++- sys/net/if_me.c | 3 ++- sys/net/if_tuntap.c | 2 +- sys/netgraph/ng_iface.c | 2 +- 8 files changed, 13 insertions(+), 9 deletions(-) diff --git a/sys/dev/iicbus/if_ic.c b/sys/dev/iicbus/if_ic.c index 4ca8f3960298..52ab5afb9c4e 100644 --- a/sys/dev/iicbus/if_ic.c +++ b/sys/dev/iicbus/if_ic.c @@ -363,8 +363,8 @@ icoutput(if_t ifp, struct mbuf *m, const struct sockaddr *dst, u_char *cp; u_int32_t hdr; - /* BPF writes need to be handled specially. */ - if (dst->sa_family == AF_UNSPEC) + /* BPF writes need to be handled specially. */ + if (dst->sa_family == AF_UNSPEC || dst->sa_family == pseudo_AF_HDRCMPLT) bcopy(dst->sa_data, &hdr, sizeof(hdr)); else hdr = RO_GET_FAMILY(ro, dst); diff --git a/sys/dev/wg/if_wg.c b/sys/dev/wg/if_wg.c index 2c867956912a..30429c3725cd 100644 --- a/sys/dev/wg/if_wg.c +++ b/sys/dev/wg/if_wg.c @@ -2194,7 +2194,8 @@ wg_output(if_t ifp, struct mbuf *m, const struct sockaddr *dst, struct route *ro int ret; struct mbuf *defragged; - if (dst->sa_family == AF_UNSPEC) + /* BPF writes need to be handled specially. */ + if (dst->sa_family == AF_UNSPEC || dst->sa_family == pseudo_AF_HDRCMPLT) memcpy(&af, dst->sa_data, sizeof(af)); else af = dst->sa_family; diff --git a/sys/net/if_disc.c b/sys/net/if_disc.c index 02f3bbbfdaf1..193bb31d138f 100644 --- a/sys/net/if_disc.c +++ b/sys/net/if_disc.c @@ -182,7 +182,7 @@ discoutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, M_ASSERTPKTHDR(m); /* BPF writes need to be handled specially. */ - if (dst->sa_family == AF_UNSPEC) + if (dst->sa_family == AF_UNSPEC || dst->sa_family == pseudo_AF_HDRCMPLT) bcopy(dst->sa_data, &af, sizeof(af)); else af = RO_GET_FAMILY(ro, dst); diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c index e5065889d732..ef64c15074ed 100644 --- a/sys/net/if_gif.c +++ b/sys/net/if_gif.c @@ -408,7 +408,8 @@ gif_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, KASSERT(ifp->if_bridge == NULL, ("%s: unexpectedly called with bridge attached", __func__)); - if (dst->sa_family == AF_UNSPEC) + /* BPF writes need to be handled specially. */ + if (dst->sa_family == AF_UNSPEC || dst->sa_family == pseudo_AF_HDRCMPLT) memcpy(&af, dst->sa_data, sizeof(af)); else af = RO_GET_FAMILY(ro, dst); diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c index 55163416f807..ca9c4835daf6 100644 --- a/sys/net/if_gre.c +++ b/sys/net/if_gre.c @@ -609,7 +609,8 @@ gre_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, { uint32_t af; - if (dst->sa_family == AF_UNSPEC) + /* BPF writes need to be handled specially. */ + if (dst->sa_family == AF_UNSPEC || dst->sa_family == pseudo_AF_HDRCMPLT) bcopy(dst->sa_data, &af, sizeof(af)); else af = RO_GET_FAMILY(ro, dst); diff --git a/sys/net/if_me.c b/sys/net/if_me.c index e9bcd345b5c5..80c2816b808a 100644 --- a/sys/net/if_me.c +++ b/sys/net/if_me.c @@ -539,7 +539,8 @@ me_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, { uint32_t af; - if (dst->sa_family == AF_UNSPEC) + /* BPF writes need to be handled specially. */ + if (dst->sa_family == AF_UNSPEC || dst->sa_family == pseudo_AF_HDRCMPLT) bcopy(dst->sa_data, &af, sizeof(af)); else af = RO_GET_FAMILY(ro, dst); diff --git a/sys/net/if_tuntap.c b/sys/net/if_tuntap.c index 4cb219dc92b6..5d37879e87b9 100644 --- a/sys/net/if_tuntap.c +++ b/sys/net/if_tuntap.c @@ -1442,7 +1442,7 @@ tunoutput(struct ifnet *ifp, struct mbuf *m0, const struct sockaddr *dst, } /* BPF writes need to be handled specially. */ - if (dst->sa_family == AF_UNSPEC) + if (dst->sa_family == AF_UNSPEC || dst->sa_family == pseudo_AF_HDRCMPLT) bcopy(dst->sa_data, &af, sizeof(af)); else af = RO_GET_FAMILY(ro, dst); diff --git a/sys/netgraph/ng_iface.c b/sys/netgraph/ng_iface.c index 8ae4707b7abd..e9f97ff0fdec 100644 --- a/sys/netgraph/ng_iface.c +++ b/sys/netgraph/ng_iface.c @@ -367,7 +367,7 @@ ng_iface_output(struct ifnet *ifp, struct mbuf *m, } /* BPF writes need to be handled specially. */ - if (dst->sa_family == AF_UNSPEC) + if (dst->sa_family == AF_UNSPEC || dst->sa_family == pseudo_AF_HDRCMPLT) bcopy(dst->sa_data, &af, sizeof(af)); else af = RO_GET_FAMILY(ro, dst);