diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2005-10-09 19:44:23 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2005-10-09 19:44:23 +0000 |
commit | 4ceabd5ebb41f8cdb18b7d287bc05eb2e7869616 (patch) | |
tree | 584e400fdcd01704067e977d3f7d1443246ae576 /sys/net | |
parent | 74b417e51569cd7081db227132f312f06a31f2ef (diff) |
if the wireless hostap interface belongs to a bridge, learn the node's
address dynamically on this interface after successful association.
this could speed wireless roaming to openbsd accesspoints.
ok jason@, jsg@ can't see anything obectionable
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/if_bridge.c | 41 | ||||
-rw-r--r-- | sys/net/if_bridge.h | 3 |
2 files changed, 42 insertions, 2 deletions
diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index 7510ec5842c..ef434bc4e05 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bridge.c,v 1.145 2005/07/31 03:30:55 pascoe Exp $ */ +/* $OpenBSD: if_bridge.c,v 1.146 2005/10/09 19:44:22 reyk Exp $ */ /* * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net) @@ -715,6 +715,45 @@ bridge_ifdetach(struct ifnet *ifp) } } +void +bridge_update(struct ifnet *ifp, struct ether_addr *ea, int delete) +{ + struct bridge_softc *sc = (struct bridge_softc *)ifp->if_bridge; + 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_BLOCKING || + bif->bif_state == BSTP_IFSTATE_LISTENING || + bif->bif_state == BSTP_IFSTATE_DISABLED)) + 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 bridge_bifconf(struct bridge_softc *sc, struct ifbifconf *bifc) { diff --git a/sys/net/if_bridge.h b/sys/net/if_bridge.h index 686d8ef60bf..f764cf5e157 100644 --- a/sys/net/if_bridge.h +++ b/sys/net/if_bridge.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bridge.h,v 1.27 2004/12/23 09:32:55 camield Exp $ */ +/* $OpenBSD: if_bridge.h,v 1.28 2005/10/09 19:44:22 reyk Exp $ */ /* * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net) @@ -277,6 +277,7 @@ struct mbuf *bridge_input(struct ifnet *, struct ether_header *, struct mbuf *); int bridge_output(struct ifnet *, struct mbuf *, struct sockaddr *, struct rtentry *); +void bridge_update(struct ifnet *, struct ether_addr *, int); struct mbuf *bstp_input(struct bridge_softc *, struct ifnet *, struct ether_header *, struct mbuf *); void bstp_initialization(struct bridge_softc *); |