Page MenuHomeFreeBSD

D61674.1795025569.diff
No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None

D61674.1795025569.diff

diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c
--- a/sys/netpfil/pf/pf.c
+++ b/sys/netpfil/pf/pf.c
@@ -9947,8 +9947,10 @@
SDT_PROBE1(pf, ip, route_to, drop, __LINE__);
goto bad;
} else if (m0 == NULL) {
- action = PF_DROP;
- SDT_PROBE1(pf, ip, route_to, drop, __LINE__);
+ /*
+ * The outbound pass sent the packet on itself
+ * or queued it, so it is consumed, not dropped.
+ */
goto done;
}
if (m0->m_len < sizeof(struct ip)) {
@@ -10291,8 +10293,10 @@
SDT_PROBE1(pf, ip6, route_to, drop, __LINE__);
goto bad;
} else if (m0 == NULL) {
- action = PF_DROP;
- SDT_PROBE1(pf, ip6, route_to, drop, __LINE__);
+ /*
+ * The outbound pass sent the packet on itself
+ * or queued it, so it is consumed, not dropped.
+ */
goto done;
}
if (m0->m_len < sizeof(struct ip6_hdr)) {
diff --git a/tests/sys/netpfil/pf/forward.sh b/tests/sys/netpfil/pf/forward.sh
--- a/tests/sys/netpfil/pf/forward.sh
+++ b/tests/sys/netpfil/pf/forward.sh
@@ -316,24 +316,26 @@
# the outbound hook, after the route lookup chose ${epair_recv}b, for
# route-to on the outbound pass. Neither is a discard.
#
- # The rules do not keep state: when the outbound pass that pf runs from
- # the inbound hook creates a state, pf reports the packet it sent as
- # dropped.
+ # With state, the outbound pass that pf runs from the inbound hook
+ # creates a state of its own and sends the packet; without, the inbound
+ # pass does.
#
# The host's MLD reports are for a group alcatraz has not joined, and
# ip6_input() would count them as discarded. Block them.
for dir in in out; do
- pft_set_rules alcatraz \
- "block in quick inet6 to ff02::16" \
- "pass no state" \
- "pass ${dir} quick route-to (${epair_route}b 2001:db8:44::3) inet6 to 2001:db8:666::1 no state"
- in_discards=$(jexec alcatraz netstat -s -p ip6 -I ${epair_send}b |
- awk '/input datagrams? discarded/ { print $1 }')
- atf_check -s exit:2 -o ignore ping -6 -c 1 -W 1 2001:db8:666::1
- atf_check -o match:"[[:space:]]${in_discards} input datagrams? discarded" \
- jexec alcatraz netstat -s -p ip6 -I ${epair_send}b
- atf_check -o match:"[[:space:]]0 total discarded output datagrams" \
- jexec alcatraz netstat -s -p ip6 -I ${epair_recv}b
+ for state in "keep state" "no state"; do
+ pft_set_rules alcatraz \
+ "block in quick inet6 to ff02::16" \
+ "pass ${state}" \
+ "pass ${dir} quick route-to (${epair_route}b 2001:db8:44::3) inet6 to 2001:db8:666::1 ${state}"
+ in_discards=$(jexec alcatraz netstat -s -p ip6 -I ${epair_send}b |
+ awk '/input datagrams? discarded/ { print $1 }')
+ atf_check -s exit:2 -o ignore ping -6 -c 1 -W 1 2001:db8:666::1
+ atf_check -o match:"[[:space:]]${in_discards} input datagrams? discarded" \
+ jexec alcatraz netstat -s -p ip6 -I ${epair_send}b
+ atf_check -o match:"[[:space:]]0 total discarded output datagrams" \
+ jexec alcatraz netstat -s -p ip6 -I ${epair_recv}b
+ done
done
}

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 18, 6:12 PM (23 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41829894
Default Alt Text
D61674.1795025569.diff (2 KB)

Event Timeline