aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/route.c
diff options
context:
space:
mode:
authorfan.du <fan.du@windriver.com>2013-07-29 20:33:53 -0400
committerDavid S. Miller <davem@davemloft.net>2013-07-31 17:56:36 -0400
commitca4c3fc24e293719fe7410c4e63da9b6bc633b83 (patch)
tree0461841f3d10b11a26ebe1a0adc99c7b00a489a2 /net/ipv4/route.c
parentba361cb3d4c977e2b94b5d97905f66b4d48964de (diff)
net: split rt_genid for ipv4 and ipv6
Current net name space has only one genid for both IPv4 and IPv6, it has below drawbacks: - Add/delete an IPv4 address will invalidate all IPv6 routing table entries. - Insert/remove XFRM policy will also invalidate both IPv4/IPv6 routing table entries even when the policy is only applied for one address family. Thus, this patch attempt to split one genid for two to cater for IPv4 and IPv6 separately in a fine granularity. Signed-off-by: Fan Du <fan.du@windriver.com> Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/route.c')
-rw-r--r--net/ipv4/route.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index a9a54a236832..e805481eff72 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -435,12 +435,12 @@ static inline int ip_rt_proc_init(void)
435 435
436static inline bool rt_is_expired(const struct rtable *rth) 436static inline bool rt_is_expired(const struct rtable *rth)
437{ 437{
438 return rth->rt_genid != rt_genid(dev_net(rth->dst.dev)); 438 return rth->rt_genid != rt_genid_ipv4(dev_net(rth->dst.dev));
439} 439}
440 440
441void rt_cache_flush(struct net *net) 441void rt_cache_flush(struct net *net)
442{ 442{
443 rt_genid_bump(net); 443 rt_genid_bump_ipv4(net);
444} 444}
445 445
446static struct neighbour *ipv4_neigh_lookup(const struct dst_entry *dst, 446static struct neighbour *ipv4_neigh_lookup(const struct dst_entry *dst,
@@ -1458,7 +1458,7 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
1458#endif 1458#endif
1459 rth->dst.output = ip_rt_bug; 1459 rth->dst.output = ip_rt_bug;
1460 1460
1461 rth->rt_genid = rt_genid(dev_net(dev)); 1461 rth->rt_genid = rt_genid_ipv4(dev_net(dev));
1462 rth->rt_flags = RTCF_MULTICAST; 1462 rth->rt_flags = RTCF_MULTICAST;
1463 rth->rt_type = RTN_MULTICAST; 1463 rth->rt_type = RTN_MULTICAST;
1464 rth->rt_is_input= 1; 1464 rth->rt_is_input= 1;
@@ -1589,7 +1589,7 @@ static int __mkroute_input(struct sk_buff *skb,
1589 goto cleanup; 1589 goto cleanup;
1590 } 1590 }
1591 1591
1592 rth->rt_genid = rt_genid(dev_net(rth->dst.dev)); 1592 rth->rt_genid = rt_genid_ipv4(dev_net(rth->dst.dev));
1593 rth->rt_flags = flags; 1593 rth->rt_flags = flags;
1594 rth->rt_type = res->type; 1594 rth->rt_type = res->type;
1595 rth->rt_is_input = 1; 1595 rth->rt_is_input = 1;
@@ -1760,7 +1760,7 @@ local_input:
1760 rth->dst.tclassid = itag; 1760 rth->dst.tclassid = itag;
1761#endif 1761#endif
1762 1762
1763 rth->rt_genid = rt_genid(net); 1763 rth->rt_genid = rt_genid_ipv4(net);
1764 rth->rt_flags = flags|RTCF_LOCAL; 1764 rth->rt_flags = flags|RTCF_LOCAL;
1765 rth->rt_type = res.type; 1765 rth->rt_type = res.type;
1766 rth->rt_is_input = 1; 1766 rth->rt_is_input = 1;
@@ -1945,7 +1945,7 @@ add:
1945 1945
1946 rth->dst.output = ip_output; 1946 rth->dst.output = ip_output;
1947 1947
1948 rth->rt_genid = rt_genid(dev_net(dev_out)); 1948 rth->rt_genid = rt_genid_ipv4(dev_net(dev_out));
1949 rth->rt_flags = flags; 1949 rth->rt_flags = flags;
1950 rth->rt_type = type; 1950 rth->rt_type = type;
1951 rth->rt_is_input = 0; 1951 rth->rt_is_input = 0;
@@ -2227,7 +2227,7 @@ struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_or
2227 rt->rt_iif = ort->rt_iif; 2227 rt->rt_iif = ort->rt_iif;
2228 rt->rt_pmtu = ort->rt_pmtu; 2228 rt->rt_pmtu = ort->rt_pmtu;
2229 2229
2230 rt->rt_genid = rt_genid(net); 2230 rt->rt_genid = rt_genid_ipv4(net);
2231 rt->rt_flags = ort->rt_flags; 2231 rt->rt_flags = ort->rt_flags;
2232 rt->rt_type = ort->rt_type; 2232 rt->rt_type = ort->rt_type;
2233 rt->rt_gateway = ort->rt_gateway; 2233 rt->rt_gateway = ort->rt_gateway;
@@ -2665,7 +2665,7 @@ static __net_initdata struct pernet_operations sysctl_route_ops = {
2665 2665
2666static __net_init int rt_genid_init(struct net *net) 2666static __net_init int rt_genid_init(struct net *net)
2667{ 2667{
2668 atomic_set(&net->rt_genid, 0); 2668 atomic_set(&net->ipv4.rt_genid, 0);
2669 atomic_set(&net->fnhe_genid, 0); 2669 atomic_set(&net->fnhe_genid, 0);
2670 get_random_bytes(&net->ipv4.dev_addr_genid, 2670 get_random_bytes(&net->ipv4.dev_addr_genid,
2671 sizeof(net->ipv4.dev_addr_genid)); 2671 sizeof(net->ipv4.dev_addr_genid));