aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/addrconf.c
diff options
context:
space:
mode:
authorJiri Pirko <jiri@resnulli.us>2013-08-01 04:41:27 -0400
committerDavid S. Miller <davem@davemloft.net>2013-08-01 17:16:20 -0400
commit3f8f52982ad020f0704548c46de66bf464d3b967 (patch)
tree7f42c28f803006846db7addcabd1fe8e9796db1b /net/ipv6/addrconf.c
parent49a18d86f66d33a20144ecb5a34bba0d1856b260 (diff)
ipv6: move peer_addr init into ipv6_add_addr()
Signed-off-by: Jiri Pirko <jiri@resnulli.us> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/addrconf.c')
-rw-r--r--net/ipv6/addrconf.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index cfdcf7b2daf6..a0ce957fb671 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -813,7 +813,8 @@ static u32 inet6_addr_hash(const struct in6_addr *addr)
813/* On success it returns ifp with increased reference count */ 813/* On success it returns ifp with increased reference count */
814 814
815static struct inet6_ifaddr * 815static struct inet6_ifaddr *
816ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen, 816ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr,
817 const struct in6_addr *peer_addr, int pfxlen,
817 int scope, u32 flags) 818 int scope, u32 flags)
818{ 819{
819 struct inet6_ifaddr *ifa = NULL; 820 struct inet6_ifaddr *ifa = NULL;
@@ -863,6 +864,8 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen,
863 } 864 }
864 865
865 ifa->addr = *addr; 866 ifa->addr = *addr;
867 if (peer_addr)
868 ifa->peer_addr = *peer_addr;
866 869
867 spin_lock_init(&ifa->lock); 870 spin_lock_init(&ifa->lock);
868 spin_lock_init(&ifa->state_lock); 871 spin_lock_init(&ifa->state_lock);
@@ -1123,8 +1126,8 @@ retry:
1123 1126
1124 ift = !max_addresses || 1127 ift = !max_addresses ||
1125 ipv6_count_addresses(idev) < max_addresses ? 1128 ipv6_count_addresses(idev) < max_addresses ?
1126 ipv6_add_addr(idev, &addr, tmp_plen, ipv6_addr_scope(&addr), 1129 ipv6_add_addr(idev, &addr, NULL, tmp_plen,
1127 addr_flags) : NULL; 1130 ipv6_addr_scope(&addr), addr_flags) : NULL;
1128 if (IS_ERR_OR_NULL(ift)) { 1131 if (IS_ERR_OR_NULL(ift)) {
1129 in6_ifa_put(ifp); 1132 in6_ifa_put(ifp);
1130 in6_dev_put(idev); 1133 in6_dev_put(idev);
@@ -2179,7 +2182,8 @@ ok:
2179 */ 2182 */
2180 if (!max_addresses || 2183 if (!max_addresses ||
2181 ipv6_count_addresses(in6_dev) < max_addresses) 2184 ipv6_count_addresses(in6_dev) < max_addresses)
2182 ifp = ipv6_add_addr(in6_dev, &addr, pinfo->prefix_len, 2185 ifp = ipv6_add_addr(in6_dev, &addr, NULL,
2186 pinfo->prefix_len,
2183 addr_type&IPV6_ADDR_SCOPE_MASK, 2187 addr_type&IPV6_ADDR_SCOPE_MASK,
2184 addr_flags); 2188 addr_flags);
2185 2189
@@ -2455,15 +2459,13 @@ static int inet6_addr_add(struct net *net, int ifindex, const struct in6_addr *p
2455 prefered_lft = timeout; 2459 prefered_lft = timeout;
2456 } 2460 }
2457 2461
2458 ifp = ipv6_add_addr(idev, pfx, plen, scope, ifa_flags); 2462 ifp = ipv6_add_addr(idev, pfx, peer_pfx, plen, scope, ifa_flags);
2459 2463
2460 if (!IS_ERR(ifp)) { 2464 if (!IS_ERR(ifp)) {
2461 spin_lock_bh(&ifp->lock); 2465 spin_lock_bh(&ifp->lock);
2462 ifp->valid_lft = valid_lft; 2466 ifp->valid_lft = valid_lft;
2463 ifp->prefered_lft = prefered_lft; 2467 ifp->prefered_lft = prefered_lft;
2464 ifp->tstamp = jiffies; 2468 ifp->tstamp = jiffies;
2465 if (peer_pfx)
2466 ifp->peer_addr = *peer_pfx;
2467 spin_unlock_bh(&ifp->lock); 2469 spin_unlock_bh(&ifp->lock);
2468 2470
2469 addrconf_prefix_route(&ifp->addr, ifp->prefix_len, dev, 2471 addrconf_prefix_route(&ifp->addr, ifp->prefix_len, dev,
@@ -2557,7 +2559,7 @@ static void add_addr(struct inet6_dev *idev, const struct in6_addr *addr,
2557{ 2559{
2558 struct inet6_ifaddr *ifp; 2560 struct inet6_ifaddr *ifp;
2559 2561
2560 ifp = ipv6_add_addr(idev, addr, plen, scope, IFA_F_PERMANENT); 2562 ifp = ipv6_add_addr(idev, addr, NULL, plen, scope, IFA_F_PERMANENT);
2561 if (!IS_ERR(ifp)) { 2563 if (!IS_ERR(ifp)) {
2562 spin_lock_bh(&ifp->lock); 2564 spin_lock_bh(&ifp->lock);
2563 ifp->flags &= ~IFA_F_TENTATIVE; 2565 ifp->flags &= ~IFA_F_TENTATIVE;
@@ -2683,7 +2685,7 @@ static void addrconf_add_linklocal(struct inet6_dev *idev, const struct in6_addr
2683#endif 2685#endif
2684 2686
2685 2687
2686 ifp = ipv6_add_addr(idev, addr, 64, IFA_LINK, addr_flags); 2688 ifp = ipv6_add_addr(idev, addr, NULL, 64, IFA_LINK, addr_flags);
2687 if (!IS_ERR(ifp)) { 2689 if (!IS_ERR(ifp)) {
2688 addrconf_prefix_route(&ifp->addr, ifp->prefix_len, idev->dev, 0, 0); 2690 addrconf_prefix_route(&ifp->addr, ifp->prefix_len, idev->dev, 0, 0);
2689 addrconf_dad_start(ifp); 2691 addrconf_dad_start(ifp);