@@ -401,6 +401,7 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev)
401401#endif
402402
403403#ifdef CONFIG_IPV6_PRIVACY
404+ INIT_LIST_HEAD (& ndev -> tempaddr_list );
404405 setup_timer (& ndev -> regen_timer , ipv6_regen_rndid , (unsigned long )ndev );
405406 if ((dev -> flags & IFF_LOOPBACK ) ||
406407 dev -> type == ARPHRD_TUNNEL ||
@@ -679,8 +680,7 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen,
679680
680681#ifdef CONFIG_IPV6_PRIVACY
681682 if (ifa -> flags & IFA_F_TEMPORARY ) {
682- ifa -> tmp_next = idev -> tempaddr_list ;
683- idev -> tempaddr_list = ifa ;
683+ list_add (& ifa -> tmp_list , & idev -> tempaddr_list );
684684 in6_ifa_hold (ifa );
685685 }
686686#endif
@@ -732,19 +732,12 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp)
732732 write_lock_bh (& idev -> lock );
733733#ifdef CONFIG_IPV6_PRIVACY
734734 if (ifp -> flags & IFA_F_TEMPORARY ) {
735- for (ifap = & idev -> tempaddr_list ; (ifa = * ifap ) != NULL ;
736- ifap = & ifa -> tmp_next ) {
737- if (ifa == ifp ) {
738- * ifap = ifa -> tmp_next ;
739- if (ifp -> ifpub ) {
740- in6_ifa_put (ifp -> ifpub );
741- ifp -> ifpub = NULL ;
742- }
743- __in6_ifa_put (ifp );
744- ifa -> tmp_next = NULL ;
745- break ;
746- }
735+ list_del (& ifp -> tmp_list );
736+ if (ifp -> ifpub ) {
737+ in6_ifa_put (ifp -> ifpub );
738+ ifp -> ifpub = NULL ;
747739 }
740+ __in6_ifa_put (ifp );
748741 }
749742#endif
750743
@@ -1970,7 +1963,7 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len)
19701963#ifdef CONFIG_IPV6_PRIVACY
19711964 read_lock_bh (& in6_dev -> lock );
19721965 /* update all temporary addresses in the list */
1973- for (ift = in6_dev -> tempaddr_list ; ift ; ift = ift -> tmp_next ) {
1966+ list_for_each_entry (ift , & in6_dev -> tempaddr_list , tmp_list ) {
19741967 /*
19751968 * When adjusting the lifetimes of an existing
19761969 * temporary address, only lower the lifetimes.
@@ -2675,9 +2668,10 @@ static int addrconf_ifdown(struct net_device *dev, int how)
26752668 in6_dev_put (idev );
26762669
26772670 /* clear tempaddr list */
2678- while ((ifa = idev -> tempaddr_list ) != NULL ) {
2679- idev -> tempaddr_list = ifa -> tmp_next ;
2680- ifa -> tmp_next = NULL ;
2671+ while (!list_empty (& idev -> tempaddr_list )) {
2672+ ifa = list_first_entry (& idev -> tempaddr_list ,
2673+ struct inet6_ifaddr , tmp_list );
2674+ list_del (& ifa -> tmp_list );
26812675 ifa -> dead = 1 ;
26822676 write_unlock_bh (& idev -> lock );
26832677 spin_lock_bh (& ifa -> lock );
0 commit comments