diff options
-rw-r--r-- | sys/dev/isa/if_ie.c | 14 | ||||
-rw-r--r-- | sys/net/bridgestp.c | 27 | ||||
-rw-r--r-- | sys/net/if.c | 8 | ||||
-rw-r--r-- | sys/net/if.h | 4 | ||||
-rw-r--r-- | sys/net/if_bridge.c | 190 | ||||
-rw-r--r-- | sys/net/if_bridge.h | 7 | ||||
-rw-r--r-- | sys/net/if_ethersubr.c | 15 | ||||
-rw-r--r-- | sys/net/if_gif.c | 4 | ||||
-rw-r--r-- | sys/net80211/ieee80211_node.c | 10 | ||||
-rw-r--r-- | sys/netinet/if_ether.c | 17 | ||||
-rw-r--r-- | sys/netinet/ip_ether.c | 4 | ||||
-rw-r--r-- | sys/netinet/ip_output.c | 12 | ||||
-rw-r--r-- | sys/netinet6/in6.c | 8 |
13 files changed, 130 insertions, 190 deletions
diff --git a/sys/dev/isa/if_ie.c b/sys/dev/isa/if_ie.c index 34609848d1c..20d63da2aa7 100644 --- a/sys/dev/isa/if_ie.c +++ b/sys/dev/isa/if_ie.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ie.c,v 1.35 2008/11/28 02:44:17 brad Exp $ */ +/* $OpenBSD: if_ie.c,v 1.36 2012/10/05 17:17:04 camield Exp $ */ /* $NetBSD: if_ie.c,v 1.51 1996/05/12 23:52:48 mycroft Exp $ */ /*- @@ -1054,16 +1054,16 @@ check_eh(sc, eh, to_bpf) */ #if NBPFILTER > 0 *to_bpf = (sc->sc_arpcom.ac_if.if_bpf != 0) || - (sc->sc_arpcom.ac_if.if_bridge != NULL); + (sc->sc_arpcom.ac_if.if_bridgeport != NULL); #else - *to_bpf = (sc->sc_arpcom.ac_if.if_bridge != NULL); + *to_bpf = (sc->sc_arpcom.ac_if.if_bridgeport != NULL); #endif /* If for us, accept and hand up to BPF */ if (ether_equal(eh->ether_dhost, sc->sc_arpcom.ac_enaddr)) return 1; #if NBPFILTER > 0 - if (*to_bpf && sc->sc_arpcom.ac_if.if_bridge == NULL) + if (*to_bpf && sc->sc_arpcom.ac_if.if_bridgeport == NULL) *to_bpf = 2; /* we don't need to see it */ #endif @@ -1095,9 +1095,9 @@ check_eh(sc, eh, to_bpf) */ #if NBPFILTER > 0 *to_bpf = (sc->sc_arpcom.ac_if.if_bpf != 0) || - (sc->sc_arpcom.ac_if.if_bridge != NULL); + (sc->sc_arpcom.ac_if.if_bridgeport != NULL); #else - *to_bpf = (sc->sc_arpcom.ac_if.if_bridge != NULL); + *to_bpf = (sc->sc_arpcom.ac_if.if_bridgeport != NULL); #endif /* We want to see multicasts. */ if (eh->ether_dhost[0] & 1) @@ -1109,7 +1109,7 @@ check_eh(sc, eh, to_bpf) /* Anything else goes to BPF but nothing else. */ #if NBPFILTER > 0 - if (*to_bpf && sc->sc_arpcom.ac_if.if_bridge == NULL) + if (*to_bpf && sc->sc_arpcom.ac_if.if_bridgeport == NULL) *to_bpf = 2; #endif return 1; diff --git a/sys/net/bridgestp.c b/sys/net/bridgestp.c index 70c4e63511a..5ae8ca1d635 100644 --- a/sys/net/bridgestp.c +++ b/sys/net/bridgestp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bridgestp.c,v 1.41 2012/09/20 14:10:18 mpf Exp $ */ +/* $OpenBSD: bridgestp.c,v 1.42 2012/10/05 17:17:04 camield Exp $ */ /* * Copyright (c) 2000 Jason L. Wright (jason@thought.net) @@ -1641,7 +1641,6 @@ void bstp_ifstate(void *arg) { struct ifnet *ifp = (struct ifnet *)arg; - struct bridge_softc *sc; struct bridge_iflist *p; struct bstp_port *bp; struct bstp_state *bs; @@ -1649,16 +1648,11 @@ bstp_ifstate(void *arg) if (ifp->if_type == IFT_BRIDGE) return; - sc = (struct bridge_softc *)ifp->if_bridge; s = splnet(); - LIST_FOREACH(p, &sc->sc_iflist, next) { - if ((p->bif_flags & IFBIF_STP) == 0) - continue; - if (p->ifp == ifp) - break; - } - if (p == LIST_END(&sc->sc_iflist)) + if ((p = (struct bridge_iflist *)ifp->if_bridgeport) == NULL) + goto done; + if ((p->bif_flags & IFBIF_STP) == 0) goto done; if ((bp = p->bif_stp) == NULL) goto done; @@ -2121,7 +2115,7 @@ bstp_ifsflags(struct bstp_port *bp, u_int flags) int bstp_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { - struct bridge_softc *sc = (struct bridge_softc *)ifp; + struct bridge_softc *sc = (struct bridge_softc *)ifp->if_softc; struct bstp_state *bs = sc->sc_stp; struct ifbrparam *ifbp = (struct ifbrparam *)data; struct ifbreq *ifbr = (struct ifbreq *)data; @@ -2138,15 +2132,8 @@ bstp_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) err = ENOENT; break; } - if ((caddr_t)sc != ifs->if_bridge) { - err = ESRCH; - break; - } - LIST_FOREACH(p, &sc->sc_iflist, next) { - if (p->ifp == ifs) - break; - } - if (p == LIST_END(&sc->sc_iflist)) { + p = (struct bridge_iflist *)ifs->if_bridgeport; + if (p == NULL || p->bridge_sc != sc) { err = ESRCH; break; } diff --git a/sys/net/if.c b/sys/net/if.c index c2132ab5c8b..086c2d36769 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.244 2012/09/19 16:14:01 blambert Exp $ */ +/* $OpenBSD: if.c,v 1.245 2012/10/05 17:17:04 camield Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -531,7 +531,7 @@ if_detach(struct ifnet *ifp) #if NBRIDGE > 0 /* Remove the interface from any bridge it is part of. */ - if (ifp->if_bridge) + if (ifp->if_bridgeport) bridge_ifdetach(ifp); #endif @@ -1094,7 +1094,7 @@ if_down(struct ifnet *ifp) carp_carpdev_state(ifp); #endif #if NBRIDGE > 0 - if (ifp->if_bridge) + if (ifp->if_bridgeport) bstp_ifstate(ifp); #endif rt_ifmsg(ifp); @@ -1130,7 +1130,7 @@ if_up(struct ifnet *ifp) carp_carpdev_state(ifp); #endif #if NBRIDGE > 0 - if (ifp->if_bridge) + if (ifp->if_bridgeport) bstp_ifstate(ifp); #endif rt_ifmsg(ifp); diff --git a/sys/net/if.h b/sys/net/if.h index ee2d8e88a38..96303d2db84 100644 --- a/sys/net/if.h +++ b/sys/net/if.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if.h,v 1.134 2012/09/19 15:29:53 henning Exp $ */ +/* $OpenBSD: if.h,v 1.135 2012/10/05 17:17:04 camield Exp $ */ /* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */ /* @@ -270,7 +270,7 @@ struct ifnet { /* and the entries */ char if_xname[IFNAMSIZ]; /* external name (name + unit) */ int if_pcount; /* number of promiscuous listeners */ caddr_t if_bpf; /* packet filter structure */ - caddr_t if_bridge; /* bridge structure */ + caddr_t if_bridgeport; /* used by bridge ports */ caddr_t if_tp; /* used by trunk ports */ caddr_t if_pf_kif; /* pf interface abstraction */ union { diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index 54503a16dc6..72e244b9f48 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bridge.c,v 1.196 2012/09/20 14:10:18 mpf Exp $ */ +/* $OpenBSD: if_bridge.c,v 1.197 2012/10/05 17:17:04 camield Exp $ */ /* * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net) @@ -273,7 +273,7 @@ bridge_delete(struct bridge_softc *sc, struct bridge_iflist *p) if (p->bif_flags & IFBIF_STP) bstp_delete(p->bif_stp); - p->ifp->if_bridge = NULL; + p->ifp->if_bridgeport = NULL; error = ifpromisc(p->ifp, 0); LIST_REMOVE(p, next); @@ -310,11 +310,7 @@ bridge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = ENOENT; break; } - if (ifs->if_bridge == (caddr_t)sc) { - error = EEXIST; - break; - } - if (ifs->if_bridge != NULL) { + if (ifs->if_bridgeport != NULL) { error = EBUSY; break; } @@ -384,28 +380,28 @@ bridge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; } + p->bridge_sc = sc; p->ifp = ifs; p->bif_flags = IFBIF_LEARNING | IFBIF_DISCOVER; SIMPLEQ_INIT(&p->bif_brlin); SIMPLEQ_INIT(&p->bif_brlout); - ifs->if_bridge = (caddr_t)sc; + ifs->if_bridgeport = (caddr_t)p; LIST_INSERT_HEAD(&sc->sc_iflist, p, next); break; case SIOCBRDGDEL: if ((error = suser(curproc, 0)) != 0) break; - - LIST_FOREACH(p, &sc->sc_iflist, next) { - if (strncmp(p->ifp->if_xname, req->ifbr_ifsname, - sizeof(p->ifp->if_xname)) == 0) { - error = bridge_delete(sc, p); - break; - } - } - if (p == LIST_END(&sc->sc_iflist)) { + ifs = ifunit(req->ifbr_ifsname); + if (ifs == NULL) { error = ENOENT; break; } + p = (struct bridge_iflist *)ifs->if_bridgeport; + if (p == NULL || p->bridge_sc != sc) { + error = ESRCH; + break; + } + error = bridge_delete(sc, p); break; case SIOCBRDGIFS: error = bridge_bifconf(sc, (struct ifbifconf *)data); @@ -418,11 +414,7 @@ bridge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = ENOENT; break; } - if (ifs->if_bridge == (caddr_t)sc) { - error = EEXIST; - break; - } - if (ifs->if_bridge != NULL) { + if (ifs->if_bridgeport != NULL) { error = EBUSY; break; } @@ -467,15 +459,8 @@ bridge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = ENOENT; break; } - if ((caddr_t)sc != ifs->if_bridge) { - error = ESRCH; - break; - } - LIST_FOREACH(p, &sc->sc_iflist, next) { - if (p->ifp == ifs) - break; - } - if (p == LIST_END(&sc->sc_iflist)) { + p = (struct bridge_iflist *)ifs->if_bridgeport; + if (p == NULL || p->bridge_sc != sc) { error = ESRCH; break; } @@ -515,15 +500,8 @@ bridge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = ENOENT; break; } - if ((caddr_t)sc != ifs->if_bridge) { - error = ESRCH; - break; - } - LIST_FOREACH(p, &sc->sc_iflist, next) { - if (p->ifp == ifs) - break; - } - if (p == LIST_END(&sc->sc_iflist)) { + p = (struct bridge_iflist *)ifs->if_bridgeport; + if (p == NULL || p->bridge_sc != sc) { error = ESRCH; break; } @@ -561,15 +539,13 @@ bridge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) case SIOCBRDGSADDR: if ((error = suser(curproc, 0)) != 0) break; - ifs = ifunit(bareq->ifba_ifsname); if (ifs == NULL) { /* no such interface */ error = ENOENT; break; } - - if (ifs->if_bridge == NULL || - ifs->if_bridge != (caddr_t)sc) { + p = (struct bridge_iflist *)ifs->if_bridgeport; + if (p == NULL || p->bridge_sc != sc) { error = ESRCH; break; } @@ -626,16 +602,8 @@ bridge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = ENOENT; break; } - if (ifs->if_bridge == NULL || - ifs->if_bridge != (caddr_t)sc) { - error = ESRCH; - break; - } - LIST_FOREACH(p, &sc->sc_iflist, next) { - if (p->ifp == ifs) - break; - } - if (p == LIST_END(&sc->sc_iflist)) { + p = (struct bridge_iflist *)ifs->if_bridgeport; + if (p == NULL || p->bridge_sc != sc) { error = ESRCH; break; } @@ -664,16 +632,8 @@ bridge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = ENOENT; break; } - if (ifs->if_bridge == NULL || - ifs->if_bridge != (caddr_t)sc) { - error = ESRCH; - break; - } - LIST_FOREACH(p, &sc->sc_iflist, next) { - if (p->ifp == ifs) - break; - } - if (p == LIST_END(&sc->sc_iflist)) { + p = (struct bridge_iflist *)ifs->if_bridgeport; + if (p == NULL || p->bridge_sc != sc) { error = ESRCH; break; } @@ -731,51 +691,49 @@ bridge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) void bridge_ifdetach(struct ifnet *ifp) { - struct bridge_softc *sc = (struct bridge_softc *)ifp->if_bridge; + struct bridge_softc *sc; struct bridge_iflist *bif; - LIST_FOREACH(bif, &sc->sc_iflist, next) - if (bif->ifp == ifp) { - bridge_delete(sc, bif); - break; - } + bif = (struct bridge_iflist *)ifp->if_bridgeport; + sc = bif->bridge_sc; + + bridge_delete(sc, bif); } void bridge_update(struct ifnet *ifp, struct ether_addr *ea, int delete) { - struct bridge_softc *sc = (struct bridge_softc *)ifp->if_bridge; + struct bridge_softc *sc; struct bridge_iflist *bif; u_int8_t *addr; addr = (u_int8_t *)ea; - LIST_FOREACH(bif, &sc->sc_iflist, next) - if (bif->ifp == ifp) { - /* - * Update the bridge interface if it is in - * the learning state. - */ - if ((bif->bif_flags & IFBIF_LEARNING) && - (ETHER_IS_MULTICAST(addr) == 0) && - !(addr[0] == 0 && addr[1] == 0 && addr[2] == 0 && - addr[3] == 0 && addr[4] == 0 && addr[5] == 0)) { - /* Care must be taken with spanning tree */ - if ((bif->bif_flags & IFBIF_STP) && - (bif->bif_state == BSTP_IFSTATE_DISCARDING)) - return; + bif = (struct bridge_iflist *)ifp->if_bridgeport; + sc = bif->bridge_sc; - /* Delete the address from the bridge */ - bridge_rtdaddr(sc, ea); - - if (!delete) { - /* Update the bridge table */ - bridge_rtupdate(sc, ea, ifp, 0, - IFBAF_DYNAMIC); - } - } + /* + * Update the bridge interface if it is in + * the learning state. + */ + if ((bif->bif_flags & IFBIF_LEARNING) && + (ETHER_IS_MULTICAST(addr) == 0) && + !(addr[0] == 0 && addr[1] == 0 && addr[2] == 0 && + addr[3] == 0 && addr[4] == 0 && addr[5] == 0)) { + /* Care must be taken with spanning tree */ + if ((bif->bif_flags & IFBIF_STP) && + (bif->bif_state == BSTP_IFSTATE_DISCARDING)) return; + + /* Delete the address from the bridge */ + bridge_rtdaddr(sc, ea); + + if (!delete) { + /* Update the bridge table */ + bridge_rtupdate(sc, ea, ifp, 0, IFBAF_DYNAMIC); } + } + return; } int @@ -879,13 +837,8 @@ bridge_brlconf(struct bridge_softc *sc, struct ifbrlconf *bc) ifp = ifunit(bc->ifbrl_ifsname); if (ifp == NULL) return (ENOENT); - if (ifp->if_bridge == NULL || ifp->if_bridge != (caddr_t)sc) - return (ESRCH); - LIST_FOREACH(ifl, &sc->sc_iflist, next) { - if (ifl->ifp == ifp) - break; - } - if (ifl == LIST_END(&sc->sc_iflist)) + ifl = (struct bridge_iflist *)ifp->if_bridgeport; + if (ifl == NULL || ifl->bridge_sc != sc) return (ESRCH); SIMPLEQ_FOREACH(n, &ifl->bif_brlin, brl_next) { @@ -1005,11 +958,11 @@ bridge_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *sa, #endif /* IPSEC */ /* ifp must be a member interface of the bridge. */ - sc = (struct bridge_softc *)ifp->if_bridge; - if (sc == NULL) { + if (ifp->if_bridgeport == NULL) { m_freem(m); return (EINVAL); } + sc = ((struct bridge_iflist *)ifp->if_bridgeport)->bridge_sc; if (m->m_len < sizeof(*eh)) { m = m_pullup(m, sizeof(*eh)); @@ -1207,11 +1160,8 @@ bridgeintr_frame(struct bridge_softc *sc, struct mbuf *m) sc->sc_if.if_ipackets++; sc->sc_if.if_ibytes += m->m_pkthdr.len; - LIST_FOREACH(ifl, &sc->sc_iflist, next) - if (ifl->ifp == src_if) - break; - - if (ifl == LIST_END(&sc->sc_iflist)) { + ifl = (struct bridge_iflist *)src_if->if_bridgeport; + if (ifl == NULL) { m_freem(m); return; } @@ -1327,14 +1277,7 @@ bridgeintr_frame(struct bridge_softc *sc, struct mbuf *m) m_freem(m); return; } - LIST_FOREACH(ifl, &sc->sc_iflist, next) { - if (ifl->ifp == dst_if) - break; - } - if (ifl == LIST_END(&sc->sc_iflist)) { - m_freem(m); - return; - } + ifl = (struct bridge_iflist *)dst_if->if_bridgeport; if ((ifl->bif_flags & IFBIF_STP) && (ifl->bif_state == BSTP_IFSTATE_DISCARDING)) { m_freem(m); @@ -1379,7 +1322,7 @@ bridge_input(struct ifnet *ifp, struct ether_header *eh, struct mbuf *m) /* * Make sure this interface is a bridge member. */ - if (ifp == NULL || ifp->if_bridge == NULL || m == NULL) + if (ifp == NULL || ifp->if_bridgeport == NULL || m == NULL) return (m); if ((m->m_flags & M_PKTHDR) == 0) @@ -1387,17 +1330,11 @@ bridge_input(struct ifnet *ifp, struct ether_header *eh, struct mbuf *m) m->m_flags &= ~M_PROTO1; /* Loop prevention */ - sc = (struct bridge_softc *)ifp->if_bridge; + ifl = (struct bridge_iflist *)ifp->if_bridgeport; + sc = ifl->bridge_sc; if ((sc->sc_if.if_flags & IFF_RUNNING) == 0) return (m); - LIST_FOREACH(ifl, &sc->sc_iflist, next) { - if (ifl->ifp == ifp) - break; - } - if (ifl == LIST_END(&sc->sc_iflist)) - return (m); - #if NBPFILTER > 0 if (sc->sc_if.if_bpf) bpf_mtap_hdr(sc->sc_if.if_bpf, (caddr_t)eh, @@ -2000,10 +1937,11 @@ bridge_rtage(struct bridge_softc *sc) void bridge_rtagenode(struct ifnet *ifp, int age) { - struct bridge_softc *sc = (struct bridge_softc *)ifp->if_bridge; + struct bridge_softc *sc; struct bridge_rtnode *n; int i; + sc = ((struct bridge_iflist *)ifp->if_bridgeport)->bridge_sc; if (sc == NULL) return; diff --git a/sys/net/if_bridge.h b/sys/net/if_bridge.h index 68f3047b1f2..3c560ab1b61 100644 --- a/sys/net/if_bridge.h +++ b/sys/net/if_bridge.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bridge.h,v 1.35 2012/09/20 14:10:18 mpf Exp $ */ +/* $OpenBSD: if_bridge.h,v 1.36 2012/10/05 17:17:04 camield Exp $ */ /* * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net) @@ -384,6 +384,7 @@ struct bstp_state { */ struct bridge_iflist { LIST_ENTRY(bridge_iflist) next; /* next in list */ + struct bridge_softc *bridge_sc; struct bstp_port *bif_stp; /* STP port state */ struct brl_head bif_brlin; /* input rules */ struct brl_head bif_brlout; /* output rules */ @@ -392,6 +393,10 @@ struct bridge_iflist { }; #define bif_state bif_stp->bp_state +#define SAME_BRIDGE(_bp1, _bp2) \ + (_bp1 && _bp2 && ((struct bridge_iflist *)_bp1)->bridge_sc == \ + ((struct bridge_iflist *)_bp2)->bridge_sc) + /* * Bridge route node */ diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 477fd7018b5..660d9210ec5 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ethersubr.c,v 1.151 2011/07/09 00:47:18 henning Exp $ */ +/* $OpenBSD: if_ethersubr.c,v 1.152 2012/10/05 17:17:04 camield Exp $ */ /* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */ /* @@ -379,15 +379,14 @@ ether_output(ifp0, m0, dst, rt0) #if NBRIDGE > 0 /* - * Interfaces that are bridge members need special handling - * for output. + * Interfaces that are bridgeports need special handling for output. */ - if (ifp->if_bridge) { + if (ifp->if_bridgeport) { struct m_tag *mtag; /* * Check if this packet has already been sent out through - * this bridge, in which case we simply send it out + * this bridgeport, in which case we simply send it out * without further bridge processing. */ for (mtag = m_tag_find(m, PACKET_TAG_BRIDGE, NULL); mtag; @@ -399,7 +398,7 @@ ether_output(ifp0, m0, dst, rt0) goto bad; } #endif - if (!bcmp(&ifp->if_bridge, mtag + 1, sizeof(caddr_t))) + if (!bcmp(&ifp->if_bridgeport, mtag + 1, sizeof(caddr_t))) break; } if (mtag == NULL) { @@ -410,7 +409,7 @@ ether_output(ifp0, m0, dst, rt0) error = ENOBUFS; goto bad; } - bcopy(&ifp->if_bridge, mtag + 1, sizeof(caddr_t)); + bcopy(&ifp->if_bridgeport, mtag + 1, sizeof(caddr_t)); m_tag_prepend(m, mtag); error = bridge_output(ifp, m, NULL, NULL); return (error); @@ -560,7 +559,7 @@ ether_input(ifp0, eh, m) * NULL if it has consumed the packet, otherwise, it * gets processed as normal. */ - if (ifp->if_bridge) { + if (ifp->if_bridgeport) { if (m->m_flags & M_PROTO1) m->m_flags &= ~M_PROTO1; else { diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c index 5f49625041b..3407d23591f 100644 --- a/sys/net/if_gif.c +++ b/sys/net/if_gif.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_gif.c,v 1.57 2012/05/12 12:58:16 mpf Exp $ */ +/* $OpenBSD: if_gif.c,v 1.58 2012/10/05 17:17:04 camield Exp $ */ /* $KAME: if_gif.c,v 1.43 2001/02/20 08:51:07 itojun Exp $ */ /* @@ -176,7 +176,7 @@ gif_start(struct ifnet *ifp) * the start function and bypasses the if_output function * so we need to do the encap here. */ - if (ifp->if_bridge && (m->m_flags & M_PROTO1)) { + if (ifp->if_bridgeport && (m->m_flags & M_PROTO1)) { int error = 0; /* * Remove multicast and broadcast flags or encapsulated diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index fc1a5b103a5..7f9a6a8c36b 100644 --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_node.c,v 1.74 2012/09/20 17:21:13 stsp Exp $ */ +/* $OpenBSD: ieee80211_node.c,v 1.75 2012/10/05 17:17:04 camield Exp $ */ /* $NetBSD: ieee80211_node.c,v 1.14 2004/05/09 09:18:47 dyoung Exp $ */ /*- @@ -1474,10 +1474,10 @@ ieee80211_node_join(struct ieee80211com *ic, struct ieee80211_node *ni, #if NBRIDGE > 0 /* - * If the parent interface belongs to a bridge, learn + * If the parent interface is a bridgeport, learn * the node's address dynamically on this interface. */ - if (ic->ic_if.if_bridge != NULL) + if (ic->ic_if.if_bridgeport != NULL) bridge_update(&ic->ic_if, (struct ether_addr *)ni->ni_macaddr, 0); #endif @@ -1627,10 +1627,10 @@ ieee80211_node_leave(struct ieee80211com *ic, struct ieee80211_node *ni) #if NBRIDGE > 0 /* - * If the parent interface belongs to a bridge, delete + * If the parent interface is a bridgeport, delete * any dynamically learned address for this node. */ - if (ic->ic_if.if_bridge != NULL) + if (ic->ic_if.if_bridgeport != NULL) bridge_update(&ic->ic_if, (struct ether_addr *)ni->ni_macaddr, 1); #endif diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index 9dd619da153..6b591c89f1a 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ether.c,v 1.94 2012/10/05 12:30:43 camield Exp $ */ +/* $OpenBSD: if_ether.c,v 1.95 2012/10/05 17:17:04 camield Exp $ */ /* $NetBSD: if_ether.c,v 1.31 1996/05/11 12:59:58 mycroft Exp $ */ /* @@ -63,6 +63,9 @@ #if NCARP > 0 #include <netinet/ip_carp.h> #endif +#if NBRIDGE > 0 +#include <net/if_bridge.h> +#endif #define SIN(s) ((struct sockaddr_in *)s) #define SDL(s) ((struct sockaddr_dl *)s) @@ -691,12 +694,18 @@ in_arpinput(struct mbuf *m) rt->rt_expire = 1; /* no longer static */ } } - } else if (rt->rt_ifp != &ac->ac_if && !(ac->ac_if.if_bridge && - (rt->rt_ifp->if_bridge == ac->ac_if.if_bridge)) && + } else if (rt->rt_ifp != &ac->ac_if && +#if NBRIDGE > 0 + !SAME_BRIDGE(ac->ac_if.if_bridgeport, + rt->rt_ifp->if_bridgeport) && +#endif +#if NCARP > 0 !(rt->rt_ifp->if_type == IFT_CARP && rt->rt_ifp->if_carpdev == &ac->ac_if) && !(ac->ac_if.if_type == IFT_CARP && - ac->ac_if.if_carpdev == rt->rt_ifp)) { + ac->ac_if.if_carpdev == rt->rt_ifp) && +#endif + 1) { log(LOG_WARNING, "arp: attempt to add entry for %s " "on %s by %s on %s\n", diff --git a/sys/netinet/ip_ether.c b/sys/netinet/ip_ether.c index 15d91e4855c..4514bf29c0f 100644 --- a/sys/netinet/ip_ether.c +++ b/sys/netinet/ip_ether.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ether.c,v 1.60 2012/10/05 12:29:15 camield Exp $ */ +/* $OpenBSD: ip_ether.c,v 1.61 2012/10/05 17:17:04 camield Exp $ */ /* * The author of this code is Angelos D. Keromytis (kermit@adk.gr) * @@ -233,7 +233,7 @@ etherip_decap(struct mbuf *m, int iphlen) sc = etherip_getgif(m); if (sc == NULL) return; - if (sc->gif_if.if_bridge == NULL) { + if (sc->gif_if.if_bridgeport == NULL) { DPRINTF(("etherip_input(): interface not part of bridge\n")); etheripstat.etherip_noifdrops++; m_freem(m); diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 742eb7dc666..10e04519fc7 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_output.c,v 1.231 2012/09/20 10:25:03 blambert Exp $ */ +/* $OpenBSD: ip_output.c,v 1.232 2012/10/05 17:17:04 camield Exp $ */ /* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */ /* @@ -740,7 +740,7 @@ sendit: if (ntohs(ip->ip_len) <= mtu) { ip->ip_sum = 0; if ((ifp->if_capabilities & IFCAP_CSUM_IPv4) && - (ifp->if_bridge == NULL)) { + (ifp->if_bridgeport == NULL)) { m->m_pkthdr.csum_flags |= M_IPV4_CSUM_OUT; ipstat.ips_outhwcsum++; } else @@ -887,7 +887,7 @@ ip_fragment(struct mbuf *m, struct ifnet *ifp, u_long mtu) mhip->ip_sum = 0; if ((ifp != NULL) && (ifp->if_capabilities & IFCAP_CSUM_IPv4) && - (ifp->if_bridge == NULL)) { + (ifp->if_bridgeport == NULL)) { m->m_pkthdr.csum_flags |= M_IPV4_CSUM_OUT; ipstat.ips_outhwcsum++; } else @@ -907,7 +907,7 @@ ip_fragment(struct mbuf *m, struct ifnet *ifp, u_long mtu) ip->ip_sum = 0; if ((ifp != NULL) && (ifp->if_capabilities & IFCAP_CSUM_IPv4) && - (ifp->if_bridge == NULL)) { + (ifp->if_bridgeport == NULL)) { m->m_pkthdr.csum_flags |= M_IPV4_CSUM_OUT; ipstat.ips_outhwcsum++; } else @@ -2150,13 +2150,13 @@ in_proto_cksum_out(struct mbuf *m, struct ifnet *ifp) { if (m->m_pkthdr.csum_flags & M_TCP_CSUM_OUT) { if (!ifp || !(ifp->if_capabilities & IFCAP_CSUM_TCPv4) || - ifp->if_bridge != NULL) { + ifp->if_bridgeport != NULL) { in_delayed_cksum(m); m->m_pkthdr.csum_flags &= ~M_TCP_CSUM_OUT; /* Clear */ } } else if (m->m_pkthdr.csum_flags & M_UDP_CSUM_OUT) { if (!ifp || !(ifp->if_capabilities & IFCAP_CSUM_UDPv4) || - ifp->if_bridge != NULL) { + ifp->if_bridgeport != NULL) { in_delayed_cksum(m); m->m_pkthdr.csum_flags &= ~M_UDP_CSUM_OUT; /* Clear */ } diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 1eddd037f19..338e118525e 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6.c,v 1.99 2012/09/19 09:47:25 bluhm Exp $ */ +/* $OpenBSD: in6.c,v 1.100 2012/10/05 17:17:04 camield Exp $ */ /* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */ /* @@ -85,6 +85,9 @@ #include <netinet/in.h> #include <netinet/in_var.h> #include <netinet/if_ether.h> +#if NBRIDGE > 0 +#include <net/if_bridge.h> +#endif #include <netinet/ip6.h> #include <netinet6/ip6_var.h> @@ -1907,8 +1910,7 @@ in6_ifpprefix(const struct ifnet *ifp, const struct in6_addr *addr) if ((rt->rt_flags & (RTF_CLONING | RTF_CLONED)) == 0 || (rt->rt_ifp != ifp && #if NBRIDGE > 0 - (rt->rt_ifp->if_bridge == NULL || ifp->if_bridge == NULL || - rt->rt_ifp->if_bridge != ifp->if_bridge) && + !SAME_BRIDGE(rt->rt_ifp->if_bridgeport, ifp->if_bridgeport) && #endif #if NCARP > 0 (ifp->if_type != IFT_CARP || rt->rt_ifp != ifp->if_carpdev) && |