Skip to content

Commit

Permalink
net/ipv6: Rename addrconf_dst_alloc
Browse files Browse the repository at this point in the history
addrconf_dst_alloc now returns a fib6_info. Update the name
and its users to reflect the change.

Rename only; no functional change intended.

Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David Ahern authored and David S. Miller committed Apr 19, 2018
1 parent 93c2fb2 commit 360a988
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 44 deletions.
2 changes: 1 addition & 1 deletion include/net/ip6_route.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ struct dst_entry *icmp6_dst_alloc(struct net_device *dev, struct flowi6 *fl6);

void fib6_force_start_gc(struct net *net);

struct fib6_info *addrconf_dst_alloc(struct net *net, struct inet6_dev *idev,
struct fib6_info *addrconf_f6i_alloc(struct net *net, struct inet6_dev *idev,
const struct in6_addr *addr, bool anycast,
gfp_t gfp_flags);

Expand Down
28 changes: 14 additions & 14 deletions net/ipv6/addrconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr,
gfp_t gfp_flags = can_block ? GFP_KERNEL : GFP_ATOMIC;
struct net *net = dev_net(idev->dev);
struct inet6_ifaddr *ifa = NULL;
struct fib6_info *rt = NULL;
struct fib6_info *f6i = NULL;
int err = 0;
int addr_type = ipv6_addr_type(addr);

Expand Down Expand Up @@ -1036,16 +1036,16 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr,
goto out;
}

rt = addrconf_dst_alloc(net, idev, addr, false, gfp_flags);
if (IS_ERR(rt)) {
err = PTR_ERR(rt);
rt = NULL;
f6i = addrconf_f6i_alloc(net, idev, addr, false, gfp_flags);
if (IS_ERR(f6i)) {
err = PTR_ERR(f6i);
f6i = NULL;
goto out;
}

if (net->ipv6.devconf_all->disable_policy ||
idev->cnf.disable_policy)
rt->dst_nopolicy = true;
f6i->dst_nopolicy = true;

neigh_parms_data_state_setall(idev->nd_parms);

Expand All @@ -1067,7 +1067,7 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr,
ifa->cstamp = ifa->tstamp = jiffies;
ifa->tokenized = false;

ifa->rt = rt;
ifa->rt = f6i;

ifa->idev = idev;
in6_dev_hold(idev);
Expand Down Expand Up @@ -1101,7 +1101,7 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr,
inet6addr_notifier_call_chain(NETDEV_UP, ifa);
out:
if (unlikely(err < 0)) {
fib6_info_release(rt);
fib6_info_release(f6i);

if (ifa) {
if (ifa->idev)
Expand Down Expand Up @@ -3346,17 +3346,17 @@ static int fixup_permanent_addr(struct net *net,
* case regenerate the host route.
*/
if (!ifp->rt || !ifp->rt->fib6_node) {
struct fib6_info *rt, *prev;
struct fib6_info *f6i, *prev;

rt = addrconf_dst_alloc(net, idev, &ifp->addr, false,
GFP_ATOMIC);
if (IS_ERR(rt))
return PTR_ERR(rt);
f6i = addrconf_f6i_alloc(net, idev, &ifp->addr, false,
GFP_ATOMIC);
if (IS_ERR(f6i))
return PTR_ERR(f6i);

/* ifp->rt can be accessed outside of rtnl */
spin_lock(&ifp->lock);
prev = ifp->rt;
ifp->rt = rt;
ifp->rt = f6i;
spin_unlock(&ifp->lock);

fib6_info_release(prev);
Expand Down
14 changes: 7 additions & 7 deletions net/ipv6/anycast.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ static struct ifacaddr6 *aca_alloc(struct fib6_info *f6i,
int __ipv6_dev_ac_inc(struct inet6_dev *idev, const struct in6_addr *addr)
{
struct ifacaddr6 *aca;
struct fib6_info *rt;
struct fib6_info *f6i;
struct net *net;
int err;

Expand All @@ -268,14 +268,14 @@ int __ipv6_dev_ac_inc(struct inet6_dev *idev, const struct in6_addr *addr)
}

net = dev_net(idev->dev);
rt = addrconf_dst_alloc(net, idev, addr, true, GFP_ATOMIC);
if (IS_ERR(rt)) {
err = PTR_ERR(rt);
f6i = addrconf_f6i_alloc(net, idev, addr, true, GFP_ATOMIC);
if (IS_ERR(f6i)) {
err = PTR_ERR(f6i);
goto out;
}
aca = aca_alloc(rt, addr);
aca = aca_alloc(f6i, addr);
if (!aca) {
fib6_info_release(rt);
fib6_info_release(f6i);
err = -ENOMEM;
goto out;
}
Expand All @@ -289,7 +289,7 @@ int __ipv6_dev_ac_inc(struct inet6_dev *idev, const struct in6_addr *addr)
aca_get(aca);
write_unlock_bh(&idev->lock);

ip6_ins_rt(net, rt);
ip6_ins_rt(net, f6i);

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

Expand Down
44 changes: 22 additions & 22 deletions net/ipv6/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -3591,44 +3591,44 @@ static int ip6_pkt_prohibit_out(struct net *net, struct sock *sk, struct sk_buff
* Allocate a dst for local (unicast / anycast) address.
*/

struct fib6_info *addrconf_dst_alloc(struct net *net,
struct inet6_dev *idev,
const struct in6_addr *addr,
bool anycast, gfp_t gfp_flags)
struct fib6_info *addrconf_f6i_alloc(struct net *net,
struct inet6_dev *idev,
const struct in6_addr *addr,
bool anycast, gfp_t gfp_flags)
{
u32 tb_id;
struct net_device *dev = idev->dev;
struct fib6_info *rt;
struct fib6_info *f6i;

rt = fib6_info_alloc(gfp_flags);
if (!rt)
f6i = fib6_info_alloc(gfp_flags);
if (!f6i)
return ERR_PTR(-ENOMEM);

rt->dst_nocount = true;
f6i->dst_nocount = true;

in6_dev_hold(idev);
rt->fib6_idev = idev;
f6i->fib6_idev = idev;

rt->dst_host = true;
rt->fib6_protocol = RTPROT_KERNEL;
rt->fib6_flags = RTF_UP | RTF_NONEXTHOP;
f6i->dst_host = true;
f6i->fib6_protocol = RTPROT_KERNEL;
f6i->fib6_flags = RTF_UP | RTF_NONEXTHOP;
if (anycast) {
rt->fib6_type = RTN_ANYCAST;
rt->fib6_flags |= RTF_ANYCAST;
f6i->fib6_type = RTN_ANYCAST;
f6i->fib6_flags |= RTF_ANYCAST;
} else {
rt->fib6_type = RTN_LOCAL;
rt->fib6_flags |= RTF_LOCAL;
f6i->fib6_type = RTN_LOCAL;
f6i->fib6_flags |= RTF_LOCAL;
}

rt->fib6_nh.nh_gw = *addr;
f6i->fib6_nh.nh_gw = *addr;
dev_hold(dev);
rt->fib6_nh.nh_dev = dev;
rt->fib6_dst.addr = *addr;
rt->fib6_dst.plen = 128;
f6i->fib6_nh.nh_dev = dev;
f6i->fib6_dst.addr = *addr;
f6i->fib6_dst.plen = 128;
tb_id = l3mdev_fib_table(idev->dev) ? : RT6_TABLE_LOCAL;
rt->fib6_table = fib6_get_table(net, tb_id);
f6i->fib6_table = fib6_get_table(net, tb_id);

return rt;
return f6i;
}

/* remove deleted ip from prefsrc entries */
Expand Down

0 comments on commit 360a988

Please sign in to comment.