summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2016-04-07 14:28:17 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2016-04-07 14:28:17 +0000
commite897bf0b9c53c837c558e88d8c33698b683f6332 (patch)
tree5399159ebda3651f858f376031b64fe4a5929bef /sys
parent3d6412b21a564fcfb74dae08b9d45d921e63a22e (diff)
Instead of panicking if an mbuf(9) already has a statekey dump its
content and unlink the statekey. This should allow us to find the reminding corner cases of packets looped back in the stack. ok dlg@
Diffstat (limited to 'sys')
-rw-r--r--sys/net/pf.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/sys/net/pf.c b/sys/net/pf.c
index 4e4dca7c3b2..7df8e3aa12f 100644
--- a/sys/net/pf.c
+++ b/sys/net/pf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf.c,v 1.967 2016/03/29 10:34:42 sashan Exp $ */
+/* $OpenBSD: pf.c,v 1.968 2016/04/07 14:28:16 mpi Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -99,6 +99,10 @@
#include <netinet6/ip6_divert.h>
#endif /* INET6 */
+#ifdef DDB
+#include <machine/db_machdep.h>
+#include <ddb/db_interface.h>
+#endif
/*
* Global variables
@@ -6561,11 +6565,19 @@ done:
pd.m->m_pkthdr.pf.qid = qid;
if (pd.dir == PF_IN && s && s->key[PF_SK_STACK]) {
/*
- * ASSERT() below fires whenever caller forgets to call
- * pf_pkt_addr_changed(). This might happen when we deal with
- * IP tunnels.
+ * Check below fires whenever caller forgets to call
+ * pf_pkt_addr_changed(). This might happen when we
+ * deal with IP tunnels.
*/
- KASSERT(pd.m->m_pkthdr.pf.statekey == NULL);
+ if (pd.m->m_pkthdr.pf.statekey != NULL) {
+ printf("WARNING incoming mbuf already has a statekey:");
+#ifdef DDB
+ m_print(pd.m, printf);
+#else
+ printf("%p\n", pd.m);
+#endif
+ pf_pkt_unlink_state_key(pd.m);
+ }
pd.m->m_pkthdr.pf.statekey =
pf_state_key_ref(s->key[PF_SK_STACK]);
}