summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjasoni <jasoni@openbsd.org>2002-06-07 21:46:08 +0000
committerjasoni <jasoni@openbsd.org>2002-06-07 21:46:08 +0000
commite1adace338b553d6743e96633c262c2ccc119ccf (patch)
tree9ec36c613dd02d02aeaec2d0ccdc188e2b7611b3
parentInstead of passing seed and defaultseed to normal_mode() and (diff)
downloadwireguard-openbsd-e1adace338b553d6743e96633c262c2ccc119ccf.tar.xz
wireguard-openbsd-e1adace338b553d6743e96633c262c2ccc119ccf.zip
in pf_route{6}, do not pass thru pf_test again if the outgoing
interface has not changed - ok dhartmei@
-rw-r--r--sys/net/pf.c48
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);
+ }
}
}