diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c index 8a8f1e58b4155808e2b28abb91d85ea772c7fd63..4b2461ae5d3b8d8ffe802b1848f17b12f826fa54 100644 --- a/drivers/net/vrf.c +++ b/drivers/net/vrf.c @@ -364,17 +364,23 @@ static int vrf_rt6_create(struct net_device *dev) { struct net_vrf *vrf = netdev_priv(dev); struct net *net = dev_net(dev); + struct fib6_table *rt6i_table; struct rt6_info *rt6; int rc = -ENOMEM; + rt6i_table = fib6_new_table(net, vrf->tb_id); + if (!rt6i_table) + goto out; + rt6 = ip6_dst_alloc(net, dev, DST_HOST | DST_NOPOLICY | DST_NOXFRM | DST_NOCACHE); if (!rt6) goto out; - rt6->dst.output = vrf_output6; - rt6->rt6i_table = fib6_get_table(net, vrf->tb_id); dst_hold(&rt6->dst); + + rt6->rt6i_table = rt6i_table; + rt6->dst.output = vrf_output6; vrf->rt6 = rt6; rc = 0; out: @@ -462,6 +468,9 @@ static struct rtable *vrf_rtable_create(struct net_device *dev) struct net_vrf *vrf = netdev_priv(dev); struct rtable *rth; + if (!fib_new_table(dev_net(dev), vrf->tb_id)) + return NULL; + rth = rt_dst_alloc(dev, 0, RTN_UNICAST, 1, 1, 0); if (rth) { rth->dst.output = vrf_output; diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 63566ec54794db8213c2c935d75c2ba32dd71d61..ef2ebeb89d0fb0cb9cb5da4aea13183097baec8c 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -110,6 +110,7 @@ struct fib_table *fib_new_table(struct net *net, u32 id) hlist_add_head_rcu(&tb->tb_hlist, &net->ipv4.fib_table_hash[h]); return tb; } +EXPORT_SYMBOL_GPL(fib_new_table); /* caller must hold either rtnl or rcu read lock */ struct fib_table *fib_get_table(struct net *net, u32 id) diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index ea071fad67a03e9d884f99ddb64ea71dc8c31116..1bcef2369d64e6f1325dcab50c14601e6ca5a40a 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c @@ -240,6 +240,7 @@ struct fib6_table *fib6_new_table(struct net *net, u32 id) return tb; } +EXPORT_SYMBOL_GPL(fib6_new_table); struct fib6_table *fib6_get_table(struct net *net, u32 id) {