diff options
author | Jason Wright <jason@cvs.openbsd.org> | 1999-09-01 21:38:49 +0000 |
---|---|---|
committer | Jason Wright <jason@cvs.openbsd.org> | 1999-09-01 21:38:49 +0000 |
commit | 70bb409d11720d7d71cf6f2316560b9f73fa24c3 (patch) | |
tree | f1a4deac6e253a99b5d6f78655e0553fa24c08e6 /sys/net | |
parent | 4798a08b30eee9941f3874fc645e6926ad7327e8 (diff) |
o simpler handling of "forme" packets
o when ~IFF_UP, don't act like a bridge for output either
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/if_bridge.c | 21 | ||||
-rw-r--r-- | sys/net/if_bridge.h | 4 | ||||
-rw-r--r-- | sys/net/if_ethersubr.c | 10 |
3 files changed, 23 insertions, 12 deletions
diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index e102794dae4..9a776852e07 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bridge.c,v 1.15 1999/08/20 04:53:17 jason Exp $ */ +/* $OpenBSD: if_bridge.c,v 1.16 1999/09/01 21:38:48 jason Exp $ */ /* * Copyright (c) 1999 Jason L. Wright (jason@thought.net) @@ -608,6 +608,16 @@ bridge_output(ifp, m, sa, rt) s = splimp(); /* + * If bridge is down, but original output interface is up, + * go ahead and send out that interface. Otherwise the packet + * is dropped below. + */ + if ((sc->sc_if.if_flags & IFF_RUNNING) == 0) { + dst_if = ifp; + goto sendunicast; + } + + /* * If the packet is a broadcast or we don't know a better way to * get there, we must broadcast with header rewriting. */ @@ -665,6 +675,8 @@ bridge_output(ifp, m, sa, rt) } bcopy(ac->ac_enaddr, src, ETHER_ADDR_LEN); + +sendunicast: if ((dst_if->if_flags & IFF_RUNNING) == 0) { m_freem(m); splx(s); @@ -860,11 +872,10 @@ bridgeintr(void) * bridge members. */ struct mbuf * -bridge_input(ifp, eh, m, forme) +bridge_input(ifp, eh, m) struct ifnet *ifp; struct ether_header *eh; struct mbuf *m; - int *forme; { struct bridge_softc *sc; int s; @@ -912,10 +923,8 @@ bridge_input(ifp, eh, m, forme) while (ifl != NULL) { ac = (struct arpcom *)ifl->ifp; if (bcmp(ac->ac_enaddr, eh->ether_dhost, - ETHER_ADDR_LEN) == 0) { - *forme = 1; + ETHER_ADDR_LEN) == 0) return (m); - } ifl = LIST_NEXT(ifl, next); } M_PREPEND(m, sizeof(*eh), M_DONTWAIT); diff --git a/sys/net/if_bridge.h b/sys/net/if_bridge.h index ee193e94dff..1392add2813 100644 --- a/sys/net/if_bridge.h +++ b/sys/net/if_bridge.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bridge.h,v 1.8 1999/08/08 02:42:58 niklas Exp $ */ +/* $OpenBSD: if_bridge.h,v 1.9 1999/09/01 21:38:48 jason Exp $ */ /* * Copyright (c) 1999 Jason L. Wright (jason@thought.net) @@ -103,7 +103,7 @@ struct ifbcachetoreq { #ifdef _KERNEL void bridge_ifdetach __P((struct ifnet *)); struct mbuf *bridge_input __P((struct ifnet *, struct ether_header *, - struct mbuf *, int *)); + struct mbuf *)); int bridge_output __P((struct ifnet *, struct mbuf *, struct sockaddr *, struct rtentry *rt)); #endif /* _KERNEL */ diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 088923828a4..c22ba6d04ea 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ethersubr.c,v 1.30 1999/08/08 02:42:58 niklas Exp $ */ +/* $OpenBSD: if_ethersubr.c,v 1.31 1999/09/01 21:38:48 jason Exp $ */ /* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */ /* @@ -506,7 +506,7 @@ ether_input(ifp, eh, m) { register struct ifqueue *inq; u_int16_t etype; - int s, llcfound = 0, forme = 0; + int s, llcfound = 0; register struct llc *l; struct arpcom *ac = (struct arpcom *)ifp; @@ -534,16 +534,18 @@ ether_input(ifp, eh, m) * gets processed as normal. */ if (ifp->if_bridge) { - m = bridge_input(ifp, eh, m, &forme); + m = bridge_input(ifp, eh, m); if (m == NULL) return; + /* The bridge has determined it's for us. */ + goto decapsulate; } #endif /* * If packet is unicast and we're in promiscuous mode, make sure it * is for us. Drop otherwise. */ - if (!forme && (m->m_flags & (M_BCAST|M_MCAST)) == 0 && + if ((m->m_flags & (M_BCAST|M_MCAST)) == 0 && (ifp->if_flags & IFF_PROMISC)) { if (bcmp(ac->ac_enaddr, (caddr_t)eh->ether_dhost, ETHER_ADDR_LEN)) { |