Commit 3f8f5298 authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

ipv6: move peer_addr init into ipv6_add_addr()

Signed-off-by: default avatarJiri Pirko <jiri@resnulli.us>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 49a18d86
...@@ -813,7 +813,8 @@ static u32 inet6_addr_hash(const struct in6_addr *addr) ...@@ -813,7 +813,8 @@ static u32 inet6_addr_hash(const struct in6_addr *addr)
/* On success it returns ifp with increased reference count */ /* On success it returns ifp with increased reference count */
static struct inet6_ifaddr * static struct inet6_ifaddr *
ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen, ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr,
const struct in6_addr *peer_addr, int pfxlen,
int scope, u32 flags) int scope, u32 flags)
{ {
struct inet6_ifaddr *ifa = NULL; struct inet6_ifaddr *ifa = NULL;
...@@ -863,6 +864,8 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen, ...@@ -863,6 +864,8 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen,
} }
ifa->addr = *addr; ifa->addr = *addr;
if (peer_addr)
ifa->peer_addr = *peer_addr;
spin_lock_init(&ifa->lock); spin_lock_init(&ifa->lock);
spin_lock_init(&ifa->state_lock); spin_lock_init(&ifa->state_lock);
...@@ -1123,8 +1126,8 @@ static int ipv6_create_tempaddr(struct inet6_ifaddr *ifp, struct inet6_ifaddr *i ...@@ -1123,8 +1126,8 @@ static int ipv6_create_tempaddr(struct inet6_ifaddr *ifp, struct inet6_ifaddr *i
ift = !max_addresses || ift = !max_addresses ||
ipv6_count_addresses(idev) < max_addresses ? ipv6_count_addresses(idev) < max_addresses ?
ipv6_add_addr(idev, &addr, tmp_plen, ipv6_addr_scope(&addr), ipv6_add_addr(idev, &addr, NULL, tmp_plen,
addr_flags) : NULL; ipv6_addr_scope(&addr), addr_flags) : NULL;
if (IS_ERR_OR_NULL(ift)) { if (IS_ERR_OR_NULL(ift)) {
in6_ifa_put(ifp); in6_ifa_put(ifp);
in6_dev_put(idev); in6_dev_put(idev);
...@@ -2179,7 +2182,8 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len, bool sllao) ...@@ -2179,7 +2182,8 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len, bool sllao)
*/ */
if (!max_addresses || if (!max_addresses ||
ipv6_count_addresses(in6_dev) < max_addresses) ipv6_count_addresses(in6_dev) < max_addresses)
ifp = ipv6_add_addr(in6_dev, &addr, pinfo->prefix_len, ifp = ipv6_add_addr(in6_dev, &addr, NULL,
pinfo->prefix_len,
addr_type&IPV6_ADDR_SCOPE_MASK, addr_type&IPV6_ADDR_SCOPE_MASK,
addr_flags); addr_flags);
...@@ -2455,15 +2459,13 @@ static int inet6_addr_add(struct net *net, int ifindex, const struct in6_addr *p ...@@ -2455,15 +2459,13 @@ static int inet6_addr_add(struct net *net, int ifindex, const struct in6_addr *p
prefered_lft = timeout; prefered_lft = timeout;
} }
ifp = ipv6_add_addr(idev, pfx, plen, scope, ifa_flags); ifp = ipv6_add_addr(idev, pfx, peer_pfx, plen, scope, ifa_flags);
if (!IS_ERR(ifp)) { if (!IS_ERR(ifp)) {
spin_lock_bh(&ifp->lock); spin_lock_bh(&ifp->lock);
ifp->valid_lft = valid_lft; ifp->valid_lft = valid_lft;
ifp->prefered_lft = prefered_lft; ifp->prefered_lft = prefered_lft;
ifp->tstamp = jiffies; ifp->tstamp = jiffies;
if (peer_pfx)
ifp->peer_addr = *peer_pfx;
spin_unlock_bh(&ifp->lock); spin_unlock_bh(&ifp->lock);
addrconf_prefix_route(&ifp->addr, ifp->prefix_len, dev, 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,7 +2559,7 @@ static void add_addr(struct inet6_dev *idev, const struct in6_addr *addr,
{ {
struct inet6_ifaddr *ifp; struct inet6_ifaddr *ifp;
ifp = ipv6_add_addr(idev, addr, plen, scope, IFA_F_PERMANENT); ifp = ipv6_add_addr(idev, addr, NULL, plen, scope, IFA_F_PERMANENT);
if (!IS_ERR(ifp)) { if (!IS_ERR(ifp)) {
spin_lock_bh(&ifp->lock); spin_lock_bh(&ifp->lock);
ifp->flags &= ~IFA_F_TENTATIVE; ifp->flags &= ~IFA_F_TENTATIVE;
...@@ -2683,7 +2685,7 @@ static void addrconf_add_linklocal(struct inet6_dev *idev, const struct in6_addr ...@@ -2683,7 +2685,7 @@ static void addrconf_add_linklocal(struct inet6_dev *idev, const struct in6_addr
#endif #endif
ifp = ipv6_add_addr(idev, addr, 64, IFA_LINK, addr_flags); ifp = ipv6_add_addr(idev, addr, NULL, 64, IFA_LINK, addr_flags);
if (!IS_ERR(ifp)) { if (!IS_ERR(ifp)) {
addrconf_prefix_route(&ifp->addr, ifp->prefix_len, idev->dev, 0, 0); addrconf_prefix_route(&ifp->addr, ifp->prefix_len, idev->dev, 0, 0);
addrconf_dad_start(ifp); addrconf_dad_start(ifp);
......
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