diff options
author | Camiel Dobbelaar <camield@cvs.openbsd.org> | 2005-06-07 07:09:43 +0000 |
---|---|---|
committer | Camiel Dobbelaar <camield@cvs.openbsd.org> | 2005-06-07 07:09:43 +0000 |
commit | 8e50e9947d0a355ca0701c231824311f3a884d0a (patch) | |
tree | 0dc57d67d836d2b4ae25d5b29596688dec187d61 /sys | |
parent | 5f0acf6733ad1ae34d35f4ab7a099498aa3d635d (diff) |
Run vlan_input before bridge_input, and change vlan_input to not
consume vlan frames that no vlan interface wants, so they can
still be bridged.
This way, the bridge can bridge encapsulated frames _and_ bridge
between vlan interfaces.
ok henning markus
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/if_ethersubr.c | 12 | ||||
-rw-r--r-- | sys/net/if_vlan.c | 13 |
2 files changed, 18 insertions, 7 deletions
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 87a6faf5f73..e4995d3ffb8 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ethersubr.c,v 1.94 2005/06/07 02:45:11 henning Exp $ */ +/* $OpenBSD: if_ethersubr.c,v 1.95 2005/06/07 07:09:42 camield Exp $ */ /* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */ /* @@ -621,6 +621,11 @@ ether_input(ifp, eh, m) etype = ntohs(eh->ether_type); +#if NVLAN > 0 + if (etype == ETHERTYPE_VLAN && (vlan_input(eh, m) == 0)) + return; +#endif + #if NBRIDGE > 0 /* * Tap the packet off here for a bridge, if configured and @@ -643,8 +648,9 @@ ether_input(ifp, eh, m) #if NVLAN > 0 if (etype == ETHERTYPE_VLAN) { - if (vlan_input(eh, m) < 0) - ifp->if_noproto++; + /* The bridge did not want the vlan frame either, drop it. */ + ifp->if_noproto++; + m_freem(m); return; } #endif /* NVLAN > 0 */ diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index 0e0938cdeb8..9fd46bf5064 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vlan.c,v 1.55 2005/05/27 08:33:25 mpf Exp $ */ +/* $OpenBSD: if_vlan.c,v 1.56 2005/06/07 07:09:42 camield Exp $ */ /* * Copyright 1998 Massachusetts Institute of Technology @@ -328,6 +328,9 @@ vlan_input_tag(struct mbuf *m, u_int16_t t) return 0; } +/* + * vlan_input() returns 0 if it has consumed the packet, 1 otherwise. + */ int vlan_input(eh, m) struct ether_header *eh; @@ -349,11 +352,13 @@ vlan_input(eh, m) if (m->m_pkthdr.rcvif == ifv->ifv_p && tag == ifv->ifv_tag) break; } + if (ifv == NULL) + return (1); - if (ifv == NULL || (ifv->ifv_if.if_flags & (IFF_UP|IFF_RUNNING)) != + if ((ifv->ifv_if.if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) { m_freem(m); - return -1; /* so ether_input can take note */ + return (0); } /* @@ -389,7 +394,7 @@ vlan_input(eh, m) ifv->ifv_if.if_ipackets++; ether_input(&ifv->ifv_if, eh, m); - return 0; + return (0); } int |