@@ -401,6 +401,7 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev)
401
401
#endif
402
402
403
403
#ifdef CONFIG_IPV6_PRIVACY
404
+ INIT_LIST_HEAD (& ndev -> tempaddr_list );
404
405
setup_timer (& ndev -> regen_timer , ipv6_regen_rndid , (unsigned long )ndev );
405
406
if ((dev -> flags & IFF_LOOPBACK ) ||
406
407
dev -> type == ARPHRD_TUNNEL ||
@@ -679,8 +680,7 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen,
679
680
680
681
#ifdef CONFIG_IPV6_PRIVACY
681
682
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 );
684
684
in6_ifa_hold (ifa );
685
685
}
686
686
#endif
@@ -732,19 +732,12 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp)
732
732
write_lock_bh (& idev -> lock );
733
733
#ifdef CONFIG_IPV6_PRIVACY
734
734
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 ;
747
739
}
740
+ __in6_ifa_put (ifp );
748
741
}
749
742
#endif
750
743
@@ -1970,7 +1963,7 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len)
1970
1963
#ifdef CONFIG_IPV6_PRIVACY
1971
1964
read_lock_bh (& in6_dev -> lock );
1972
1965
/* 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 ) {
1974
1967
/*
1975
1968
* When adjusting the lifetimes of an existing
1976
1969
* temporary address, only lower the lifetimes.
@@ -2675,9 +2668,10 @@ static int addrconf_ifdown(struct net_device *dev, int how)
2675
2668
in6_dev_put (idev );
2676
2669
2677
2670
/* 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 );
2681
2675
ifa -> dead = 1 ;
2682
2676
write_unlock_bh (& idev -> lock );
2683
2677
spin_lock_bh (& ifa -> lock );
0 commit comments