diff options
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/if_arcsubr.c | 5 | ||||
-rw-r--r-- | sys/net/if_ethersubr.c | 5 | ||||
-rw-r--r-- | sys/net/if_fddisubr.c | 5 | ||||
-rw-r--r-- | sys/net/if_tokensubr.c | 5 | ||||
-rw-r--r-- | sys/net/pf.c | 36 |
5 files changed, 31 insertions, 25 deletions
diff --git a/sys/net/if_arcsubr.c b/sys/net/if_arcsubr.c index 8fb658e0915..5cd88baa287 100644 --- a/sys/net/if_arcsubr.c +++ b/sys/net/if_arcsubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_arcsubr.c,v 1.15 2003/06/02 23:28:11 millert Exp $ */ +/* $OpenBSD: if_arcsubr.c,v 1.16 2003/08/18 11:01:41 dhartmei Exp $ */ /* $NetBSD: if_arcsubr.c,v 1.8 1996/05/07 02:40:29 thorpej Exp $ */ /* @@ -145,7 +145,8 @@ arc_output(ifp, m0, dst, rt0) adst = ntohl(SIN(dst)->sin_addr.s_addr) & 0xFF; /* If broadcasting on a simplex interface, loopback a copy */ - if ((m->m_flags & M_BCAST) && (ifp->if_flags & IFF_SIMPLEX)) + if ((m->m_flags & M_BCAST) && (ifp->if_flags & IFF_SIMPLEX) && + m_tag_find(m, PACKET_TAG_PF_ROUTED, NULL) == NULL) mcopy = m_copy(m, 0, (int)M_COPYALL); if (ifp->if_flags & IFF_LINK0) { atype = ARCTYPE_IP; diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 7e3e77f10e4..6731cb530a2 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ethersubr.c,v 1.69 2003/06/02 23:28:12 millert Exp $ */ +/* $OpenBSD: if_ethersubr.c,v 1.70 2003/08/18 11:01:41 dhartmei Exp $ */ /* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */ /* @@ -283,7 +283,8 @@ ether_output(ifp, m0, dst, rt0) if (!arpresolve(ac, rt, m, dst, edst)) return (0); /* if not yet resolved */ /* If broadcasting on a simplex interface, loopback a copy */ - if ((m->m_flags & M_BCAST) && (ifp->if_flags & IFF_SIMPLEX)) + if ((m->m_flags & M_BCAST) && (ifp->if_flags & IFF_SIMPLEX) && + m_tag_find(m, PACKET_TAG_PF_ROUTED, NULL) == NULL) mcopy = m_copy(m, 0, (int)M_COPYALL); etype = htons(ETHERTYPE_IP); break; diff --git a/sys/net/if_fddisubr.c b/sys/net/if_fddisubr.c index 2671c698f39..a92f244a358 100644 --- a/sys/net/if_fddisubr.c +++ b/sys/net/if_fddisubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_fddisubr.c,v 1.32 2003/06/02 23:28:12 millert Exp $ */ +/* $OpenBSD: if_fddisubr.c,v 1.33 2003/08/18 11:01:41 dhartmei Exp $ */ /* $NetBSD: if_fddisubr.c,v 1.5 1996/05/07 23:20:21 christos Exp $ */ /* @@ -202,7 +202,8 @@ fddi_output(ifp, m0, dst, rt0) if (!arpresolve(ac, rt, m, dst, edst)) return (0); /* if not yet resolved */ /* If broadcasting on a simplex interface, loopback a copy */ - if ((m->m_flags & M_BCAST) && (ifp->if_flags & IFF_SIMPLEX)) + if ((m->m_flags & M_BCAST) && (ifp->if_flags & IFF_SIMPLEX) && + m_tag_find(m, PACKET_TAG_PF_ROUTED, NULL) == NULL) mcopy = m_copy(m, 0, (int)M_COPYALL); type = htons(ETHERTYPE_IP); break; diff --git a/sys/net/if_tokensubr.c b/sys/net/if_tokensubr.c index 302f27e03ec..e276780ee54 100644 --- a/sys/net/if_tokensubr.c +++ b/sys/net/if_tokensubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tokensubr.c,v 1.11 2003/06/02 23:28:12 millert Exp $ */ +/* $OpenBSD: if_tokensubr.c,v 1.12 2003/08/18 11:01:41 dhartmei Exp $ */ /* $NetBSD: if_tokensubr.c,v 1.7 1999/05/30 00:39:07 bad Exp $ */ /* @@ -201,7 +201,8 @@ token_output(ifp, m0, dst, rt0) riflen = (ntohs(rif->tr_rcf) & TOKEN_RCF_LEN_MASK) >> 8; } /* If broadcasting on a simplex interface, loopback a copy. */ - if ((m->m_flags & M_BCAST) && (ifp->if_flags & IFF_SIMPLEX)) + if ((m->m_flags & M_BCAST) && (ifp->if_flags & IFF_SIMPLEX) && + m_tag_find(m, PACKET_TAG_PF_ROUTED, NULL) == NULL) mcopy = m_copy(m, 0, (int)M_COPYALL); etype = htons(ETHERTYPE_IP); break; diff --git a/sys/net/pf.c b/sys/net/pf.c index e4701d2a819..1a06af8df12 100644 --- a/sys/net/pf.c +++ b/sys/net/pf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf.c,v 1.384 2003/08/17 15:36:48 dhartmei Exp $ */ +/* $OpenBSD: pf.c,v 1.385 2003/08/18 11:01:41 dhartmei Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -4525,22 +4525,24 @@ pf_route(struct mbuf **m, struct pf_rule *r, int dir, struct ifnet *oifp, if (ifp == NULL) goto bad; - if (oifp != ifp) { - mtag = m_tag_find(m0, PACKET_TAG_PF_ROUTED, NULL); - if (mtag == NULL) { - mtag = m_tag_get(PACKET_TAG_PF_ROUTED, 0, M_NOWAIT); - if (mtag == NULL) - goto bad; - m_tag_prepend(m0, mtag); - if (pf_test(PF_OUT, ifp, &m0) != PF_PASS) - goto bad; - else if (m0 == NULL) - goto done; - if (m0->m_len < sizeof(struct ip)) - panic("pf_route: m0->m_len < " - "sizeof(struct ip)"); - ip = mtod(m0, struct ip *); - } + 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 (oifp != ifp && mtag == NULL) { + if (pf_test(PF_OUT, ifp, &m0) != PF_PASS) + goto bad; + else if (m0 == NULL) + goto done; + if (m0->m_len < sizeof(struct ip)) + panic("pf_route: m0->m_len < sizeof(struct ip)"); + ip = mtod(m0, struct ip *); } /* Copied from ip_output. */ |