From nobody Fri Apr 19 18:48:53 2024 X-Original-To: dev-commits-src-main@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 4VLkFL0hGBz5HY0B; Fri, 19 Apr 2024 18:48: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 4VLkFK6CDnz4nrK; Fri, 19 Apr 2024 18:48:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713552533; 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=ib8oPirvJAYCJYhmoNZ/MeiUuxVu68ltyPwYfmz88ao=; b=YNnPD8Ec0pVvhvpJWws0j0CpcOYG2dW1pZHixKG7mIA6LM0pQK/NpGUtveDauAE1GRffpN HJ3SJuOgU4EVF5Hgad1x3BUMwVkTmL/vAATC4v2iw9mt8bIePRF/NBONAi9ZZZH+awsBHM hlgWnW5PjEPno6MQ5TXSwJs4KhtENAeWQDgbUjlO1sWKtPbPf5WJ6mJhm284oweel+Hd/n 3Wj4KGdZ5Y7iV3kCovO9h7ME6CHxL0bprPwJPujpzzmBha47eTYbj7j87mFKTNJoQ3KPvM bW9KAARdwYGVwEDx6kIeIYkCiJnhQBCTFDS2vqnWexuqu2xsJ+ezI15d7eLxBQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713552533; a=rsa-sha256; cv=none; b=RKhUsWxWkK0EIoChE0RtwMu00GUhRTjTzLVDT7COTuF+Wn5S2H0tn7CA7CNo/clq5s88FR PWENC+ZzaH7kb32t2vWAyrw2SBIazVchRkHSI+NXLvcAuhS1XsyRZscKruh1a4gX1ESFAE CyEgUKOozkDLkhGgZXMqg2ckh2hcxCRp4Ab+pTZsZbue+CWy5jkHPMcM0ZT2kEAl3DgTJN lkrlI+jue6iyOfACpwOkhSCyPWY/cUH+UfUtoEKmFqNAfOk3BzPGo04RMg/7kCeVdYGB3m bwaxnV3lUziDAtI5Dr+11y+LBWKikWRCnfPPMCP03WDitE86LBzUJvGe+Vg8NQ== 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=1713552533; 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=ib8oPirvJAYCJYhmoNZ/MeiUuxVu68ltyPwYfmz88ao=; b=wFYuAQE7t52ZBBvcZcJbI/b9nK0/ZrObCiOPU5lJ584t4sc/gunevlKlJbUCc+f0PlX7qB Yhng5GLB00J6U24+0v7l4PkRisbpOPDjxedJWqqB73f5gjrbMr4SFEQk5TmomQXnqTML0I VWRMvvlc/UZt759HRR33NgaRxCX9uPNXtmejC/A2+qO/OZ3eE9Z0rcj4Hcc7isCG/hMaeT 0XDISTHkP4pnVCjLQj9PZdF6vYcrpUUhYJ7XHwxhMfCxIHjiw1jhdLATlO48t4mdpCgFAA Y5v6NAA8cz1Y2SuHsdnPukt6NSHivvk1aRjxoZlX78F0vnJmfAR3+tvNaoRrrw== 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 4VLkFK5pcsz14L1; Fri, 19 Apr 2024 18:48:53 +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 43JImr5P003399; Fri, 19 Apr 2024 18:48:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43JImrV8003396; Fri, 19 Apr 2024 18:48:53 GMT (envelope-from git) Date: Fri, 19 Apr 2024 18:48:53 GMT Message-Id: <202404191848.43JImrV8003396@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 2cb0fce24d64 - main - bpf: Make BPF interop consistent with if_loop List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 2cb0fce24d64039090dc9243cdf0715ee80c91b1 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=2cb0fce24d64039090dc9243cdf0715ee80c91b1 commit 2cb0fce24d64039090dc9243cdf0715ee80c91b1 Author: Seth Hoffert AuthorDate: 2023-10-22 14:12:45 +0000 Commit: Mark Johnston CommitDate: 2024-04-19 18:48:37 +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 --- 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 bb61917ee4fc..d3a5a29e4c08 100644 --- a/sys/dev/wg/if_wg.c +++ b/sys/dev/wg/if_wg.c @@ -2196,7 +2196,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 f4b51b799d73..9740a25f35c6 100644 --- a/sys/net/if_disc.c +++ b/sys/net/if_disc.c @@ -180,7 +180,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 126fe680e65f..b839730d2e37 100644 --- a/sys/net/if_me.c +++ b/sys/net/if_me.c @@ -538,7 +538,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 1009dc7b3806..a70efe79cbb5 100644 --- a/sys/net/if_tuntap.c +++ b/sys/net/if_tuntap.c @@ -1410,7 +1410,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);