From 22f29826756b763aca9e89b47514fc327289cd8e Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Sat, 3 Feb 2001 11:46:35 +0000 Subject: [PATCH] Use macro api rather than fondle its implementation detals. Created with: /usr/bin/sed Reviewed by: /sbin/md5 --- sys/net/bridge.c | 12 +++++----- sys/net/hostcache.c | 12 +++++----- sys/net/if.c | 56 +++++++++++++++++++++---------------------- sys/net/if_atmsubr.c | 8 +++---- sys/net/if_ef.c | 6 ++--- sys/net/if_fddisubr.c | 2 +- sys/net/if_media.c | 10 ++++---- sys/net/if_spppsubr.c | 8 +++---- sys/net/if_stf.c | 4 ++-- sys/net/if_tun.c | 8 +++---- sys/net/if_vlan.c | 12 +++++----- sys/net/pfil.c | 6 ++--- sys/net/rtsock.c | 14 +++++------ 13 files changed, 79 insertions(+), 79 deletions(-) diff --git a/sys/net/bridge.c b/sys/net/bridge.c index 2a338d5c42b7..b86ecbedf133 100644 --- a/sys/net/bridge.c +++ b/sys/net/bridge.c @@ -146,7 +146,7 @@ static void bdg_promisc_off(int clear_used) { struct ifnet *ifp ; - for (ifp = ifnet.tqh_first; ifp; ifp = ifp->if_link.tqe_next ) { + for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_link) ) { if ( (ifp2sc[ifp->if_index].flags & IFF_BDG_PROMISC) ) { int s, ret ; s = splimp(); @@ -173,7 +173,7 @@ bdg_promisc_on() struct ifnet *ifp ; int s ; - for (ifp = ifnet.tqh_first; ifp; ifp = ifp->if_link.tqe_next ) { + for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_link) ) { if ( !BDG_USED(ifp) ) continue ; if ( 0 == ( ifp->if_flags & IFF_UP) ) { @@ -457,8 +457,8 @@ bdgtakeifaces(void) *bridge_cfg = '\0'; printf("BRIDGE 010131, have %d interfaces\n", if_index); - for (i = 0 , ifp = ifnet.tqh_first ; i < if_index ; - i++, ifp = ifp->if_link.tqe_next) + for (i = 0 , ifp = TAILQ_FIRST(&ifnet) ; i < if_index ; + i++, ifp = TAILQ_NEXT(ifp, if_link)) if (ifp->if_type == IFT_ETHER) { /* ethernet ? */ bp = &ifp2sc[ifp->if_index] ; ac = (struct arpcom *)ifp; @@ -636,7 +636,7 @@ bdg_forward(struct mbuf *m0, struct ether_header *const eh, struct ifnet *dst) return m0; } if (dst == BDG_BCAST || dst == BDG_MCAST || dst == BDG_UNKNOWN) { - ifp = ifnet.tqh_first ; /* scan all ports */ + ifp = TAILQ_FIRST(&ifnet) ; /* scan all ports */ once = 0 ; if (dst != BDG_UNKNOWN) /* need a copy for the local stack */ shared = 1 ; @@ -840,7 +840,7 @@ forward: (IFF_UP|IFF_RUNNING) && BDG_SAMECLUSTER(ifp, src) && !BDG_MUTED(ifp) ) last = ifp ; - ifp = ifp->if_link.tqe_next ; + ifp = TAILQ_NEXT(ifp, if_link) ; if (ifp == NULL) once = 1 ; } diff --git a/sys/net/hostcache.c b/sys/net/hostcache.c index 0a1d4c00d912..415750c21433 100644 --- a/sys/net/hostcache.c +++ b/sys/net/hostcache.c @@ -90,8 +90,8 @@ hc_get(struct sockaddr *sa) if (hct->hct_nentries == 0) return 0; hash = hct->hct_cb->hccb_hash(sa, hct->hct_nentries); - hc = hct->hct_heads[hash].lh_first; - for (; hc; hc = hc->hc_link.le_next) { + hc = hct->hct_heads[hash]LIST_FIRST(&); + for (; hc; hc = LIST_NEXT(hc, hc_link)) { if (cmpsa(hc->hc_host, sa) == 0) break; } @@ -153,8 +153,8 @@ hc_insert(struct hcentry *hc) hct = &hctable[hc->hc_host->sa_family]; hash = hct->hct_cb->hccb_hash(hc->hc_host, hct->hct_nentries); - hc2 = hct->hct_heads[hash].lh_first; - for (; hc2; hc2 = hc2->hc_link.le_next) { + hc2 = hct->hct_heads[hash]LIST_FIRST(&); + for (; hc2; hc2 = LIST_NEXT(hc2, hc_link)) { if (cmpsa(hc2->hc_host, hc->hc_host) == 0) break; } @@ -214,8 +214,8 @@ hc_timeout(void *xhct) if (hct->hct_idle == 0) return; for (j = 0; j < hct->hct_nentries; j++) { - for (hc = hct->hct_heads[j].lh_first; hc; - hc = hc->hc_link.le_next) { + for (hc = hct->hct_heads[j]LIST_FIRST(&); hc; + hc = LIST_NEXT(hc, hc_link)) { if (hc->hc_refcnt > 0) continue; if (hc->hc_idlesince.tv_sec + hc_maxidle <= start) { diff --git a/sys/net/if.c b/sys/net/if.c index 86a7fb53ad1b..5ca3ed783dda 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -110,7 +110,7 @@ ifinit(dummy) int s; s = splimp(); - for (ifp = ifnet.tqh_first; ifp; ifp = ifp->if_link.tqe_next) { + for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_link)) { if (ifp->if_snd.ifq_maxlen == 0) { printf("%s%d XXX: driver didn't set ifq_maxlen\n", ifp->if_name, ifp->if_unit); @@ -357,9 +357,9 @@ ifa_ifwithaddr(addr) #define equal(a1, a2) \ (bcmp((caddr_t)(a1), (caddr_t)(a2), ((struct sockaddr *)(a1))->sa_len) == 0) - for (ifp = ifnet.tqh_first; ifp; ifp = ifp->if_link.tqe_next) - for (ifa = ifp->if_addrhead.tqh_first; ifa; - ifa = ifa->ifa_link.tqe_next) { + for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_link)) + for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa; + ifa = TAILQ_NEXT(ifa, ifa_link)) { if (ifa->ifa_addr->sa_family != addr->sa_family) continue; if (equal(addr, ifa->ifa_addr)) @@ -383,10 +383,10 @@ ifa_ifwithdstaddr(addr) register struct ifnet *ifp; register struct ifaddr *ifa; - for (ifp = ifnet.tqh_first; ifp; ifp = ifp->if_link.tqe_next) + for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_link)) if (ifp->if_flags & IFF_POINTOPOINT) - for (ifa = ifp->if_addrhead.tqh_first; ifa; - ifa = ifa->ifa_link.tqe_next) { + for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa; + ifa = TAILQ_NEXT(ifa, ifa_link)) { if (ifa->ifa_addr->sa_family != addr->sa_family) continue; if (ifa->ifa_dstaddr && equal(addr, ifa->ifa_dstaddr)) @@ -423,9 +423,9 @@ ifa_ifwithnet(addr) * Scan though each interface, looking for ones that have * addresses in this address family. */ - for (ifp = ifnet.tqh_first; ifp; ifp = ifp->if_link.tqe_next) { - for (ifa = ifp->if_addrhead.tqh_first; ifa; - ifa = ifa->ifa_link.tqe_next) { + for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_link)) { + for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa; + ifa = TAILQ_NEXT(ifa, ifa_link)) { register char *cp, *cp2, *cp3; if (ifa->ifa_addr->sa_family != af) @@ -510,8 +510,8 @@ ifaof_ifpforaddr(addr, ifp) if (af >= AF_MAX) return (0); - for (ifa = ifp->if_addrhead.tqh_first; ifa; - ifa = ifa->ifa_link.tqe_next) { + for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa; + ifa = TAILQ_NEXT(ifa, ifa_link)) { if (ifa->ifa_addr->sa_family != af) continue; if (ifa_maybe == 0) @@ -671,7 +671,7 @@ if_slowtimo(arg) register struct ifnet *ifp; int s = splimp(); - for (ifp = ifnet.tqh_first; ifp; ifp = ifp->if_link.tqe_next) { + for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_link)) { if (ifp->if_timer == 0 || --ifp->if_timer) continue; if (ifp->if_watchdog) @@ -719,7 +719,7 @@ ifunit(char *name) /* * Now search all the interfaces for this name/number */ - for (ifp = ifnet.tqh_first; ifp; ifp = ifp->if_link.tqe_next) { + for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_link)) { if (strcmp(ifp->if_name, namebuf)) continue; if (unit == ifp->if_unit) @@ -1060,13 +1060,13 @@ ifconf(cmd, data) caddr_t data; { register struct ifconf *ifc = (struct ifconf *)data; - register struct ifnet *ifp = ifnet.tqh_first; + register struct ifnet *ifp = TAILQ_FIRST(&ifnet); register struct ifaddr *ifa; struct ifreq ifr, *ifrp; int space = ifc->ifc_len, error = 0; ifrp = ifc->ifc_req; - for (; space > sizeof (ifr) && ifp; ifp = ifp->if_link.tqe_next) { + for (; space > sizeof (ifr) && ifp; ifp = TAILQ_NEXT(ifp, if_link)) { char workbuf[64]; int ifnlen, addrs; @@ -1080,9 +1080,9 @@ ifconf(cmd, data) } addrs = 0; - ifa = ifp->if_addrhead.tqh_first; + ifa = TAILQ_FIRST(&ifp->if_addrhead); for ( ; space > sizeof (ifr) && ifa; - ifa = ifa->ifa_link.tqe_next) { + ifa = TAILQ_NEXT(ifa, ifa_link)) { register struct sockaddr *sa = ifa->ifa_addr; if (curproc->p_prison && prison_if(curproc, sa)) continue; @@ -1186,8 +1186,8 @@ if_addmulti(ifp, sa, retifma) * If the matching multicast address already exists * then don't add a new one, just add a reference */ - for (ifma = ifp->if_multiaddrs.lh_first; ifma; - ifma = ifma->ifma_link.le_next) { + for (ifma = LIST_FIRST(&ifp->if_multiaddrs); ifma; + ifma = LIST_NEXT(ifma, ifma_link)) { if (equal(sa, ifma->ifma_addr)) { ifma->ifma_refcount++; if (retifma) @@ -1229,8 +1229,8 @@ if_addmulti(ifp, sa, retifma) *retifma = ifma; if (llsa != 0) { - for (ifma = ifp->if_multiaddrs.lh_first; ifma; - ifma = ifma->ifma_link.le_next) { + for (ifma = LIST_FIRST(&ifp->if_multiaddrs); ifma; + ifma = LIST_NEXT(ifma, ifma_link)) { if (equal(ifma->ifma_addr, llsa)) break; } @@ -1273,8 +1273,8 @@ if_delmulti(ifp, sa) struct ifmultiaddr *ifma; int s; - for (ifma = ifp->if_multiaddrs.lh_first; ifma; - ifma = ifma->ifma_link.le_next) + for (ifma = LIST_FIRST(&ifp->if_multiaddrs); ifma; + ifma = LIST_NEXT(ifma, ifma_link)) if (equal(sa, ifma->ifma_addr)) break; if (ifma == 0) @@ -1306,8 +1306,8 @@ if_delmulti(ifp, sa) * in the record for the link-layer address. (So we don't complain * in that case.) */ - for (ifma = ifp->if_multiaddrs.lh_first; ifma; - ifma = ifma->ifma_link.le_next) + for (ifma = LIST_FIRST(&ifp->if_multiaddrs); ifma; + ifma = LIST_NEXT(ifma, ifma_link)) if (equal(sa, ifma->ifma_addr)) break; if (ifma == 0) @@ -1382,8 +1382,8 @@ ifmaof_ifpforaddr(sa, ifp) { struct ifmultiaddr *ifma; - for (ifma = ifp->if_multiaddrs.lh_first; ifma; - ifma = ifma->ifma_link.le_next) + for (ifma = LIST_FIRST(&ifp->if_multiaddrs); ifma; + ifma = LIST_NEXT(ifma, ifma_link)) if (equal(ifma->ifma_addr, sa)) break; diff --git a/sys/net/if_atmsubr.c b/sys/net/if_atmsubr.c index 4d71d57a8678..423ceaa3c2cf 100644 --- a/sys/net/if_atmsubr.c +++ b/sys/net/if_atmsubr.c @@ -313,11 +313,11 @@ atm_ifattach(ifp) ifp->if_snd.ifq_maxlen = 50; /* dummy */ #if defined(__NetBSD__) || defined(__OpenBSD__) - for (ifa = ifp->if_addrlist.tqh_first; ifa != 0; - ifa = ifa->ifa_list.tqe_next) + for (ifa = TAILQ_FIRST(&ifp->if_addrlist); ifa != 0; + ifa = TAILQ_NEXT(ifa, ifa_list)) #elif defined(__FreeBSD__) && (__FreeBSD__ > 2) - for (ifa = ifp->if_addrhead.tqh_first; ifa; - ifa = ifa->ifa_link.tqe_next) + for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa; + ifa = TAILQ_NEXT(ifa, ifa_link)) #elif defined(__FreeBSD__) || defined(__bsdi__) for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next) #endif diff --git a/sys/net/if_ef.c b/sys/net/if_ef.c index d56e9c5abc0b..17b4a4086540 100644 --- a/sys/net/if_ef.c +++ b/sys/net/if_ef.c @@ -163,8 +163,8 @@ ef_detach(struct efnet *sc) if (ifp->if_flags & IFF_RUNNING) { /* find internet addresses and delete routes */ register struct ifaddr *ifa; - for (ifa = ifp->if_addrhead.tqh_first; ifa; - ifa = ifa->ifa_link.tqe_next) { + for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa; + ifa = TAILQ_NEXT(ifa, ifa_link)) { rtinit(ifa, (int)RTM_DELETE, 0); } } @@ -518,7 +518,7 @@ ef_load(void) struct ef_link *efl = NULL; int error = 0, d; - for (ifp = ifnet.tqh_first; ifp; ifp = ifp->if_link.tqe_next) { + for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_link)) { if (ifp->if_type != IFT_ETHER) continue; EFDEBUG("Found interface %s%d\n", ifp->if_name, ifp->if_unit); efl = (struct ef_link*)malloc(sizeof(struct ef_link), diff --git a/sys/net/if_fddisubr.c b/sys/net/if_fddisubr.c index b93414a25ce6..ccffc9b0da3a 100644 --- a/sys/net/if_fddisubr.c +++ b/sys/net/if_fddisubr.c @@ -537,7 +537,7 @@ fddi_ifattach(ifp) bcopy(((struct arpcom *)ifp)->ac_enaddr, LLADDR(sdl), ifp->if_addrlen); #elif defined(__NetBSD__) LIST_INIT(&((struct arpcom *)ifp)->ac_multiaddrs); - for (ifa = ifp->if_addrlist.tqh_first; ifa != NULL; ifa = ifa->ifa_list.tqe_next) + for (ifa = TAILQ_FIRST(&ifp->if_addrlist); ifa != NULL; ifa = TAILQ_NEXT(ifa, ifa_list)) #else for (ifa = ifp->if_addrlist; ifa != NULL; ifa = ifa->ifa_next) #endif diff --git a/sys/net/if_media.c b/sys/net/if_media.c index 128b92469758..3759f03ed31f 100644 --- a/sys/net/if_media.c +++ b/sys/net/if_media.c @@ -280,7 +280,7 @@ ifmedia_ioctl(ifp, ifr, ifm, cmd) (*ifm->ifm_status)(ifp, ifmr); count = 0; - ep = ifm->ifm_list.lh_first; + ep = LIST_FIRST(&ifm->ifm_list); if (ifmr->ifm_count != 0) { kptr = (int *)malloc(ifmr->ifm_count * sizeof(int), @@ -290,7 +290,7 @@ ifmedia_ioctl(ifp, ifr, ifm, cmd) * Get the media words from the interface's list. */ for (; ep != NULL && count < ifmr->ifm_count; - ep = ep->ifm_list.le_next, count++) + ep = LIST_NEXT(ep, ifm_list), count++) kptr[count] = ep->ifm_media; if (ep != NULL) @@ -303,7 +303,7 @@ ifmedia_ioctl(ifp, ifr, ifm, cmd) * to 0 on the first call to know how much space to * callocate. */ - for (; ep != NULL; ep = ep->ifm_list.le_next) + for (; ep != NULL; ep = LIST_NEXT(ep, ifm_list)) count++; /* @@ -351,8 +351,8 @@ ifmedia_match(ifm, target, mask) match = NULL; mask = ~mask; - for (next = ifm->ifm_list.lh_first; next != NULL; - next = next->ifm_list.le_next) { + for (next = LIST_FIRST(&ifm->ifm_list); next != NULL; + next = LIST_NEXT(next, ifm_list)) { if ((next->ifm_media & mask) == (target & mask)) { #if defined(IFMEDIA_DEBUG) || defined(DIAGNOSTIC) if (match) { diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c index f09271e432b0..f65ec6d6cd43 100644 --- a/sys/net/if_spppsubr.c +++ b/sys/net/if_spppsubr.c @@ -3844,9 +3844,9 @@ sppp_get_ip_addrs(struct sppp *sp, u_long *src, u_long *dst, u_long *srcmask) #if defined(__FreeBSD__) && __FreeBSD__ >= 3 TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) #elif defined(__NetBSD__) || defined (__OpenBSD__) - for (ifa = ifp->if_addrlist.tqh_first; + for (ifa = TAILQ_FIRST(&ifp->if_addrlist); ifa; - ifa = ifa->ifa_list.tqe_next) + ifa = TAILQ_NEXT(ifa, ifa_list)) #else for (ifa = ifp->if_addrlist; ifa; @@ -3892,9 +3892,9 @@ sppp_set_ip_addr(struct sppp *sp, u_long src) #if defined(__FreeBSD__) && __FreeBSD__ >= 3 TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) #elif defined(__NetBSD__) || defined (__OpenBSD__) - for (ifa = ifp->if_addrlist.tqh_first; + for (ifa = TAILQ_FIRST(&ifp->if_addrlist); ifa; - ifa = ifa->ifa_list.tqe_next) + ifa = TAILQ_NEXT(ifa, ifa_list)) #else for (ifa = ifp->if_addrlist; ifa; diff --git a/sys/net/if_stf.c b/sys/net/if_stf.c index 769e376ac0cd..d6a64958ee53 100644 --- a/sys/net/if_stf.c +++ b/sys/net/if_stf.c @@ -279,9 +279,9 @@ stf_getsrcifa6(ifp) struct sockaddr_in6 *sin6; struct in_addr in; - for (ia = ifp->if_addrlist.tqh_first; + for (ia = TAILQ_FIRST(&ifp->if_addrlist); ia; - ia = ia->ifa_list.tqe_next) + ia = TAILQ_NEXT(ia, ifa_list)) { if (ia->ifa_addr == NULL) continue; diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index a6e156192619..1df5477e3eaf 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -241,8 +241,8 @@ tunclose(dev, foo, bar, p) s = splimp(); /* find internet addresses and delete routes */ - for (ifa = ifp->if_addrhead.tqh_first; ifa; - ifa = ifa->ifa_link.tqe_next) + for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa; + ifa = TAILQ_NEXT(ifa, ifa_link)) if (ifa->ifa_addr->sa_family == AF_INET) rtinit(ifa, (int)RTM_DELETE, tp->tun_flags & TUN_DSTADDR ? RTF_HOST : 0); @@ -270,8 +270,8 @@ tuninit(ifp) ifp->if_flags |= IFF_UP | IFF_RUNNING; getmicrotime(&ifp->if_lastchange); - for (ifa = ifp->if_addrhead.tqh_first; ifa; - ifa = ifa->ifa_link.tqe_next) { + for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa; + ifa = TAILQ_NEXT(ifa, ifa_link)) { if (ifa->ifa_addr == NULL) error = EFAULT; /* XXX: Should maybe return straight off? */ diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index 5a2d88ffbff5..93f072ac67eb 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -124,8 +124,8 @@ vlan_setmulti(struct ifnet *ifp) sdl.sdl_family = AF_LINK; /* First, remove any existing filter entries. */ - while(sc->vlan_mc_listhead.slh_first != NULL) { - mc = sc->vlan_mc_listhead.slh_first; + while(SLIST_FIRST(&sc->vlan_mc_listhead) != NULL) { + mc = SLIST_FIRST(&sc->vlan_mc_listhead); bcopy((char *)&mc->mc_addr, LLADDR(&sdl), ETHER_ADDR_LEN); error = if_delmulti(ifp_p, (struct sockaddr *)&sdl); if (error) @@ -135,8 +135,8 @@ vlan_setmulti(struct ifnet *ifp) } /* Now program new ones. */ - for (ifma = ifp->if_multiaddrs.lh_first; - ifma != NULL;ifma = ifma->ifma_link.le_next) { + for (ifma = LIST_FIRST(&ifp->if_multiaddrs); + ifma != NULL;ifma = LIST_NEXT(ifma, ifma_link)) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; mc = malloc(sizeof(struct vlan_mc_entry), M_DEVBUF, M_NOWAIT); @@ -415,12 +415,12 @@ vlan_unconfig(struct ifnet *ifp) * while we were alive and remove them from the parent's list * as well. */ - while(ifv->vlan_mc_listhead.slh_first != NULL) { + while(SLIST_FIRST(&ifv->vlan_mc_listhead) != NULL) { struct sockaddr_dl sdl; sdl.sdl_len = ETHER_ADDR_LEN; sdl.sdl_family = AF_LINK; - mc = ifv->vlan_mc_listhead.slh_first; + mc = SLIST_FIRST(&ifv->vlan_mc_listhead); bcopy((char *)&mc->mc_addr, LLADDR(&sdl), ETHER_ADDR_LEN); error = if_delmulti(p, (struct sockaddr *)&sdl); error = if_delmulti(ifp, (struct sockaddr *)&sdl); diff --git a/sys/net/pfil.c b/sys/net/pfil.c index 7c10fb8125be..d4f066cf4111 100644 --- a/sys/net/pfil.c +++ b/sys/net/pfil.c @@ -150,7 +150,7 @@ pfil_list_remove(list, func) { struct packet_filter_hook *pfh; - for (pfh = list->tqh_first; pfh; pfh = pfh->pfil_link.tqe_next) + for (pfh = list->tqh_first; pfh; pfh = TAILQ_NEXT(pfh, pfil_link)) if (pfh->pfil_func == func) { TAILQ_REMOVE(list, pfh, pfil_link); free(pfh, M_IFADDR); @@ -167,9 +167,9 @@ pfil_hook_get(flag, ph) if (ph->ph_init != 0) switch (flag) { case PFIL_IN: - return (ph->ph_in.tqh_first); + return (TAILQ_FIRST(&ph->ph_in)); case PFIL_OUT: - return (ph->ph_out.tqh_first); + return (TAILQ_FIRST(&ph->ph_out)); } return NULL; } diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index d9b4b1029df3..0000c904dd7b 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -373,7 +373,7 @@ route_output(m, so) if (rtm->rtm_addrs & (RTA_IFP | RTA_IFA)) { ifp = rt->rt_ifp; if (ifp) { - ifpaddr = ifp->if_addrhead.tqh_first->ifa_addr; + ifpaddr = TAILQ_FIRST(&ifp->if_addrhead)->ifa_addr; ifaaddr = rt->rt_ifa->ifa_addr; rtm->rtm_index = ifp->if_index; } else { @@ -775,7 +775,7 @@ rt_newaddrmsg(cmd, ifa, error, rt) int ncmd = cmd == RTM_ADD ? RTM_NEWADDR : RTM_DELADDR; ifaaddr = sa = ifa->ifa_addr; - ifpaddr = ifp->if_addrhead.tqh_first->ifa_addr; + ifpaddr = TAILQ_FIRST(&ifp->if_addrhead)->ifa_addr; netmask = ifa->ifa_netmask; brdaddr = ifa->ifa_dstaddr; if ((m = rt_msg1(ncmd, &info)) == NULL) @@ -828,8 +828,8 @@ rt_newmaddrmsg(cmd, ifma) bzero((caddr_t)&info, sizeof(info)); ifaaddr = ifma->ifma_addr; - if (ifp && ifp->if_addrhead.tqh_first) - ifpaddr = ifp->if_addrhead.tqh_first->ifa_addr; + if (ifp && TAILQ_FIRST(&ifp->if_addrhead)) + ifpaddr = TAILQ_FIRST(&ifp->if_addrhead)->ifa_addr; else ifpaddr = NULL; /* @@ -893,10 +893,10 @@ sysctl_iflist(af, w) int len, error = 0; bzero((caddr_t)&info, sizeof(info)); - for (ifp = ifnet.tqh_first; ifp; ifp = ifp->if_link.tqe_next) { + for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_link)) { if (w->w_arg && w->w_arg != ifp->if_index) continue; - ifa = ifp->if_addrhead.tqh_first; + ifa = TAILQ_FIRST(&ifp->if_addrhead); ifpaddr = ifa->ifa_addr; len = rt_msg2(RTM_IFINFO, &info, (caddr_t)0, w); ifpaddr = 0; @@ -912,7 +912,7 @@ sysctl_iflist(af, w) if (error) return (error); } - while ((ifa = ifa->ifa_link.tqe_next) != 0) { + while ((ifa = TAILQ_NEXT(ifa, ifa_link)) != 0) { if (af && af != ifa->ifa_addr->sa_family) continue; if (curproc->p_prison && prison_if(curproc, ifa->ifa_addr))