diff options
| author | Archie Cobbs <archie@FreeBSD.org> | 2000-07-13 22:54:34 +0000 |
|---|---|---|
| committer | Archie Cobbs <archie@FreeBSD.org> | 2000-07-13 22:54:34 +0000 |
| commit | 21b8ebd926583116aa2cfe13371539035c4c8249 (patch) | |
| tree | 9138788c579d4f5d51cd1a679899f325a789cb7e /sys/net/if_ethersubr.c | |
| parent | 4a19005c4897cb2bddd9f1d0a184e503c15e23bf (diff) | |
Notes
Diffstat (limited to 'sys/net/if_ethersubr.c')
| -rw-r--r-- | sys/net/if_ethersubr.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 7ae976e0f65c..d7c410b0c814 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -646,12 +646,14 @@ ether_demux(ifp, eh, m) * Perform common duties while attaching to interface list */ void -ether_ifattach(ifp) +ether_ifattach(ifp, bpf) register struct ifnet *ifp; + int bpf; { register struct ifaddr *ifa; register struct sockaddr_dl *sdl; + if_attach(ifp); ifp->if_type = IFT_ETHER; ifp->if_addrlen = 6; ifp->if_hdrlen = 14; @@ -660,18 +662,32 @@ ether_ifattach(ifp) if (ifp->if_baudrate == 0) ifp->if_baudrate = 10000000; ifa = ifnet_addrs[ifp->if_index - 1]; - if (ifa == 0) { - printf("ether_ifattach: no lladdr!\n"); - return; - } + KASSERT(ifa != NULL, ("%s: no lladdr!\n", __FUNCTION__)); sdl = (struct sockaddr_dl *)ifa->ifa_addr; sdl->sdl_type = IFT_ETHER; sdl->sdl_alen = ifp->if_addrlen; bcopy((IFP2AC(ifp))->ac_enaddr, LLADDR(sdl), ifp->if_addrlen); + if (bpf) + bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header)); if (ng_ether_attach_p != NULL) (*ng_ether_attach_p)(ifp); } +/* + * Perform common duties while detaching an Ethernet interface + */ +void +ether_ifdetach(ifp, bpf) + struct ifnet *ifp; + int bpf; +{ + if (ng_ether_detach_p != NULL) + (*ng_ether_detach_p)(ifp); + if (bpf) + bpfdetach(ifp); + if_detach(ifp); +} + SYSCTL_DECL(_net_link); SYSCTL_NODE(_net_link, IFT_ETHER, ether, CTLFLAG_RW, 0, "Ethernet"); |
