summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2007-05-21 13:33:36 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2007-05-21 13:33:36 +0000
commit6ebb4e821f13113f097d81e1a300e09812715d69 (patch)
tree671795cecb22b49978c6f87a88fde1b6203a7b84
parentfaa97ed9991a0913a9562f9d972c83504a638a9d (diff)
make bridge(4) mark packets with M_PROTO1 if gif(4) needs to use
etherip encapsulation; unbreaks remote ipsec bridges; ok claudio; additional testing Renaud Allard
-rw-r--r--sys/net/if_bridge.c7
-rw-r--r--sys/net/if_gif.c17
2 files changed, 12 insertions, 12 deletions
diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c
index 4f8327bb1ba..a59b13e8597 100644
--- a/sys/net/if_bridge.c
+++ b/sys/net/if_bridge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bridge.c,v 1.160 2007/05/16 20:27:58 michele Exp $ */
+/* $OpenBSD: if_bridge.c,v 1.161 2007/05/21 13:33:35 markus Exp $ */
/*
* Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net)
@@ -2706,6 +2706,11 @@ bridge_ifenqueue(struct bridge_softc *sc, struct ifnet *ifp, struct mbuf *m)
int error, len;
short mflags;
+#if NGIF > 0
+ /* Packet needs etherip encapsulation. */
+ if (ifp->if_type == IFT_GIF)
+ m->m_flags |= M_PROTO1;
+#endif
len = m->m_pkthdr.len;
mflags = m->m_flags;
IFQ_ENQUEUE(&ifp->if_snd, m, NULL, error);
diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c
index d32f675d89d..779c823df36 100644
--- a/sys/net/if_gif.c
+++ b/sys/net/if_gif.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_gif.c,v 1.43 2007/04/19 09:28:40 claudio Exp $ */
+/* $OpenBSD: if_gif.c,v 1.44 2007/05/21 13:33:35 markus Exp $ */
/* $KAME: if_gif.c,v 1.43 2001/02/20 08:51:07 itojun Exp $ */
/*
@@ -217,6 +217,7 @@ gif_start(ifp)
m->m_flags &= ~(M_BCAST|M_MCAST);
/* extract address family */
+ family = AF_UNSPEC;
tp = *mtod(m, u_int8_t *);
tp = (tp >> 4) & 0xff; /* Get the IP version number. */
#ifdef INET
@@ -233,16 +234,10 @@ gif_start(ifp)
* Check if the packet is comming via bridge and needs
* etherip encapsulation or not.
*/
- if (ifp->if_bridge)
- for (mtag = m_tag_find(m, PACKET_TAG_BRIDGE, NULL);
- mtag;
- mtag = m_tag_find(m, PACKET_TAG_BRIDGE, mtag)) {
- if (!bcmp(&ifp->if_bridge, mtag + 1,
- sizeof(caddr_t))) {
- family = AF_LINK;
- break;
- }
- }
+ if (ifp->if_bridge && (m->m_flags & M_PROTO1)) {
+ m->m_flags &= ~M_PROTO1;
+ family = AF_LINK;
+ }
#endif
#if NBPFILTER > 0