diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-06-30 13:04:37 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-06-30 13:04:37 +0000 |
commit | 4239d6781953c558ebf4fa2010ff23f4630ad217 (patch) | |
tree | d710661406931ea40c38847efa1b70a1495afa74 /sys | |
parent | fd0bfbacd2b21eb3bf2543307b763fe112b060aa (diff) |
allocate sockaddr_dl for ifnet in if_alloc_sadl(), as we don't always know
the size of sockaddr_dl on if_attach() - for instance, see ether_ifattach().
from netbsd. fgs ok
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/isa/if_hp.c | 3 | ||||
-rw-r--r-- | sys/dev/pci/if_lmc.c | 3 | ||||
-rw-r--r-- | sys/dev/usb/if_upl.c | 3 | ||||
-rw-r--r-- | sys/net/if.c | 83 | ||||
-rw-r--r-- | sys/net/if.h | 5 | ||||
-rw-r--r-- | sys/net/if_arcsubr.c | 15 | ||||
-rw-r--r-- | sys/net/if_atmsubr.c | 18 | ||||
-rw-r--r-- | sys/net/if_bridge.c | 3 | ||||
-rw-r--r-- | sys/net/if_enc.c | 3 | ||||
-rw-r--r-- | sys/net/if_ethersubr.c | 20 | ||||
-rw-r--r-- | sys/net/if_faith.c | 3 | ||||
-rw-r--r-- | sys/net/if_fddisubr.c | 21 | ||||
-rw-r--r-- | sys/net/if_gif.c | 3 | ||||
-rw-r--r-- | sys/net/if_gre.c | 3 | ||||
-rw-r--r-- | sys/net/if_loop.c | 3 | ||||
-rw-r--r-- | sys/net/if_pflog.c | 3 | ||||
-rw-r--r-- | sys/net/if_ppp.c | 3 | ||||
-rw-r--r-- | sys/net/if_sl.c | 3 | ||||
-rw-r--r-- | sys/net/if_strip.c | 3 | ||||
-rw-r--r-- | sys/net/if_tokensubr.c | 15 | ||||
-rw-r--r-- | sys/net/if_tun.c | 3 |
21 files changed, 121 insertions, 98 deletions
diff --git a/sys/dev/isa/if_hp.c b/sys/dev/isa/if_hp.c index b7374534d64..3a43751ea20 100644 --- a/sys/dev/isa/if_hp.c +++ b/sys/dev/isa/if_hp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_hp.c,v 1.8 2001/06/27 06:34:46 kjc Exp $ */ +/* $OpenBSD: if_hp.c,v 1.9 2002/06/30 13:04:36 itojun Exp $ */ /* $NetBSD: if_hp.c,v 1.21 1995/12/24 02:31:31 mycroft Exp $ */ /* XXX THIS DRIVER IS BROKEN. IT WILL NOT EVEN COMPILE. */ @@ -412,6 +412,7 @@ hpattach(dvp) ifp->if_watchdog = 0; IFQ_SET_READY(&ifp->if_snd); if_attach(ifp); + if_alloc_sadl(ifp); } /* * Initialization of interface; set up initialization block diff --git a/sys/dev/pci/if_lmc.c b/sys/dev/pci/if_lmc.c index 523e6541f97..e6df0b65203 100644 --- a/sys/dev/pci/if_lmc.c +++ b/sys/dev/pci/if_lmc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_lmc.c,v 1.14 2002/06/02 22:50:00 deraadt Exp $ */ +/* $OpenBSD: if_lmc.c,v 1.15 2002/06/30 13:04:36 itojun Exp $ */ /* $NetBSD: if_lmc.c,v 1.1 1999/03/25 03:32:43 explorer Exp $ */ /*- @@ -1447,6 +1447,7 @@ lmc_attach(lmc_softc_t * const sc) #endif if_attach(ifp); + if_alloc_sadl(ifp); #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) sppp_attach((struct ifnet *)&sc->lmc_sppp); diff --git a/sys/dev/usb/if_upl.c b/sys/dev/usb/if_upl.c index 688b2fdf0d5..5dc5918343e 100644 --- a/sys/dev/usb/if_upl.c +++ b/sys/dev/usb/if_upl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_upl.c,v 1.9 2002/06/26 11:29:55 espie Exp $ */ +/* $OpenBSD: if_upl.c,v 1.10 2002/06/30 13:04:36 itojun Exp $ */ /* $NetBSD: if_upl.c,v 1.15 2001/06/14 05:44:27 itojun Exp $ */ /* * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -341,6 +341,7 @@ USB_ATTACH(upl) /* Attach the interface. */ if_attach(ifp); + if_alloc_sadl(ifp); #if NBPFILTER > 0 #if defined(__NetBSD__) || defined(__FreeBSD__) diff --git a/sys/net/if.c b/sys/net/if.c index 1bc51c16c03..df8c94bcaaa 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.61 2002/06/11 04:26:17 art Exp $ */ +/* $OpenBSD: if.c,v 1.62 2002/06/30 13:04:35 itojun Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -149,10 +149,7 @@ void if_attachsetup(ifp) struct ifnet *ifp; { - unsigned int socksize, ifasize; - int namelen, masklen; - register struct sockaddr_dl *sdl; - register struct ifaddr *ifa; + struct ifaddr *ifa; static int if_indexlim = 8; ifp->if_index = ++if_index; @@ -195,10 +192,41 @@ if_attachsetup(ifp) if (ifp->if_snd.ifq_maxlen == 0) ifp->if_snd.ifq_maxlen = ifqmaxlen; +#ifdef ALTQ + ifp->if_snd.altq_type = 0; + ifp->if_snd.altq_disc = NULL; + ifp->if_snd.altq_flags &= ALTQF_CANTCHANGE; + ifp->if_snd.altq_tbr = NULL; + ifp->if_snd.altq_ifp = ifp; +#endif + + if (domains) + if_attachdomain1(ifp); +} + +/* + * Allocate the link level name for the specified interface. This + * is an attachment helper. It must be called after ifp->if_addrlen + * is initialized, which may not be the case when if_attach() is + * called. + */ +void +if_alloc_sadl(ifp) + struct ifnet *ifp; +{ + unsigned socksize, ifasize; + int namelen, masklen; + struct sockaddr_dl *sdl; + struct ifaddr *ifa; /* - * create a Link Level name for this device + * If the interface already has a link name, release it + * now. This is useful for interfaces that can change + * link types, and thus switch link names often. */ + if (ifp->if_sadl != NULL) + if_free_sadl(ifp); + namelen = strlen(ifp->if_xname); #define _offsetof(t, m) ((int)((caddr_t)&((t *)0)->m)) masklen = _offsetof(struct sockaddr_dl, sdl_data[0]) + namelen; @@ -215,6 +243,7 @@ if_attachsetup(ifp) sdl->sdl_family = AF_LINK; bcopy(ifp->if_xname, sdl->sdl_data, namelen); sdl->sdl_nlen = namelen; + sdl->sdl_alen = ifp->if_addrlen; sdl->sdl_index = ifp->if_index; sdl->sdl_type = ifp->if_type; ifnet_addrs[if_index] = ifa; @@ -222,21 +251,38 @@ if_attachsetup(ifp) ifa->ifa_rtrequest = link_rtrequest; TAILQ_INSERT_HEAD(&ifp->if_addrlist, ifa, ifa_list); ifa->ifa_addr = (struct sockaddr *)sdl; + ifp->if_sadl = sdl; sdl = (struct sockaddr_dl *)(socksize + (caddr_t)sdl); ifa->ifa_netmask = (struct sockaddr *)sdl; sdl->sdl_len = masklen; while (namelen != 0) sdl->sdl_data[--namelen] = 0xff; -#ifdef ALTQ - ifp->if_snd.altq_type = 0; - ifp->if_snd.altq_disc = NULL; - ifp->if_snd.altq_flags &= ALTQF_CANTCHANGE; - ifp->if_snd.altq_tbr = NULL; - ifp->if_snd.altq_ifp = ifp; -#endif +} - if (domains) - if_attachdomain1(ifp); +/* + * Free the link level name for the specified interface. This is + * a detach helper. This is called from if_detach() or from + * link layer type specific detach functions. + */ +void +if_free_sadl(ifp) + struct ifnet *ifp; +{ + struct ifaddr *ifa; + int s; + + ifa = ifnet_addrs[ifp->if_index]; + if (ifa == NULL) + return; + + s = splnet(); + rtinit(ifa, RTM_DELETE, 0); + TAILQ_REMOVE(&ifp->if_addrlist, ifa, ifa_list); + + ifp->if_sadl = NULL; + + ifnet_addrs[ifp->if_index] = NULL; + splx(s); } void @@ -421,7 +467,10 @@ if_detach(ifp) /* Remove the interface from the list of all interfaces. */ TAILQ_REMOVE(&ifnet, ifp, if_list); - /* Deallocate private resources. */ + /* + * Deallocate private resources. + * XXX should consult refcnt and use IFAFREE + */ for (ifa = TAILQ_FIRST(&ifp->if_addrlist); ifa; ifa = TAILQ_FIRST(&ifp->if_addrlist)) { TAILQ_REMOVE(&ifp->if_addrlist, ifa, ifa_list); @@ -432,6 +481,8 @@ if_detach(ifp) #endif free(ifa, M_IFADDR); } + ifp->if_sadl = NULL; + ifnet_addrs[ifp->if_index] = NULL; free(ifp->if_addrhooks, M_TEMP); diff --git a/sys/net/if.h b/sys/net/if.h index f458d034e04..165a6a9e869 100644 --- a/sys/net/if.h +++ b/sys/net/if.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if.h,v 1.38 2002/06/23 23:55:04 itojun Exp $ */ +/* $OpenBSD: if.h,v 1.39 2002/06/30 13:04:35 itojun Exp $ */ /* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */ /* @@ -172,6 +172,7 @@ struct ifnet { /* and the entries */ /* timer routine */ void (*if_watchdog)(struct ifnet *); struct ifaltq if_snd; /* output queue (includes altq) */ + struct sockaddr_dl *if_sadl; /* pointer to our sockaddr_dl */ void *if_afdata[AF_MAX]; }; @@ -541,6 +542,8 @@ int ether_output(struct ifnet *, struct mbuf *, struct sockaddr *, struct rtentry *); char *ether_sprintf(u_char *); +void if_alloc_sadl(struct ifnet *); +void if_free_sadl(struct ifnet *); void if_attach(struct ifnet *); void if_attachdomain(void); void if_attachtail(struct ifnet *); diff --git a/sys/net/if_arcsubr.c b/sys/net/if_arcsubr.c index 8e2e37db2c4..fba64dab5d8 100644 --- a/sys/net/if_arcsubr.c +++ b/sys/net/if_arcsubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_arcsubr.c,v 1.10 2002/03/14 01:27:09 millert Exp $ */ +/* $OpenBSD: if_arcsubr.c,v 1.11 2002/06/30 13:04:35 itojun Exp $ */ /* $NetBSD: if_arcsubr.c,v 1.8 1996/05/07 02:40:29 thorpej Exp $ */ /* @@ -571,14 +571,7 @@ arc_ifattach(ifp) log(LOG_ERR,"%s: link address 0 reserved for broadcasts. Please change it and ifconfig %s down up\n", ifp->if_xname, ifp->if_xname); } - TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { - if ((sdl = (struct sockaddr_dl *)ifa->ifa_addr) && - sdl->sdl_family == AF_LINK) { - sdl->sdl_type = IFT_ARCNET; - sdl->sdl_alen = ifp->if_addrlen; - bcopy((caddr_t)&((struct arccom *)ifp)->ac_anaddr, - LLADDR(sdl), ifp->if_addrlen); - break; - } - } + if_alloc_sadl(ifp); + bcopy((caddr_t)&((struct arccom *)ifp)->ac_anaddr, + LLADDR(ifp->if_sadl), ifp->if_addrlen); } diff --git a/sys/net/if_atmsubr.c b/sys/net/if_atmsubr.c index 6252e1d84c2..ae0a151bd19 100644 --- a/sys/net/if_atmsubr.c +++ b/sys/net/if_atmsubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_atmsubr.c,v 1.18 2001/12/18 23:07:49 deraadt Exp $ */ +/* $OpenBSD: if_atmsubr.c,v 1.19 2002/06/30 13:04:35 itojun Exp $ */ /* * @@ -386,20 +386,8 @@ atm_ifattach(ifp) ifp->if_mtu = ATMMTU; ifp->if_output = atm_output; -#if defined(__NetBSD__) || defined(__OpenBSD__) - TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { -#elif defined(__FreeBSD__) || defined(__bsdi__) - for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next) { -#endif - - if ((sdl = (struct sockaddr_dl *)ifa->ifa_addr) && - sdl->sdl_family == AF_LINK) { - sdl->sdl_type = IFT_ATM; - sdl->sdl_alen = ifp->if_addrlen; + if_alloc_sadl(ifp); #ifdef notyet /* if using ATMARP, store hardware address using the next line */ - bcopy(ifp->hw_addr, LLADDR(sdl), ifp->if_addrlen); + bcopy(ifp->hw_addr, LLADDR(ifp->if_sadl), ifp->if_addrlen); #endif - break; - } - } } diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index a42409dddab..327cbc3a59f 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bridge.c,v 1.98 2002/06/15 05:17:18 jason Exp $ */ +/* $OpenBSD: if_bridge.c,v 1.99 2002/06/30 13:04:35 itojun Exp $ */ /* * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net) @@ -212,6 +212,7 @@ bridgeattach(n) ifp->if_snd.ifq_maxlen = ifqmaxlen; ifp->if_hdrlen = sizeof(struct ether_header); if_attach(ifp); + if_alloc_sadl(ifp); #if NBPFILTER > 0 bpfattach(&sc->sc_if.if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header)); diff --git a/sys/net/if_enc.c b/sys/net/if_enc.c index 9385d95ea85..8411f35eff5 100644 --- a/sys/net/if_enc.c +++ b/sys/net/if_enc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_enc.c,v 1.38 2002/05/29 07:54:58 itojun Exp $ */ +/* $OpenBSD: if_enc.c,v 1.39 2002/06/30 13:04:36 itojun Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -111,6 +111,7 @@ encattach(int nenc) ifp->if_snd.ifq_maxlen = ifqmaxlen; ifp->if_hdrlen = ENC_HDRLEN; if_attach(ifp); + if_alloc_sadl(ifp); #if NBPFILTER > 0 bpfattach(&encif[i].sc_if.if_bpf, ifp, DLT_ENC, ENC_HDRLEN); diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 6dd4d6dfe20..10572afca1a 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ethersubr.c,v 1.64 2002/06/10 22:48:09 chris Exp $ */ +/* $OpenBSD: if_ethersubr.c,v 1.65 2002/06/30 13:04:36 itojun Exp $ */ /* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */ /* @@ -1033,8 +1033,6 @@ void ether_ifattach(ifp) register struct ifnet *ifp; { - register struct ifaddr *ifa; - register struct sockaddr_dl *sdl; /* * Any interface which provides a MAC address which is obviously @@ -1059,16 +1057,10 @@ ether_ifattach(ifp) ifp->if_hdrlen = ETHER_HDR_LEN; ifp->if_mtu = ETHERMTU; ifp->if_output = ether_output; - TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { - if ((sdl = (struct sockaddr_dl *)ifa->ifa_addr) && - sdl->sdl_family == AF_LINK) { - sdl->sdl_type = IFT_ETHER; - sdl->sdl_alen = ifp->if_addrlen; - bcopy((caddr_t)((struct arpcom *)ifp)->ac_enaddr, - LLADDR(sdl), ifp->if_addrlen); - break; - } - } + + if_alloc_sadl(ifp); + bcopy((caddr_t)((struct arpcom *)ifp)->ac_enaddr, + LLADDR(ifp->if_sadl), ifp->if_addrlen); LIST_INIT(&((struct arpcom *)ifp)->ac_multiaddrs); #if NBPFILTER > 0 bpfattach(&ifp->if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header)); @@ -1088,6 +1080,8 @@ ether_ifdetach(ifp) LIST_REMOVE(enm, enm_list); free(enm, M_IFMADDR); } + + if_free_sadl(ifp); } #if 0 diff --git a/sys/net/if_faith.c b/sys/net/if_faith.c index a6abdbab586..f9096d9a3a6 100644 --- a/sys/net/if_faith.c +++ b/sys/net/if_faith.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_faith.c,v 1.11 2002/06/04 22:14:16 itojun Exp $ */ +/* $OpenBSD: if_faith.c,v 1.12 2002/06/30 13:04:36 itojun Exp $ */ /* * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. @@ -102,6 +102,7 @@ faithattach(faith) ifp->if_hdrlen = 0; ifp->if_addrlen = 0; if_attach(ifp); + if_alloc_sadl(ifp); #if NBPFILTER > 0 bpfattach(&ifp->if_bpf, ifp, DLT_NULL, sizeof(u_int)); #endif diff --git a/sys/net/if_fddisubr.c b/sys/net/if_fddisubr.c index 58b24027177..aa5c253f921 100644 --- a/sys/net/if_fddisubr.c +++ b/sys/net/if_fddisubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_fddisubr.c,v 1.28 2001/12/18 23:07:49 deraadt Exp $ */ +/* $OpenBSD: if_fddisubr.c,v 1.29 2002/06/30 13:04:36 itojun Exp $ */ /* $NetBSD: if_fddisubr.c,v 1.5 1996/05/07 23:20:21 christos Exp $ */ /* @@ -690,26 +690,13 @@ void fddi_ifattach(ifp) register struct ifnet *ifp; { - register struct ifaddr *ifa; - register struct sockaddr_dl *sdl; ifp->if_type = IFT_FDDI; ifp->if_addrlen = 6; ifp->if_hdrlen = 21; ifp->if_mtu = FDDIMTU; ifp->if_output = fddi_output; -#if defined(__NetBSD__) || defined(__OpenBSD__) - TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { -#else - for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next) { -#endif - if ((sdl = (struct sockaddr_dl *)ifa->ifa_addr) && - sdl->sdl_family == AF_LINK) { - sdl->sdl_type = IFT_FDDI; - sdl->sdl_alen = ifp->if_addrlen; - bcopy((caddr_t)((struct arpcom *)ifp)->ac_enaddr, - LLADDR(sdl), ifp->if_addrlen); - break; - } - } + if_alloc_sadl(ifp); + bcopy((caddr_t)((struct arpcom *)ifp)->ac_enaddr, + LLADDR(ifp->if_sadl), ifp->if_addrlen); } diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c index c218bd01812..018350d17a0 100644 --- a/sys/net/if_gif.c +++ b/sys/net/if_gif.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_gif.c,v 1.24 2002/06/10 17:33:28 itojun Exp $ */ +/* $OpenBSD: if_gif.c,v 1.25 2002/06/30 13:04:36 itojun Exp $ */ /* $KAME: if_gif.c,v 1.43 2001/02/20 08:51:07 itojun Exp $ */ /* @@ -93,6 +93,7 @@ gifattach(n) sc->gif_if.if_snd.ifq_maxlen = ifqmaxlen; sc->gif_if.if_softc = sc; if_attach(&sc->gif_if); + if_alloc_sadl(&sc->gif_if); #if NBPFILTER > 0 bpfattach(&sc->gif_if.if_bpf, &sc->gif_if, DLT_NULL, diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c index f75b207bdfe..47c5f62aba9 100644 --- a/sys/net/if_gre.c +++ b/sys/net/if_gre.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_gre.c,v 1.22 2002/06/10 23:06:55 itojun Exp $ */ +/* $OpenBSD: if_gre.c,v 1.23 2002/06/30 13:04:36 itojun Exp $ */ /* $NetBSD: if_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */ /* @@ -149,6 +149,7 @@ greattach(n) sc->sc_if.if_flags |= IFF_LINK0; if_attach(&sc->sc_if); + if_alloc_sadl(&sc->sc_if); #if NBPFILTER > 0 bpfattach(&sc->sc_if.if_bpf, &sc->sc_if, DLT_RAW, diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c index 7df89cc0f34..3f40ef0adc6 100644 --- a/sys/net/if_loop.c +++ b/sys/net/if_loop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_loop.c,v 1.23 2002/03/14 01:27:09 millert Exp $ */ +/* $OpenBSD: if_loop.c,v 1.24 2002/06/30 13:04:36 itojun Exp $ */ /* $NetBSD: if_loop.c,v 1.15 1996/05/07 02:40:33 thorpej Exp $ */ /* @@ -205,6 +205,7 @@ loopattach(n) ifp->if_start = lo_altqstart; #endif if_attachhead(ifp); + if_alloc_sadl(ifp); #if NBPFILTER > 0 bpfattach(&ifp->if_bpf, ifp, DLT_LOOP, sizeof(u_int32_t)); #endif diff --git a/sys/net/if_pflog.c b/sys/net/if_pflog.c index 04c53ae7e11..176bf6d2451 100644 --- a/sys/net/if_pflog.c +++ b/sys/net/if_pflog.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pflog.c,v 1.5 2002/05/29 07:54:58 itojun Exp $ */ +/* $OpenBSD: if_pflog.c,v 1.6 2002/06/30 13:04:36 itojun Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -100,6 +100,7 @@ pflogattach(int npflog) ifp->if_snd.ifq_maxlen = ifqmaxlen; ifp->if_hdrlen = PFLOG_HDRLEN; if_attach(ifp); + if_alloc_sadl(ifp); #if NBPFILTER > 0 bpfattach(&pflogif[i].sc_if.if_bpf, ifp, DLT_PFLOG, diff --git a/sys/net/if_ppp.c b/sys/net/if_ppp.c index c41a1e4f142..10798f37b77 100644 --- a/sys/net/if_ppp.c +++ b/sys/net/if_ppp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ppp.c,v 1.29 2002/06/19 08:48:57 deraadt Exp $ */ +/* $OpenBSD: if_ppp.c,v 1.30 2002/06/30 13:04:36 itojun Exp $ */ /* $NetBSD: if_ppp.c,v 1.39 1997/05/17 21:11:59 christos Exp $ */ /* @@ -228,6 +228,7 @@ pppattach() sc->sc_rawq.ifq_maxlen = ifqmaxlen; IFQ_SET_READY(&sc->sc_if.if_snd); if_attach(&sc->sc_if); + if_alloc_sadl(&sc->sc_if); #if NBPFILTER > 0 bpfattach(&sc->sc_bpf, &sc->sc_if, DLT_PPP, PPP_HDRLEN); #endif diff --git a/sys/net/if_sl.c b/sys/net/if_sl.c index 93e4e69cd5b..576d29dea16 100644 --- a/sys/net/if_sl.c +++ b/sys/net/if_sl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sl.c,v 1.15 2002/03/14 01:27:09 millert Exp $ */ +/* $OpenBSD: if_sl.c,v 1.16 2002/06/30 13:04:36 itojun Exp $ */ /* $NetBSD: if_sl.c,v 1.39.4.1 1996/06/02 16:26:31 thorpej Exp $ */ /* @@ -218,6 +218,7 @@ slattach(n) sc->sc_fastq.ifq_maxlen = 32; IFQ_SET_READY(&sc->sc_if.if_snd); if_attach(&sc->sc_if); + if_alloc_sadl(&sc->sc_if); #if NBPFILTER > 0 bpfattach(&sc->sc_bpf, &sc->sc_if, DLT_SLIP, SLIP_HDRLEN); #endif diff --git a/sys/net/if_strip.c b/sys/net/if_strip.c index d718c5bba23..f8bb756d243 100644 --- a/sys/net/if_strip.c +++ b/sys/net/if_strip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_strip.c,v 1.19 2002/06/24 00:17:29 itojun Exp $ */ +/* $OpenBSD: if_strip.c,v 1.20 2002/06/30 13:04:36 itojun Exp $ */ /* $NetBSD: if_strip.c,v 1.2.4.3 1996/08/03 00:58:32 jtc Exp $ */ /* from: NetBSD: if_sl.c,v 1.38 1996/02/13 22:00:23 christos Exp $ */ @@ -369,6 +369,7 @@ stripattach(n) sc->sc_if.if_timer = STRIP_WATCHDOG_INTERVAL; IFQ_SET_READY(&sc->sc_if.if_snd); if_attach(&sc->sc_if); + if_alloc_sadl(&sc->sc_if); #if NBPFILTER > 0 bpfattach(&sc->sc_bpf, &sc->sc_if, DLT_SLIP, SLIP_HDRLEN); #endif diff --git a/sys/net/if_tokensubr.c b/sys/net/if_tokensubr.c index 9c99f468cad..d3578e71ad6 100644 --- a/sys/net/if_tokensubr.c +++ b/sys/net/if_tokensubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tokensubr.c,v 1.6 2002/03/14 01:27:09 millert Exp $ */ +/* $OpenBSD: if_tokensubr.c,v 1.7 2002/06/30 13:04:36 itojun Exp $ */ /* $NetBSD: if_tokensubr.c,v 1.7 1999/05/30 00:39:07 bad Exp $ */ /* @@ -694,14 +694,7 @@ token_ifattach(ifp) #ifdef IFF_NOTRAILERS ifp->if_flags |= IFF_NOTRAILERS; #endif - TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { - if ((sdl = (struct sockaddr_dl *)ifa->ifa_addr) && - sdl->sdl_family == AF_LINK) { - sdl->sdl_type = IFT_ISO88025; - sdl->sdl_alen = ifp->if_addrlen; - bcopy((caddr_t)((struct arpcom *)ifp)->ac_enaddr, - LLADDR(sdl), ifp->if_addrlen); - break; - } - } + if_alloc_sadl(ifp); + bcopy((caddr_t)((struct arpcom *)ifp)->ac_enaddr, + LLADDR(ifp->if_sadl), ifp->if_addrlen); } diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index 3833306d27b..52c6c339ef4 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tun.c,v 1.42 2002/06/06 21:34:16 provos Exp $ */ +/* $OpenBSD: if_tun.c,v 1.43 2002/06/30 13:04:36 itojun Exp $ */ /* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */ /* @@ -152,6 +152,7 @@ tunattach(n) ifp->if_ibytes = 0; ifp->if_obytes = 0; if_attach(ifp); + if_alloc_sadl(ifp); #if NBPFILTER > 0 bpfattach(&ifp->if_bpf, ifp, DLT_LOOP, sizeof(u_int32_t)); #endif |