Commit b7503e0c authored by David Ahern's avatar David Ahern Committed by David S. Miller

net: Add FIB table id to rtable

Add the FIB table id to rtable to make the information available for
IPv4 as it is for IPv6.
Signed-off-by: default avatarDavid Ahern <dsa@cumulusnetworks.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d08c4f35
...@@ -320,6 +320,7 @@ static void vrf_rtable_destroy(struct net_vrf *vrf) ...@@ -320,6 +320,7 @@ static void vrf_rtable_destroy(struct net_vrf *vrf)
static struct rtable *vrf_rtable_create(struct net_device *dev) static struct rtable *vrf_rtable_create(struct net_device *dev)
{ {
struct net_vrf *vrf = netdev_priv(dev);
struct rtable *rth; struct rtable *rth;
rth = dst_alloc(&vrf_dst_ops, dev, 2, rth = dst_alloc(&vrf_dst_ops, dev, 2,
...@@ -335,6 +336,7 @@ static struct rtable *vrf_rtable_create(struct net_device *dev) ...@@ -335,6 +336,7 @@ static struct rtable *vrf_rtable_create(struct net_device *dev)
rth->rt_pmtu = 0; rth->rt_pmtu = 0;
rth->rt_gateway = 0; rth->rt_gateway = 0;
rth->rt_uses_gateway = 0; rth->rt_uses_gateway = 0;
rth->rt_table_id = vrf->tb_id;
INIT_LIST_HEAD(&rth->rt_uncached); INIT_LIST_HEAD(&rth->rt_uncached);
rth->rt_uncached_list = NULL; rth->rt_uncached_list = NULL;
} }
......
...@@ -64,6 +64,8 @@ struct rtable { ...@@ -64,6 +64,8 @@ struct rtable {
/* Miscellaneous cached information */ /* Miscellaneous cached information */
u32 rt_pmtu; u32 rt_pmtu;
u32 rt_table_id;
struct list_head rt_uncached; struct list_head rt_uncached;
struct uncached_list *rt_uncached_list; struct uncached_list *rt_uncached_list;
}; };
......
...@@ -1457,6 +1457,7 @@ static struct rtable *rt_dst_alloc(struct net_device *dev, ...@@ -1457,6 +1457,7 @@ static struct rtable *rt_dst_alloc(struct net_device *dev,
rt->rt_pmtu = 0; rt->rt_pmtu = 0;
rt->rt_gateway = 0; rt->rt_gateway = 0;
rt->rt_uses_gateway = 0; rt->rt_uses_gateway = 0;
rt->rt_table_id = 0;
INIT_LIST_HEAD(&rt->rt_uncached); INIT_LIST_HEAD(&rt->rt_uncached);
rt->dst.output = ip_output; rt->dst.output = ip_output;
...@@ -1629,6 +1630,8 @@ static int __mkroute_input(struct sk_buff *skb, ...@@ -1629,6 +1630,8 @@ static int __mkroute_input(struct sk_buff *skb,
} }
rth->rt_is_input = 1; rth->rt_is_input = 1;
if (res->table)
rth->rt_table_id = res->table->tb_id;
RT_CACHE_STAT_INC(in_slow_tot); RT_CACHE_STAT_INC(in_slow_tot);
rth->dst.input = ip_forward; rth->dst.input = ip_forward;
...@@ -1808,6 +1811,8 @@ out: return err; ...@@ -1808,6 +1811,8 @@ out: return err;
rth->dst.tclassid = itag; rth->dst.tclassid = itag;
#endif #endif
rth->rt_is_input = 1; rth->rt_is_input = 1;
if (res.table)
rth->rt_table_id = res.table->tb_id;
RT_CACHE_STAT_INC(in_slow_tot); RT_CACHE_STAT_INC(in_slow_tot);
if (res.type == RTN_UNREACHABLE) { if (res.type == RTN_UNREACHABLE) {
...@@ -1988,6 +1993,9 @@ static struct rtable *__mkroute_output(const struct fib_result *res, ...@@ -1988,6 +1993,9 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
return ERR_PTR(-ENOBUFS); return ERR_PTR(-ENOBUFS);
rth->rt_iif = orig_oif ? : 0; rth->rt_iif = orig_oif ? : 0;
if (res->table)
rth->rt_table_id = res->table->tb_id;
RT_CACHE_STAT_INC(out_slow_tot); RT_CACHE_STAT_INC(out_slow_tot);
if (flags & (RTCF_BROADCAST | RTCF_MULTICAST)) { if (flags & (RTCF_BROADCAST | RTCF_MULTICAST)) {
......
...@@ -95,6 +95,7 @@ static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev, ...@@ -95,6 +95,7 @@ static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,
xdst->u.rt.rt_gateway = rt->rt_gateway; xdst->u.rt.rt_gateway = rt->rt_gateway;
xdst->u.rt.rt_uses_gateway = rt->rt_uses_gateway; xdst->u.rt.rt_uses_gateway = rt->rt_uses_gateway;
xdst->u.rt.rt_pmtu = rt->rt_pmtu; xdst->u.rt.rt_pmtu = rt->rt_pmtu;
xdst->u.rt.rt_table_id = rt->rt_table_id;
INIT_LIST_HEAD(&xdst->u.rt.rt_uncached); INIT_LIST_HEAD(&xdst->u.rt.rt_uncached);
return 0; return 0;
......
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