diff options
author | Kristof Provost <kp@FreeBSD.org> | 2022-07-01 11:13:20 +0000 |
---|---|---|
committer | Kristof Provost <kp@FreeBSD.org> | 2022-07-01 12:31:57 +0000 |
commit | ba3b6b938db71a18a93cf88979af0e57136787bd (patch) | |
tree | 2a64e64bfa78ce21eae19d4419bd840a9ee7880e | |
parent | 42db2dbbc51bffa90dc594f728976dcdb646c2b6 (diff) | |
download | src-ba3b6b938db71a18a93cf88979af0e57136787bd.tar.gz src-ba3b6b938db71a18a93cf88979af0e57136787bd.zip |
pf: handle dummynet for non-IP packets
Do not panic if we try to dummynet an Ethernet packet that's not IPv4 or
IPv6. Simply give it to dummynet.
Sponsored by: Rubicon Communications, LLC ("Netgate")
-rw-r--r-- | sys/netpfil/pf/pf.c | 2 | ||||
-rw-r--r-- | tests/sys/netpfil/pf/ether.sh | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index d9664404e6e3..d82ec5eafd3c 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -4094,8 +4094,6 @@ pf_test_eth_rule(int dir, struct pfi_kkif *kif, struct mbuf **m0) dnflow.f_id.src_ip6 = src->v6; dnflow.f_id.dst_ip6 = dst->v6; break; - default: - panic("Unknown address family"); } mtag->flags |= PF_TAG_DUMMYNET; diff --git a/tests/sys/netpfil/pf/ether.sh b/tests/sys/netpfil/pf/ether.sh index 549fbf22ab7b..7fd55a5d78b5 100644 --- a/tests/sys/netpfil/pf/ether.sh +++ b/tests/sys/netpfil/pf/ether.sh @@ -419,6 +419,9 @@ dummynet_body() pft_set_rules alcatraz \ "ether pass in dnpipe 1" + # Ensure things don't break if non-IP(v4/v6) traffic hits dummynet + arp -d 192.0.2.2 + # single ping succeeds just fine atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 |