NetBSD/sys/net
ozaki-r 39ce7d7534 bpf: support sending packets on loopback interfaces
Previously sending packets on a loopback interface via bpf failed
because the packets are treated as AF_UNSPEC by bpf and the loopback
interface couldn't handle such packets.

This fix enables user programs to prepend a protocol family (AF_INET or
AF_INET6) to a payload.  bpf interprets it and treats a packet as so,
not just AF_UNSPEC.  The protocol family is encoded as 4 bytes, host byte
order as per DLT_NULL in the specification(*).

(*) https://www.tcpdump.org/linktypes.html

Proposed on tech-net and tech-kern
2022-11-30 06:02:37 +00:00
..
agr
lagg
npf
Makefile
bpf.c bpf: support sending packets on loopback interfaces 2022-11-30 06:02:37 +00:00
bpf.h
bpf_filter.c
bpf_stub.c
bpfdesc.h
bpfjit.c
bpfjit.h
bridgestp.c
bsd-comp.c
dl_print.c
dlt.h
ether_slowprotocols.h
ether_sw_offload.c
ether_sw_offload.h
ethertypes.h
files.net
files.pf
if.c
if.h
if_arc.h
if_arcsubr.c
if_arp.h
if_bridge.c
if_bridgevar.h
if_dl.h
if_ether.h
if_ethersubr.c
if_faith.c
if_faith.h
if_gif.c
if_gif.h
if_gre.c
if_gre.h
if_ieee1394.h
if_ieee1394subr.c
if_ipsec.c
if_ipsec.h
if_l2tp.c
if_l2tp.h
if_llatbl.c
if_llatbl.h
if_llc.h
if_loop.c
if_media.c
if_media.h
if_module.h
if_mpls.c
if_mpls.h
if_ppp.c
if_ppp.h
if_pppoe.c
if_pppoe.h
if_pppvar.h
if_sl.c
if_slvar.h
if_sppp.h
if_spppsubr.c
if_spppvar.h
if_srt.c
if_srt.h
if_stats.c
if_stats.h
if_stf.c
if_stf.h
if_tap.c
if_tap.h
if_tun.c
if_tun.h
if_types.h
if_vether.c
if_vlan.c
if_vlanvar.h
if_wg.c
if_wg.h
link_proto.c
nd.c
nd.h
net_stats.c
net_stats.h
pfil.c
pfil.h
pfkeyv2.h
pktqueue.c
pktqueue.h
ppp-comp.h
ppp-deflate.c
ppp_defs.h
ppp_tty.c
radix.c
radix.h
raw_cb.c
raw_cb.h
raw_usrreq.c
route.c
route.h
rss_config.c
rss_config.h
rtbl.c
rtsock.c
rtsock_shared.c
slcompress.c
slcompress.h
slip.h
toeplitz.c
toeplitz.h
zlib.c
zlib.h