Commit 372e6c8f authored by stephen hemminger's avatar stephen hemminger Committed by David S. Miller

ipv6: convert temporary address list to list macros

Use list macros instead of open coded linked list.
Signed-off-by: default avatarStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e77c8e83
...@@ -58,7 +58,7 @@ struct inet6_ifaddr { ...@@ -58,7 +58,7 @@ struct inet6_ifaddr {
struct inet6_ifaddr *if_next; /* next addr in inet6_dev */ struct inet6_ifaddr *if_next; /* next addr in inet6_dev */
#ifdef CONFIG_IPV6_PRIVACY #ifdef CONFIG_IPV6_PRIVACY
struct inet6_ifaddr *tmp_next; /* next addr in tempaddr_lst */ struct list_head tmp_list;
struct inet6_ifaddr *ifpub; struct inet6_ifaddr *ifpub;
int regen_count; int regen_count;
#endif #endif
...@@ -175,7 +175,7 @@ struct inet6_dev { ...@@ -175,7 +175,7 @@ struct inet6_dev {
#ifdef CONFIG_IPV6_PRIVACY #ifdef CONFIG_IPV6_PRIVACY
u8 rndid[8]; u8 rndid[8];
struct timer_list regen_timer; struct timer_list regen_timer;
struct inet6_ifaddr *tempaddr_list; struct list_head tempaddr_list;
#endif #endif
struct neigh_parms *nd_parms; struct neigh_parms *nd_parms;
......
...@@ -401,6 +401,7 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev) ...@@ -401,6 +401,7 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev)
#endif #endif
#ifdef CONFIG_IPV6_PRIVACY #ifdef CONFIG_IPV6_PRIVACY
INIT_LIST_HEAD(&ndev->tempaddr_list);
setup_timer(&ndev->regen_timer, ipv6_regen_rndid, (unsigned long)ndev); setup_timer(&ndev->regen_timer, ipv6_regen_rndid, (unsigned long)ndev);
if ((dev->flags&IFF_LOOPBACK) || if ((dev->flags&IFF_LOOPBACK) ||
dev->type == ARPHRD_TUNNEL || dev->type == ARPHRD_TUNNEL ||
...@@ -679,8 +680,7 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen, ...@@ -679,8 +680,7 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen,
#ifdef CONFIG_IPV6_PRIVACY #ifdef CONFIG_IPV6_PRIVACY
if (ifa->flags&IFA_F_TEMPORARY) { if (ifa->flags&IFA_F_TEMPORARY) {
ifa->tmp_next = idev->tempaddr_list; list_add(&ifa->tmp_list, &idev->tempaddr_list);
idev->tempaddr_list = ifa;
in6_ifa_hold(ifa); in6_ifa_hold(ifa);
} }
#endif #endif
...@@ -732,19 +732,12 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp) ...@@ -732,19 +732,12 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp)
write_lock_bh(&idev->lock); write_lock_bh(&idev->lock);
#ifdef CONFIG_IPV6_PRIVACY #ifdef CONFIG_IPV6_PRIVACY
if (ifp->flags&IFA_F_TEMPORARY) { if (ifp->flags&IFA_F_TEMPORARY) {
for (ifap = &idev->tempaddr_list; (ifa=*ifap) != NULL; list_del(&ifp->tmp_list);
ifap = &ifa->tmp_next) {
if (ifa == ifp) {
*ifap = ifa->tmp_next;
if (ifp->ifpub) { if (ifp->ifpub) {
in6_ifa_put(ifp->ifpub); in6_ifa_put(ifp->ifpub);
ifp->ifpub = NULL; ifp->ifpub = NULL;
} }
__in6_ifa_put(ifp); __in6_ifa_put(ifp);
ifa->tmp_next = NULL;
break;
}
}
} }
#endif #endif
...@@ -1970,7 +1963,7 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len) ...@@ -1970,7 +1963,7 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len)
#ifdef CONFIG_IPV6_PRIVACY #ifdef CONFIG_IPV6_PRIVACY
read_lock_bh(&in6_dev->lock); read_lock_bh(&in6_dev->lock);
/* update all temporary addresses in the list */ /* update all temporary addresses in the list */
for (ift=in6_dev->tempaddr_list; ift; ift=ift->tmp_next) { list_for_each_entry(ift, &in6_dev->tempaddr_list, tmp_list) {
/* /*
* When adjusting the lifetimes of an existing * When adjusting the lifetimes of an existing
* temporary address, only lower the lifetimes. * temporary address, only lower the lifetimes.
...@@ -2675,9 +2668,10 @@ static int addrconf_ifdown(struct net_device *dev, int how) ...@@ -2675,9 +2668,10 @@ static int addrconf_ifdown(struct net_device *dev, int how)
in6_dev_put(idev); in6_dev_put(idev);
/* clear tempaddr list */ /* clear tempaddr list */
while ((ifa = idev->tempaddr_list) != NULL) { while (!list_empty(&idev->tempaddr_list)) {
idev->tempaddr_list = ifa->tmp_next; ifa = list_first_entry(&idev->tempaddr_list,
ifa->tmp_next = NULL; struct inet6_ifaddr, tmp_list);
list_del(&ifa->tmp_list);
ifa->dead = 1; ifa->dead = 1;
write_unlock_bh(&idev->lock); write_unlock_bh(&idev->lock);
spin_lock_bh(&ifa->lock); spin_lock_bh(&ifa->lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment