summaryrefslogtreecommitdiffstats
path: root/sys/netpfil
diff options
context:
space:
mode:
authorkp <kp@FreeBSD.org>2015-06-18 21:23:41 +0000
committerkp <kp@FreeBSD.org>2015-06-18 21:23:41 +0000
commit32fc55692fc89c5d0cb19c742f0d44740d4c5a06 (patch)
treed0d64fc67da024970773af6741d852a5280b91ac /sys/netpfil
parent7d05cb134c7ce76e4819dc6604a11ef7f2c63a1f (diff)
downloadFreeBSD-src-32fc55692fc89c5d0cb19c742f0d44740d4c5a06.zip
FreeBSD-src-32fc55692fc89c5d0cb19c742f0d44740d4c5a06.tar.gz
Merge r284222, r284260
pf: address family must be set when creating a pf_fragment Fix a panic when handling fragmented ip4 packets with 'drop-ovl' set. In that scenario we take a different branch in pf_normalize_ip(), taking us to pf_fragcache() (rather than pf_reassemble()). In pf_fragcache() we create a pf_fragment, but do not set the address family. This leads to a panic when we try to insert that into pf_frag_tree because pf_addr_cmp(), which is used to compare the pf_fragments doesn't know what to do if the address family is not set. Simply ensure that the address family is set correctly (always AF_INET in this path). When we try to look up a pf_fragment with pf_find_fragment() we compare (see pf_frag_compare()) addresses (and family), but also protocol. We failed to save the protocol to the pf_fragment in pf_fragcache(), resulting in failing reassembly. PR: 200330 Differential Revision: https://reviews.freebsd.org/D2824 Reviewed by: gnn
Diffstat (limited to 'sys/netpfil')
-rw-r--r--sys/netpfil/pf/pf_norm.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/netpfil/pf/pf_norm.c b/sys/netpfil/pf/pf_norm.c
index 380cf47..1b7c2e2 100644
--- a/sys/netpfil/pf/pf_norm.c
+++ b/sys/netpfil/pf/pf_norm.c
@@ -825,6 +825,8 @@ pf_fragcache(struct mbuf **m0, struct ip *h, struct pf_fragment **frag, int mff,
(*frag)->fr_max = 0;
(*frag)->fr_src.v4 = h->ip_src;
(*frag)->fr_dst.v4 = h->ip_dst;
+ (*frag)->fr_af = AF_INET;
+ (*frag)->fr_proto = h->ip_p;
(*frag)->fr_id = h->ip_id;
(*frag)->fr_timeout = time_uptime;
OpenPOWER on IntegriCloud