Make the bridge_refresh operation automatic when ethernet interfaces
are attached or detached.
This commit is contained in:
parent
73c9daf94f
commit
82902fa3d8
@ -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';
|
||||
|
@ -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...
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user