aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstephen hemminger <shemminger@vyatta.com>2010-03-17 16:31:09 -0400
committerDavid S. Miller <davem@davemloft.net>2010-03-20 18:44:34 -0400
commit372e6c8f1f7b2bb68f9992d2e664925c73552a1d (patch)
tree8ae282cb00d43e6d04316f5dd1ac163788a7a4df
parente77c8e83dd587f2616d7ff20d23a897891e6e20d (diff)
ipv6: convert temporary address list to list macros
Use list macros instead of open coded linked list. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/if_inet6.h4
-rw-r--r--net/ipv6/addrconf.c30
2 files changed, 14 insertions, 20 deletions
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index 545d8b059bef..09d906460a43 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -58,7 +58,7 @@ struct inet6_ifaddr {
58 struct inet6_ifaddr *if_next; /* next addr in inet6_dev */ 58 struct inet6_ifaddr *if_next; /* next addr in inet6_dev */
59 59
60#ifdef CONFIG_IPV6_PRIVACY 60#ifdef CONFIG_IPV6_PRIVACY
61 struct inet6_ifaddr *tmp_next; /* next addr in tempaddr_lst */ 61 struct list_head tmp_list;
62 struct inet6_ifaddr *ifpub; 62 struct inet6_ifaddr *ifpub;
63 int regen_count; 63 int regen_count;
64#endif 64#endif
@@ -175,7 +175,7 @@ struct inet6_dev {
175#ifdef CONFIG_IPV6_PRIVACY 175#ifdef CONFIG_IPV6_PRIVACY
176 u8 rndid[8]; 176 u8 rndid[8];
177 struct timer_list regen_timer; 177 struct timer_list regen_timer;
178 struct inet6_ifaddr *tempaddr_list; 178 struct list_head tempaddr_list;
179#endif 179#endif
180 180
181 struct neigh_parms *nd_parms; 181 struct neigh_parms *nd_parms;
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 8d41abc40db5..f372f895cd41 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -401,6 +401,7 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev)
401#endif 401#endif
402 402
403#ifdef CONFIG_IPV6_PRIVACY 403#ifdef CONFIG_IPV6_PRIVACY
404 INIT_LIST_HEAD(&ndev->tempaddr_list);
404 setup_timer(&ndev->regen_timer, ipv6_regen_rndid, (unsigned long)ndev); 405 setup_timer(&ndev->regen_timer, ipv6_regen_rndid, (unsigned long)ndev);
405 if ((dev->flags&IFF_LOOPBACK) || 406 if ((dev->flags&IFF_LOOPBACK) ||
406 dev->type == ARPHRD_TUNNEL || 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#ifdef CONFIG_IPV6_PRIVACY 681#ifdef CONFIG_IPV6_PRIVACY
681 if (ifa->flags&IFA_F_TEMPORARY) { 682 if (ifa->flags&IFA_F_TEMPORARY) {
682 ifa->tmp_next = idev->tempaddr_list; 683 list_add(&ifa->tmp_list, &idev->tempaddr_list);
683 idev->tempaddr_list = ifa;
684 in6_ifa_hold(ifa); 684 in6_ifa_hold(ifa);
685 } 685 }
686#endif 686#endif
@@ -732,19 +732,12 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp)
732 write_lock_bh(&idev->lock); 732 write_lock_bh(&idev->lock);
733#ifdef CONFIG_IPV6_PRIVACY 733#ifdef CONFIG_IPV6_PRIVACY
734 if (ifp->flags&IFA_F_TEMPORARY) { 734 if (ifp->flags&IFA_F_TEMPORARY) {
735 for (ifap = &idev->tempaddr_list; (ifa=*ifap) != NULL; 735 list_del(&ifp->tmp_list);
736 ifap = &ifa->tmp_next) { 736 if (ifp->ifpub) {
737 if (ifa == ifp) { 737 in6_ifa_put(ifp->ifpub);
738 *ifap = ifa->tmp_next; 738 ifp->ifpub = NULL;
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 }
747 } 739 }
740 __in6_ifa_put(ifp);
748 } 741 }
749#endif 742#endif
750 743
@@ -1970,7 +1963,7 @@ ok:
1970#ifdef CONFIG_IPV6_PRIVACY 1963#ifdef CONFIG_IPV6_PRIVACY
1971 read_lock_bh(&in6_dev->lock); 1964 read_lock_bh(&in6_dev->lock);
1972 /* update all temporary addresses in the list */ 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 * When adjusting the lifetimes of an existing 1968 * When adjusting the lifetimes of an existing
1976 * temporary address, only lower the lifetimes. 1969 * temporary address, only lower the lifetimes.
@@ -2675,9 +2668,10 @@ static int addrconf_ifdown(struct net_device *dev, int how)
2675 in6_dev_put(idev); 2668 in6_dev_put(idev);
2676 2669
2677 /* clear tempaddr list */ 2670 /* clear tempaddr list */
2678 while ((ifa = idev->tempaddr_list) != NULL) { 2671 while (!list_empty(&idev->tempaddr_list)) {
2679 idev->tempaddr_list = ifa->tmp_next; 2672 ifa = list_first_entry(&idev->tempaddr_list,
2680 ifa->tmp_next = NULL; 2673 struct inet6_ifaddr, tmp_list);
2674 list_del(&ifa->tmp_list);
2681 ifa->dead = 1; 2675 ifa->dead = 1;
2682 write_unlock_bh(&idev->lock); 2676 write_unlock_bh(&idev->lock);
2683 spin_lock_bh(&ifa->lock); 2677 spin_lock_bh(&ifa->lock);