From 5fff3f1010134e6bd213132ea4de3681425a9214 Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Sun, 27 Oct 2013 20:52:09 +0000 Subject: [PATCH] Improt pf.c 1.636 from OpenBSD Original log: Make sure pd2 has a pointer to the icmp header in the payload; fixes panic seen with some some icmp types in icmp error message payloads. Obtained from: OpenBSD --- sys/netpfil/pf/pf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 9a2360693385..4770e0b261d2 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -4994,7 +4994,7 @@ pf_test_state_icmp(struct pf_state **state, int direction, struct pfi_kif *kif, return (PF_DROP); } - icmpid = iih.icmp_id; + pd2.hdr.icmp = &iih; pf_icmp_mapping(&pd2, iih.icmp_type, &icmp_dir, &multi, &virtual_id, &virtual_type); @@ -5049,6 +5049,7 @@ pf_test_state_icmp(struct pf_state **state, int direction, struct pfi_kif *kif, return (PF_DROP); } + pd2.hdr.icmp6 = &iih; pf_icmp_mapping(&pd2, iih.icmp6_type, &icmp_dir, &multi, &virtual_id, &virtual_type); ret = pf_icmp_state_lookup(&key, &pd2, state, m,