diff options
author | nsayer <nsayer@FreeBSD.org> | 2000-07-29 02:00:12 +0000 |
---|---|---|
committer | nsayer <nsayer@FreeBSD.org> | 2000-07-29 02:00:12 +0000 |
commit | 7d8d00c3047a02b73da59dbc9a3be797f0c95dd1 (patch) | |
tree | 620109caf8be642c8a0b716639cddea4c81c6f8c /sys | |
parent | ff7cd1f740ee1407a8d43cd48cdf11f4b5781762 (diff) | |
download | FreeBSD-src-7d8d00c3047a02b73da59dbc9a3be797f0c95dd1.zip FreeBSD-src-7d8d00c3047a02b73da59dbc9a3be797f0c95dd1.tar.gz |
Make the bridge_refresh operation automatic when ethernet interfaces
are attached or detached.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/bridge.c | 7 | ||||
-rw-r--r-- | sys/net/bridge.h | 2 | ||||
-rw-r--r-- | sys/net/if_ethersubr.c | 6 |
3 files changed, 14 insertions, 1 deletions
diff --git a/sys/net/bridge.c b/sys/net/bridge.c index 5eb86ce..ec9aada 100644 --- a/sys/net/bridge.c +++ b/sys/net/bridge.c @@ -118,11 +118,12 @@ #define DEB(x) static void bdginit(void *); -static void bdgtakeifaces(void); static void flush_table(void); static void bdg_promisc_on(void); static void parse_bdg_cfg(void); +static int bdg_initialized = 0; + static int bdg_ipfw = 0 ; int do_bridge = 0; bdg_hash_table *bdg_table = NULL ; @@ -434,6 +435,7 @@ static void bdginit(void *dummy) { + bdg_initialized++; if (bdg_table == NULL) bdg_table = (struct hash_table *) malloc(HASH_SIZE * sizeof(struct hash_table), @@ -459,6 +461,9 @@ bdgtakeifaces(void) u_char *eth_addr ; struct bdg_softc *bp; + if (!bdg_initialized) + return; + bdg_ports = 0 ; eth_addr = bdg_addresses ; *bridge_cfg = '\0'; diff --git a/sys/net/bridge.h b/sys/net/bridge.h index ea2db41..246bb87 100644 --- a/sys/net/bridge.h +++ b/sys/net/bridge.h @@ -41,6 +41,8 @@ extern bdg_hash_table *bdg_table ; extern unsigned char bdg_addresses[6*BDG_MAX_PORTS]; extern int bdg_ports ; +extern void bdgtakeifaces(void); + /* * out of the 6 bytes, the last ones are more "variable". Since * we are on a little endian machine, we have to do some gimmick... diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index d7c410b..e8cfa0d 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -671,6 +671,9 @@ ether_ifattach(ifp, bpf) bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header)); if (ng_ether_attach_p != NULL) (*ng_ether_attach_p)(ifp); +#ifdef BRIDGE + bdgtakeifaces(); +#endif } /* @@ -686,6 +689,9 @@ ether_ifdetach(ifp, bpf) if (bpf) bpfdetach(ifp); if_detach(ifp); +#ifdef BRIDGE + bdgtakeifaces(); +#endif } SYSCTL_DECL(_net_link); |