Skip to content

Commit

Permalink
ipv6: clean up ipv6_dev_ac_inc()
Browse files Browse the repository at this point in the history
Make it accept inet6_dev, and rename it to __ipv6_dev_ac_inc()
to reflect this change.

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
WANG Cong authored and David S. Miller committed Sep 13, 2014
1 parent b03a9c0 commit 013b4d9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion include/net/addrconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ int ipv6_sock_ac_drop(struct sock *sk, int ifindex,
const struct in6_addr *addr);
void ipv6_sock_ac_close(struct sock *sk);

int ipv6_dev_ac_inc(struct net_device *dev, const struct in6_addr *addr);
int __ipv6_dev_ac_inc(struct inet6_dev *idev, const struct in6_addr *addr);
int __ipv6_dev_ac_dec(struct inet6_dev *idev, const struct in6_addr *addr);
bool ipv6_chk_acast_addr(struct net *net, struct net_device *dev,
const struct in6_addr *addr);
Expand Down
2 changes: 1 addition & 1 deletion net/ipv6/addrconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1725,7 +1725,7 @@ static void addrconf_join_anycast(struct inet6_ifaddr *ifp)
ipv6_addr_prefix(&addr, &ifp->addr, ifp->prefix_len);
if (ipv6_addr_any(&addr))
return;
ipv6_dev_ac_inc(ifp->idev->dev, &addr);
__ipv6_dev_ac_inc(ifp->idev, &addr);
}

/* caller must hold RTNL */
Expand Down
13 changes: 4 additions & 9 deletions net/ipv6/anycast.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ int ipv6_sock_ac_join(struct sock *sk, int ifindex, const struct in6_addr *addr)
goto error;
}

err = ipv6_dev_ac_inc(dev, addr);
err = __ipv6_dev_ac_inc(idev, addr);
if (!err) {
pac->acl_next = np->ipv6_ac_list;
np->ipv6_ac_list = pac;
Expand Down Expand Up @@ -215,20 +215,15 @@ static void aca_put(struct ifacaddr6 *ac)
/*
* device anycast group inc (add if not found)
*/
int ipv6_dev_ac_inc(struct net_device *dev, const struct in6_addr *addr)
int __ipv6_dev_ac_inc(struct inet6_dev *idev, const struct in6_addr *addr)
{
struct ifacaddr6 *aca;
struct inet6_dev *idev;
struct rt6_info *rt;
int err;

ASSERT_RTNL();

idev = in6_dev_get(dev);

if (idev == NULL)
return -EINVAL;

in6_dev_hold(idev);
write_lock_bh(&idev->lock);
if (idev->dead) {
err = -ENODEV;
Expand Down Expand Up @@ -276,7 +271,7 @@ int ipv6_dev_ac_inc(struct net_device *dev, const struct in6_addr *addr)

ip6_ins_rt(rt);

addrconf_join_solict(dev, &aca->aca_addr);
addrconf_join_solict(idev->dev, &aca->aca_addr);

aca_put(aca);
return 0;
Expand Down

0 comments on commit 013b4d9

Please sign in to comment.