diff options
| author | Garrett Wollman <wollman@FreeBSD.org> | 1996-12-13 21:29:07 +0000 |
|---|---|---|
| committer | Garrett Wollman <wollman@FreeBSD.org> | 1996-12-13 21:29:07 +0000 |
| commit | 59562606b9d3a958fa83ee8eb41ebc8da8ac6f73 (patch) | |
| tree | 782c07e423375f5e3235e7a677261301a91e59c6 /sys/netatalk | |
| parent | f8a459d38513faf811e3b523f5a8ee0de2becda3 (diff) | |
Notes
Diffstat (limited to 'sys/netatalk')
| -rw-r--r-- | sys/netatalk/aarp.c | 27 | ||||
| -rw-r--r-- | sys/netatalk/at_control.c | 35 | ||||
| -rw-r--r-- | sys/netatalk/at_extern.h | 2 |
3 files changed, 23 insertions, 41 deletions
diff --git a/sys/netatalk/aarp.c b/sys/netatalk/aarp.c index 1d7e029f8679..d81d1774bc08 100644 --- a/sys/netatalk/aarp.c +++ b/sys/netatalk/aarp.c @@ -95,14 +95,15 @@ aarptimer(void *ignored) * consideration. */ struct ifaddr * -at_ifawithnet( sat, ifa ) +at_ifawithnet( sat, ifah ) struct sockaddr_at *sat; - struct ifaddr *ifa; + struct ifaddrhead *ifah; { struct sockaddr_at *sat2; struct netrange *nr; + struct ifaddr *ifa; - for (; ifa; ifa = ifa->ifa_next ) { + for (ifa = ifah->tqh_first; ifa; ifa = ifa->ifa_link.tqe_next ) { if ( ifa->ifa_addr->sa_family != AF_APPLETALK ) { continue; } @@ -155,8 +156,8 @@ aarpwhohas( struct arpcom *ac, struct sockaddr_at *sat ) * interface with the same address as we're looking for. If the * net is phase 2, generate an 802.2 and SNAP header. */ - if (( aa = (struct at_ifaddr *)at_ifawithnet( sat, ac->ac_if.if_addrlist )) - == NULL ) { + if ((aa = (struct at_ifaddr *)at_ifawithnet(sat, &ac->ac_if.if_addrhead)) + == NULL) { m_freem( m ); return; } @@ -213,8 +214,8 @@ aarpresolve( ac, m, destsat, desten ) int s; if ( at_broadcast( destsat )) { - if (( aa = (struct at_ifaddr *)at_ifawithnet( destsat, - ((struct ifnet *)ac)->if_addrlist )) == NULL ) { + if ((aa = (struct at_ifaddr *)at_ifawithnet(destsat, + &((struct ifnet *)ac)->if_addrhead)) == NULL) { m_freem( m ); return( 0 ); } @@ -325,8 +326,8 @@ at_aarpinput( struct arpcom *ac, struct mbuf *m) sat.sat_len = sizeof(struct sockaddr_at); sat.sat_family = AF_APPLETALK; sat.sat_addr.s_net = net; - if (( aa = (struct at_ifaddr *)at_ifawithnet( &sat, - ac->ac_if.if_addrlist )) == NULL ) { + if ((aa = (struct at_ifaddr *)at_ifawithnet(&sat, + &ac->ac_if.if_addrhead)) == NULL) { m_freem( m ); return; } @@ -337,8 +338,8 @@ at_aarpinput( struct arpcom *ac, struct mbuf *m) * Since we don't know the net, we just look for the first * phase 1 address on the interface. */ - for ( aa = (struct at_ifaddr *)ac->ac_if.if_addrlist; aa; - aa = (struct at_ifaddr *)aa->aa_ifa.ifa_next ) { + for (aa = (struct at_ifaddr *)ac->ac_if.if_addrhead.tqh_first; aa; + aa = (struct at_ifaddr *)aa->aa_ifa.ifa_link.tqe_next) { if ( AA_SAT( aa )->sat_family == AF_APPLETALK && ( aa->aa_flags & AFA_PHASE2 ) == 0 ) { break; @@ -533,8 +534,8 @@ aarpprobe( struct arpcom *ac ) * interface with the same address as we're looking for. If the * net is phase 2, generate an 802.2 and SNAP header. */ - for ( aa = (struct at_ifaddr *)ac->ac_if.if_addrlist; aa; - aa = (struct at_ifaddr *)aa->aa_ifa.ifa_next ) { + for (aa = (struct at_ifaddr *)ac->ac_if.if_addrhead.tqh_first; aa; + aa = (struct at_ifaddr *)aa->aa_ifa.ifa_link.tqe_next) { if ( AA_SAT( aa )->sat_family == AF_APPLETALK && ( aa->aa_flags & AFA_PROBING )) { break; diff --git a/sys/netatalk/at_control.c b/sys/netatalk/at_control.c index 65608b72815d..4d8f8faf3b9e 100644 --- a/sys/netatalk/at_control.c +++ b/sys/netatalk/at_control.c @@ -173,25 +173,21 @@ at_control( int cmd, caddr_t data, struct ifnet *ifp, struct proc *p ) * Find the end of the interface's addresses * and link our new one on the end */ - if (( ifa = ifp->if_addrlist ) != NULL ) { - for ( ; ifa->ifa_next; ifa = ifa->ifa_next ) - ; - ifa->ifa_next = (struct ifaddr *)aa; - } else { - ifp->if_addrlist = (struct ifaddr *)aa; - } + ifa = (struct ifaddr *)aa; + TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link); + /* * Add a reference for the linking into the ifp_if_addrlist. */ - aa->aa_ifa.ifa_refcnt++; + ifa->ifa_refcnt++; /* * As the at_ifaddr contains the actual sockaddrs, * and the ifaddr itself, link them al together correctly. */ - aa->aa_ifa.ifa_addr = (struct sockaddr *)&aa->aa_addr; - aa->aa_ifa.ifa_dstaddr = (struct sockaddr *)&aa->aa_addr; - aa->aa_ifa.ifa_netmask = (struct sockaddr *)&aa->aa_netmask; + ifa->ifa_addr = (struct sockaddr *)&aa->aa_addr; + ifa->ifa_dstaddr = (struct sockaddr *)&aa->aa_addr; + ifa->ifa_netmask = (struct sockaddr *)&aa->aa_netmask; /* * Set/clear the phase 2 bit. @@ -285,23 +281,8 @@ at_control( int cmd, caddr_t data, struct ifnet *ifp, struct proc *p ) * remove the ifaddr from the interface */ ifa0 = (struct ifaddr *)aa; - if (( ifa = ifp->if_addrlist ) == ifa0 ) { - ifp->if_addrlist = ifa->ifa_next; - } else { - while ( ifa->ifa_next && ( ifa->ifa_next != ifa0 )) { - ifa = ifa->ifa_next; - } + TAILQ_REMOVE(&ifp->if_addrhead, ifa0, ifa_link); - /* - * if we found it, remove it, otherwise we screwed up. - * decrement the reference count by one. - */ - if ( ifa->ifa_next ) { - ifa = ifa->ifa_next = ifa0->ifa_next; - } else { - panic( "at_control" ); - } - } /* * refs goes from 1->0 if no external refs. note.. * This will not free it ... looks for -1. diff --git a/sys/netatalk/at_extern.h b/sys/netatalk/at_extern.h index 18badf4fa21b..bed1022c4a1d 100644 --- a/sys/netatalk/at_extern.h +++ b/sys/netatalk/at_extern.h @@ -25,7 +25,7 @@ extern int ddp_usrreq __P(( struct socket *so, int req, struct mbuf *rights)); extern void ddp_init __P((void )); extern struct ifaddr *at_ifawithnet __P((struct sockaddr_at *, - struct ifaddr *)); + struct ifaddrhead *)); #ifdef _NETATALK_DDP_VAR_H_ extern int ddp_output __P(( struct ddpcb *ddp, struct mbuf *m)); #endif |
