mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
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)
This commit is contained in:
parent
ebc5b3b085
commit
3f6515c20f
8 changed files with 13 additions and 9 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue