diff options
author | ru <ru@FreeBSD.org> | 2005-11-11 16:04:59 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2005-11-11 16:04:59 +0000 |
commit | f70f525b491a7d4a0a4f60eb7d69095f6f6e12e4 (patch) | |
tree | c961eb29eda0888de8f7fedb7d3eb12e58d687d3 /sys/net | |
parent | f82904627463e2f13912d433c5855e8bc112a3f3 (diff) | |
download | FreeBSD-src-f70f525b491a7d4a0a4f60eb7d69095f6f6e12e4.zip FreeBSD-src-f70f525b491a7d4a0a4f60eb7d69095f6f6e12e4.tar.gz |
- Store pointer to the link-level address right in "struct ifnet"
rather than in ifindex_table[]; all (except one) accesses are
through ifp anyway. IF_LLADDR() works faster, and all (except
one) ifaddr_byindex() users were converted to use ifp->if_addr.
- Stop storing a (pointer to) Ethernet address in "struct arpcom",
and drop the IFP2ENADDR() macro; all users have been converted
to use IF_LLADDR() instead.
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/if.c | 12 | ||||
-rw-r--r-- | sys/net/if_arcsubr.c | 2 | ||||
-rw-r--r-- | sys/net/if_arp.h | 2 | ||||
-rw-r--r-- | sys/net/if_bridge.c | 2 | ||||
-rw-r--r-- | sys/net/if_ef.c | 6 | ||||
-rw-r--r-- | sys/net/if_ethersubr.c | 15 | ||||
-rw-r--r-- | sys/net/if_fddisubr.c | 18 | ||||
-rw-r--r-- | sys/net/if_fwsubr.c | 2 | ||||
-rw-r--r-- | sys/net/if_iso88025subr.c | 20 | ||||
-rw-r--r-- | sys/net/if_tap.c | 4 | ||||
-rw-r--r-- | sys/net/if_var.h | 9 | ||||
-rw-r--r-- | sys/net/if_vlan.c | 2 | ||||
-rw-r--r-- | sys/net/route.c | 2 | ||||
-rw-r--r-- | sys/net/rtsock.c | 15 |
14 files changed, 46 insertions, 65 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index be7b842..e23f461 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -479,7 +479,7 @@ if_attach(struct ifnet *ifp) sdl->sdl_nlen = namelen; sdl->sdl_index = ifp->if_index; sdl->sdl_type = ifp->if_type; - ifaddr_byindex(ifp->if_index) = ifa; + ifp->if_addr = ifa; ifa->ifa_ifp = ifp; ifa->ifa_rtrequest = link_rtrequest; ifa->ifa_addr = (struct sockaddr *)sdl; @@ -598,7 +598,7 @@ if_purgeaddrs(struct ifnet *ifp) /* * Detach an interface, removing it from the - * list of "active" interfaces and freeing the struct ifnet. + * list of "active" interfaces. * * XXXRW: There are some significant questions about event ordering, and * how to prevent things from starting to use the interface during detach. @@ -653,10 +653,10 @@ if_detach(struct ifnet *ifp) in6_ifdetach(ifp); #endif /* - * Remove address from ifindex_table[] and maybe decrement if_index. + * Remove link ifaddr pointer and maybe decrement if_index. * Clean up all addresses. */ - ifaddr_byindex(ifp->if_index) = NULL; + ifp->if_addr = NULL; destroy_dev(ifdev_byindex(ifp->if_index)); ifdev_byindex(ifp->if_index) = NULL; @@ -1326,7 +1326,7 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td) ifp->if_xname, new_name); strlcpy(ifp->if_xname, new_name, sizeof(ifp->if_xname)); - ifa = ifaddr_byindex(ifp->if_index); + ifa = ifp->if_addr; IFA_LOCK(ifa); sdl = (struct sockaddr_dl *)ifa->ifa_addr; namelen = strlen(new_name); @@ -2091,7 +2091,7 @@ if_setlladdr(struct ifnet *ifp, const u_char *lladdr, int len) struct ifaddr *ifa; struct ifreq ifr; - ifa = ifaddr_byindex(ifp->if_index); + ifa = ifp->if_addr; if (ifa == NULL) return (EINVAL); sdl = (struct sockaddr_dl *)ifa->ifa_addr; diff --git a/sys/net/if_arcsubr.c b/sys/net/if_arcsubr.c index 94f6681..6cdb951 100644 --- a/sys/net/if_arcsubr.c +++ b/sys/net/if_arcsubr.c @@ -649,7 +649,7 @@ arc_ifattach(ifp, lla) #if __FreeBSD_version < 500000 ifa = ifnet_addrs[ifp->if_index - 1]; #else - ifa = ifaddr_byindex(ifp->if_index); + ifa = ifp->if_addr; #endif KASSERT(ifa != NULL, ("%s: no lladdr!\n", __func__)); sdl = (struct sockaddr_dl *)ifa->ifa_addr; diff --git a/sys/net/if_arp.h b/sys/net/if_arp.h index c9cd15f..1e18804 100644 --- a/sys/net/if_arp.h +++ b/sys/net/if_arp.h @@ -103,11 +103,9 @@ struct arpreq { */ struct arpcom { struct ifnet *ac_ifp; /* network-visible interface */ - u_char *_ac_enaddr; /* ethernet hardware address */ void *ac_netgraph; /* ng_ether(4) netgraph node info */ }; #define IFP2AC(ifp) ((struct arpcom *)(ifp->if_l2com)) -#define IFP2ENADDR(ifp) (IFP2AC(ifp)->_ac_enaddr) #define AC2IFP(ac) ((ac)->ac_ifp) #endif diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index 7090a6b..89f7420 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -1673,7 +1673,7 @@ bridge_input(struct ifnet *ifp, struct mbuf *m) eh = mtod(m, struct ether_header *); - if (memcmp(eh->ether_dhost, IFP2ENADDR(bifp), + if (memcmp(eh->ether_dhost, IF_LLADDR(bifp), ETHER_ADDR_LEN) == 0) { /* * If the packet is for us, set the packets source as the diff --git a/sys/net/if_ef.c b/sys/net/if_ef.c index 448240e..849c8db 100644 --- a/sys/net/if_ef.c +++ b/sys/net/if_ef.c @@ -126,8 +126,6 @@ static int ef_attach(struct efnet *sc) { struct ifnet *ifp = sc->ef_ifp; - struct ifaddr *ifa2; - struct sockaddr_dl *sdl2; ifp->if_start = ef_start; ifp->if_watchdog = NULL; @@ -137,9 +135,7 @@ ef_attach(struct efnet *sc) /* * Attach the interface */ - ifa2 = ifaddr_byindex(sc->ef_pifp->if_index); - sdl2 = (struct sockaddr_dl *)ifa2->ifa_addr; - ether_ifattach(ifp, LLADDR(sdl2)); + ether_ifattach(ifp, IF_LLADDR(sc->ef_pifp)); ifp->if_resolvemulti = 0; ifp->if_type = IFT_XETHER; diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 9288a7f..7cfba9a 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -282,7 +282,7 @@ ether_output(struct ifnet *ifp, struct mbuf *m, (void)memcpy(eh->ether_shost, esrc, sizeof(eh->ether_shost)); else - (void)memcpy(eh->ether_shost, IFP2ENADDR(ifp), + (void)memcpy(eh->ether_shost, IF_LLADDR(ifp), sizeof(eh->ether_shost)); /* @@ -629,7 +629,7 @@ ether_demux(struct ifnet *ifp, struct mbuf *m) /* * XXX: Okay, we need to call carp_forus() and - if it is for * us jump over code that does the normal check - * "IFP2ENADDR(ifp) == ether_dhost". The check sequence is a bit + * "IF_LLADDR(ifp) == ether_dhost". The check sequence is a bit * different from OpenBSD, so we jump over as few code as * possible, to catch _all_ sanity checks. This needs * evaluation, to see if the carp ether_dhost values break any @@ -653,7 +653,7 @@ ether_demux(struct ifnet *ifp, struct mbuf *m) if ((ifp->if_flags & IFF_PROMISC) != 0 && !ETHER_IS_MULTICAST(eh->ether_dhost) && bcmp(eh->ether_dhost, - IFP2ENADDR(ifp), ETHER_ADDR_LEN) != 0 + IF_LLADDR(ifp), ETHER_ADDR_LEN) != 0 && (ifp->if_flags & IFF_PPROMISC) == 0) { m_freem(m); return; @@ -863,13 +863,12 @@ ether_ifattach(struct ifnet *ifp, const u_int8_t *lla) ifp->if_baudrate = IF_Mbps(10); /* just a default */ ifp->if_broadcastaddr = etherbroadcastaddr; - ifa = ifaddr_byindex(ifp->if_index); + ifa = ifp->if_addr; KASSERT(ifa != NULL, ("%s: no lladdr!\n", __func__)); sdl = (struct sockaddr_dl *)ifa->ifa_addr; sdl->sdl_type = IFT_ETHER; sdl->sdl_alen = ifp->if_addrlen; bcopy(lla, LLADDR(sdl), ifp->if_addrlen); - IFP2ENADDR(ifp) = LLADDR(sdl); bpfattach(ifp, DLT_EN10MB, ETHER_HDR_LEN); if (ng_ether_attach_p != NULL) @@ -1016,10 +1015,10 @@ ether_ioctl(struct ifnet *ifp, int command, caddr_t data) if (ipx_nullhost(*ina)) ina->x_host = *(union ipx_host *) - IFP2ENADDR(ifp); + IF_LLADDR(ifp); else { bcopy((caddr_t) ina->x_host.c_host, - (caddr_t) IFP2ENADDR(ifp), + (caddr_t) IF_LLADDR(ifp), ETHER_ADDR_LEN); } @@ -1041,7 +1040,7 @@ ether_ioctl(struct ifnet *ifp, int command, caddr_t data) struct sockaddr *sa; sa = (struct sockaddr *) & ifr->ifr_data; - bcopy(IFP2ENADDR(ifp), + bcopy(IF_LLADDR(ifp), (caddr_t) sa->sa_data, ETHER_ADDR_LEN); } break; diff --git a/sys/net/if_fddisubr.c b/sys/net/if_fddisubr.c index 917ed66..d7c3e33 100644 --- a/sys/net/if_fddisubr.c +++ b/sys/net/if_fddisubr.c @@ -309,7 +309,7 @@ fddi_output(ifp, m, dst, rt0) if (hdrcmplt) bcopy((caddr_t)esrc, (caddr_t)fh->fddi_shost, FDDI_ADDR_LEN); else - bcopy(IFP2ENADDR(ifp), (caddr_t)fh->fddi_shost, + bcopy(IF_LLADDR(ifp), (caddr_t)fh->fddi_shost, FDDI_ADDR_LEN); /* @@ -420,7 +420,7 @@ fddi_input(ifp, m) * is in promiscuous mode. */ if ((ifp->if_flags & IFF_PROMISC) && ((fh->fddi_dhost[0] & 1) == 0) && - (bcmp(IFP2ENADDR(ifp), (caddr_t)fh->fddi_dhost, + (bcmp(IF_LLADDR(ifp), (caddr_t)fh->fddi_dhost, FDDI_ADDR_LEN) != 0)) goto dropanyway; @@ -579,17 +579,13 @@ fddi_ifattach(ifp, lla, bpf) #ifdef IFF_NOTRAILERS ifp->if_flags |= IFF_NOTRAILERS; #endif - ifa = ifaddr_byindex(ifp->if_index); - if (ifa == NULL) { - if_printf(ifp, "%s() no lladdr!\n", __func__); - return; - } + ifa = ifp->if_addr; + KASSERT(ifa != NULL, ("%s: no lladdr!\n", __func__)); sdl = (struct sockaddr_dl *)ifa->ifa_addr; sdl->sdl_type = IFT_FDDI; sdl->sdl_alen = ifp->if_addrlen; bcopy(lla, LLADDR(sdl), ifp->if_addrlen); - IFP2ENADDR(ifp) = LLADDR(sdl); if (bpf) bpfattach(ifp, DLT_FDDI, FDDI_HDR_LEN); @@ -647,10 +643,10 @@ fddi_ioctl (ifp, command, data) if (ipx_nullhost(*ina)) { ina->x_host = *(union ipx_host *) - IFP2ENADDR(ifp); + IF_LLADDR(ifp); } else { bcopy((caddr_t) ina->x_host.c_host, - (caddr_t) IFP2ENADDR(ifp), + (caddr_t) IF_LLADDR(ifp), ETHER_ADDR_LEN); } @@ -670,7 +666,7 @@ fddi_ioctl (ifp, command, data) struct sockaddr *sa; sa = (struct sockaddr *) & ifr->ifr_data; - bcopy(IFP2ENADDR(ifp), + bcopy(IF_LLADDR(ifp), (caddr_t) sa->sa_data, FDDI_ADDR_LEN); } diff --git a/sys/net/if_fwsubr.c b/sys/net/if_fwsubr.c index 191c4f0..3910237 100644 --- a/sys/net/if_fwsubr.c +++ b/sys/net/if_fwsubr.c @@ -766,7 +766,7 @@ firewire_ifattach(struct ifnet *ifp, struct fw_hwaddr *llc) ifp->if_resolvemulti = firewire_resolvemulti; ifp->if_broadcastaddr = (u_char *) &firewire_broadcastaddr; - ifa = ifaddr_byindex(ifp->if_index); + ifa = ifp->if_addr; KASSERT(ifa != NULL, ("%s: no lladdr!\n", __func__)); sdl = (struct sockaddr_dl *)ifa->ifa_addr; sdl->sdl_type = IFT_IEEE1394; diff --git a/sys/net/if_iso88025subr.c b/sys/net/if_iso88025subr.c index d78de12..5d5a3a2 100644 --- a/sys/net/if_iso88025subr.c +++ b/sys/net/if_iso88025subr.c @@ -114,17 +114,13 @@ iso88025_ifattach(struct ifnet *ifp, const u_int8_t *lla, int bpf) if (ifp->if_mtu == 0) ifp->if_mtu = ISO88025_DEFAULT_MTU; - ifa = ifaddr_byindex(ifp->if_index); - if (ifa == 0) { - if_printf(ifp, "%s() no lladdr!\n", __func__); - return; - } + ifa = ifp->if_addr; + KASSERT(ifa != NULL, ("%s: no lladdr!\n", __func__)); sdl = (struct sockaddr_dl *)ifa->ifa_addr; sdl->sdl_type = IFT_ISO88025; sdl->sdl_alen = ifp->if_addrlen; bcopy(lla, LLADDR(sdl), ifp->if_addrlen); - IFP2ENADDR(ifp) = LLADDR(sdl); if (bpf) bpfattach(ifp, DLT_IEEE802, ISO88025_HDR_LEN); @@ -182,10 +178,10 @@ iso88025_ioctl(struct ifnet *ifp, int command, caddr_t data) if (ipx_nullhost(*ina)) ina->x_host = *(union ipx_host *) - IFP2ENADDR(ifp); + IF_LLADDR(ifp); else bcopy((caddr_t) ina->x_host.c_host, - (caddr_t) IFP2ENADDR(ifp), + (caddr_t) IF_LLADDR(ifp), ISO88025_ADDR_LEN); /* @@ -205,7 +201,7 @@ iso88025_ioctl(struct ifnet *ifp, int command, caddr_t data) struct sockaddr *sa; sa = (struct sockaddr *) & ifr->ifr_data; - bcopy(IFP2ENADDR(ifp), + bcopy(IF_LLADDR(ifp), (caddr_t) sa->sa_data, ISO88025_ADDR_LEN); } break; @@ -275,7 +271,7 @@ iso88025_output(ifp, m, dst, rt0) /* Generate a generic 802.5 header for the packet */ gen_th.ac = TR_AC; gen_th.fc = TR_LLC_FRAME; - (void)memcpy((caddr_t)gen_th.iso88025_shost, IFP2ENADDR(ifp), + (void)memcpy((caddr_t)gen_th.iso88025_shost, IF_LLADDR(ifp), ISO88025_ADDR_LEN); if (rif_len) { gen_th.iso88025_shost[0] |= TR_RII; @@ -521,7 +517,7 @@ iso88025_input(ifp, m) */ if ((ifp->if_flags & IFF_PROMISC) && ((th->iso88025_dhost[0] & 1) == 0) && - (bcmp(IFP2ENADDR(ifp), (caddr_t) th->iso88025_dhost, + (bcmp(IF_LLADDR(ifp), (caddr_t) th->iso88025_dhost, ISO88025_ADDR_LEN) != 0)) goto dropanyway; @@ -651,7 +647,7 @@ iso88025_input(ifp, m) l->llc_dsap = l->llc_ssap; l->llc_ssap = c; if (m->m_flags & (M_BCAST | M_MCAST)) - bcopy((caddr_t)IFP2ENADDR(ifp), + bcopy((caddr_t)IF_LLADDR(ifp), (caddr_t)th->iso88025_dhost, ISO88025_ADDR_LEN); sa.sa_family = AF_UNSPEC; diff --git a/sys/net/if_tap.c b/sys/net/if_tap.c index 4e1b727..66c4a92 100644 --- a/sys/net/if_tap.c +++ b/sys/net/if_tap.c @@ -60,7 +60,7 @@ #include <net/bpf.h> #include <net/ethernet.h> #include <net/if.h> -#include <net/if_arp.h> +#include <net/if_dl.h> #include <net/route.h> #include <net/if_types.h> @@ -386,7 +386,7 @@ tapopen(dev, flag, mode, td) return (EBUSY); } - bcopy(IFP2ENADDR(tp->tap_ifp), tp->ether_addr, sizeof(tp->ether_addr)); + bcopy(IF_LLADDR(tp->tap_ifp), tp->ether_addr, sizeof(tp->ether_addr)); tp->tap_pid = td->td_proc->p_pid; tp->tap_flags |= TAP_OPEN; ifp = tp->tap_ifp; diff --git a/sys/net/if_var.h b/sys/net/if_var.h index b09319f..afd014a 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -125,7 +125,7 @@ struct ifnet { * addresses which store the link-level address and the name * of the interface. * However, access to the AF_LINK address through this - * field is deprecated. Use ifaddr_byindex() instead. + * field is deprecated. Use if_addr or ifaddr_byindex() instead. */ struct knlist if_klist; /* events attached to this if */ int if_pcount; /* number of promiscuous listeners */ @@ -158,7 +158,7 @@ struct ifnet { (void *); int (*if_resolvemulti) /* validate/resolve multicast */ (struct ifnet *, struct sockaddr **, struct sockaddr *); - void *if_spare1; /* spare pointer 1 */ + struct ifaddr *if_addr; /* pointer to link-level address */ void *if_spare2; /* spare pointer 2 */ void *if_spare3; /* spare pointer 3 */ int if_drv_flags; /* driver-managed status flags */ @@ -605,7 +605,6 @@ extern struct mtx ifnet_lock; struct ifindex_entry { struct ifnet *ife_ifnet; - struct ifaddr *ife_ifnet_addr; struct cdev *ife_dev; }; @@ -615,7 +614,7 @@ struct ifindex_entry { * link-level ifaddr for the interface. You are not supposed to use * it to traverse the list of addresses associated to the interface. */ -#define ifaddr_byindex(idx) ifindex_table[(idx)].ife_ifnet_addr +#define ifaddr_byindex(idx) ifnet_byindex(idx)->if_addr #define ifdev_byindex(idx) ifindex_table[(idx)].ife_dev extern struct ifnethead ifnet; @@ -658,7 +657,7 @@ void if_register_com_alloc(u_char type, if_com_alloc_t *a, if_com_free_t *f); void if_deregister_com_alloc(u_char type); #define IF_LLADDR(ifp) \ - LLADDR((struct sockaddr_dl *) ifaddr_byindex((ifp)->if_index)->ifa_addr) + LLADDR((struct sockaddr_dl *)((ifp)->if_addr->ifa_addr)) #ifdef DEVICE_POLLING enum poll_cmd { POLL_ONLY, POLL_AND_CHECK_STATUS }; diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index e0377e2..89471cf 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -907,7 +907,7 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) struct sockaddr *sa; sa = (struct sockaddr *) &ifr->ifr_data; - bcopy(IFP2ENADDR(ifp), (caddr_t)sa->sa_data, + bcopy(IF_LLADDR(ifp), (caddr_t)sa->sa_data, ETHER_ADDR_LEN); } break; diff --git a/sys/net/route.c b/sys/net/route.c index 6fc33f2..94d6c24 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -188,7 +188,7 @@ rtalloc1(struct sockaddr *dst, int report, u_long ignflags) info.rti_info[RTAX_GATEWAY] = newrt->rt_gateway; if (newrt->rt_ifp != NULL) { info.rti_info[RTAX_IFP] = - ifaddr_byindex(newrt->rt_ifp->if_index)->ifa_addr; + newrt->rt_ifp->if_addr->ifa_addr; info.rti_info[RTAX_IFA] = newrt->rt_ifa->ifa_addr; } rt_missmsg(RTM_ADD, &info, newrt->rt_flags, 0); diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 641a796..f0a978d 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -444,7 +444,7 @@ route_output(struct mbuf *m, struct socket *so) ifp = rt->rt_ifp; if (ifp) { info.rti_info[RTAX_IFP] = - ifaddr_byindex(ifp->if_index)->ifa_addr; + ifp->if_addr->ifa_addr; if (jailed(so->so_cred)) { bzero(&jail, sizeof(jail)); jail.sin_family = PF_INET; @@ -873,8 +873,7 @@ rt_newaddrmsg(int cmd, struct ifaddr *ifa, int error, struct rtentry *rt) int ncmd = cmd == RTM_ADD ? RTM_NEWADDR : RTM_DELADDR; info.rti_info[RTAX_IFA] = sa = ifa->ifa_addr; - info.rti_info[RTAX_IFP] = - ifaddr_byindex(ifp->if_index)->ifa_addr; + info.rti_info[RTAX_IFP] = ifp->if_addr->ifa_addr; info.rti_info[RTAX_NETMASK] = ifa->ifa_netmask; info.rti_info[RTAX_BRD] = ifa->ifa_dstaddr; if ((m = rt_msg1(ncmd, &info)) == NULL) @@ -924,8 +923,7 @@ rt_newmaddrmsg(int cmd, struct ifmultiaddr *ifma) bzero((caddr_t)&info, sizeof(info)); info.rti_info[RTAX_IFA] = ifma->ifma_addr; - info.rti_info[RTAX_IFP] = - ifp ? ifaddr_byindex(ifp->if_index)->ifa_addr : NULL; + info.rti_info[RTAX_IFP] = ifp ? ifp->if_addr->ifa_addr : NULL; /* * If a link-layer address is present, present it as a ``gateway'' * (similarly to how ARP entries, e.g., are presented). @@ -1058,8 +1056,7 @@ sysctl_dumpentry(struct radix_node *rn, void *vw) info.rti_info[RTAX_NETMASK] = rt_mask(rt); info.rti_info[RTAX_GENMASK] = rt->rt_genmask; if (rt->rt_ifp) { - info.rti_info[RTAX_IFP] = - ifaddr_byindex(rt->rt_ifp->if_index)->ifa_addr; + info.rti_info[RTAX_IFP] = rt->rt_ifp->if_addr->ifa_addr; info.rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr; if (rt->rt_ifp->if_flags & IFF_POINTOPOINT) info.rti_info[RTAX_BRD] = rt->rt_ifa->ifa_dstaddr; @@ -1093,7 +1090,7 @@ sysctl_iflist(int af, struct walkarg *w) TAILQ_FOREACH(ifp, &ifnet, if_link) { if (w->w_arg && w->w_arg != ifp->if_index) continue; - ifa = ifaddr_byindex(ifp->if_index); + ifa = ifp->if_addr; info.rti_info[RTAX_IFP] = ifa->ifa_addr; len = rt_msg2(RTM_IFINFO, &info, NULL, w); info.rti_info[RTAX_IFP] = NULL; @@ -1154,7 +1151,7 @@ sysctl_ifmalist(int af, struct walkarg *w) TAILQ_FOREACH(ifp, &ifnet, if_link) { if (w->w_arg && w->w_arg != ifp->if_index) continue; - ifa = ifaddr_byindex(ifp->if_index); + ifa = ifp->if_addr; info.rti_info[RTAX_IFP] = ifa ? ifa->ifa_addr : NULL; IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { |