summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorDaniel Hartmeier <dhartmei@cvs.openbsd.org>2004-04-25 18:45:58 +0000
committerDaniel Hartmeier <dhartmei@cvs.openbsd.org>2004-04-25 18:45:58 +0000
commita13aca4c9c7eeb63fe30b13d3f2ea9a9a287718f (patch)
treef5bae03a2b573644ce38e54f6c4ba4bcad7553de /sys/net
parentb9b8cbe237104b8529ebf001a6cdf08ead1bf4ba (diff)
prevent an endless loop with route-to lo0, fixes PR 3736,
ok pb@, henning@, markus@
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/pf.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/sys/net/pf.c b/sys/net/pf.c
index 96e2bb0bcbf..4c5dcae1b5c 100644
--- a/sys/net/pf.c
+++ b/sys/net/pf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf.c,v 1.439 2004/04/25 18:09:29 pb Exp $ */
+/* $OpenBSD: pf.c,v 1.440 2004/04/25 18:45:57 dhartmei Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -4933,17 +4933,14 @@ pf_route(struct mbuf **m, struct pf_rule *r, int dir, struct ifnet *oifp,
if (ifp == NULL)
goto bad;
- mtag = m_tag_find(m0, PACKET_TAG_PF_ROUTED, NULL);
- if (mtag == NULL) {
- struct m_tag *mtag;
-
- mtag = m_tag_get(PACKET_TAG_PF_ROUTED, 0, M_NOWAIT);
- if (mtag == NULL)
- goto bad;
- m_tag_prepend(m0, mtag);
- }
+ if (m_tag_find(m0, PACKET_TAG_PF_ROUTED, NULL) != NULL)
+ goto bad;
+ mtag = m_tag_get(PACKET_TAG_PF_ROUTED, 0, M_NOWAIT);
+ if (mtag == NULL)
+ goto bad;
+ m_tag_prepend(m0, mtag);
- if (oifp != ifp && mtag == NULL) {
+ if (oifp != ifp) {
if (pf_test(PF_OUT, ifp, &m0) != PF_PASS)
goto bad;
else if (m0 == NULL)