diff options
author | jasoni <jasoni@cvs.openbsd.org> | 2002-06-07 21:46:09 +0000 |
---|---|---|
committer | jasoni <jasoni@cvs.openbsd.org> | 2002-06-07 21:46:09 +0000 |
commit | d1b7d37e027671790f9d3d41b4401834d81a492d (patch) | |
tree | 7d4aea40c223b58e79f2f0de60190228159828c1 /sys | |
parent | cccd0fa144040165e4a4ddbdae55c3bab037d2b2 (diff) |
in pf_route{6}, do not pass thru pf_test again if the outgoing
interface has not changed
- ok dhartmei@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/pf.c | 48 |
1 files changed, 27 insertions, 21 deletions
diff --git a/sys/net/pf.c b/sys/net/pf.c index a47e9f737fb..fb387b1c790 100644 --- a/sys/net/pf.c +++ b/sys/net/pf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf.c,v 1.217 2002/06/07 21:25:35 dhartmei Exp $ */ +/* $OpenBSD: pf.c,v 1.218 2002/06/07 21:46:08 jasoni Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -5052,17 +5052,20 @@ pf_route(struct mbuf **m, struct pf_rule *r, int dir) if (ifp == NULL) goto bad; - mtag = m_tag_find(m0, PACKET_TAG_PF_ROUTED, NULL); - if (mtag == NULL) { - if (pf_test(PF_OUT, ifp, &m0) != PF_PASS) - goto bad; - else if (m0 == NULL) - goto done; - else { - mtag = m_tag_get(PACKET_TAG_PF_ROUTED, 0, M_NOWAIT); - if (mtag == NULL) + if (r->ifp != ifp) { + mtag = m_tag_find(m0, PACKET_TAG_PF_ROUTED, NULL); + if (mtag == NULL) { + if (pf_test(PF_OUT, ifp, &m0) != PF_PASS) goto bad; - m_tag_prepend(m0, mtag); + else if (m0 == NULL) + goto done; + else { + mtag = m_tag_get(PACKET_TAG_PF_ROUTED, 0, + M_NOWAIT); + if (mtag == NULL) + goto bad; + m_tag_prepend(m0, mtag); + } } } @@ -5179,17 +5182,20 @@ pf_route6(struct mbuf **m, struct pf_rule *r, int dir) if (ifp == NULL) goto bad; - mtag = m_tag_find(m0, PACKET_TAG_PF_ROUTED, NULL); - if (mtag == NULL) { - if (pf_test(PF_OUT, ifp, &m0) != PF_PASS) - goto bad; - else if (m0 == NULL) - goto done; - else { - mtag = m_tag_get(PACKET_TAG_PF_ROUTED, 0, M_NOWAIT); - if (mtag == NULL) + if (r->ifp != ifp) { + mtag = m_tag_find(m0, PACKET_TAG_PF_ROUTED, NULL); + if (mtag == NULL) { + if (pf_test(PF_OUT, ifp, &m0) != PF_PASS) goto bad; - m_tag_prepend(m0, mtag); + else if (m0 == NULL) + goto done; + else { + mtag = m_tag_get(PACKET_TAG_PF_ROUTED, 0, + M_NOWAIT); + if (mtag == NULL) + goto bad; + m_tag_prepend(m0, mtag); + } } } |