aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/net_namespace.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/net_namespace.h')
-rw-r--r--include/net/net_namespace.h37
1 files changed, 32 insertions, 5 deletions
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 84e37b1ca9e1..1313456a0994 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -119,7 +119,6 @@ struct net {
119 struct netns_ipvs *ipvs; 119 struct netns_ipvs *ipvs;
120#endif 120#endif
121 struct sock *diag_nlsk; 121 struct sock *diag_nlsk;
122 atomic_t rt_genid;
123 atomic_t fnhe_genid; 122 atomic_t fnhe_genid;
124}; 123};
125 124
@@ -333,14 +332,42 @@ static inline void unregister_net_sysctl_table(struct ctl_table_header *header)
333} 332}
334#endif 333#endif
335 334
336static inline int rt_genid(struct net *net) 335static inline int rt_genid_ipv4(struct net *net)
337{ 336{
338 return atomic_read(&net->rt_genid); 337 return atomic_read(&net->ipv4.rt_genid);
339} 338}
340 339
341static inline void rt_genid_bump(struct net *net) 340static inline void rt_genid_bump_ipv4(struct net *net)
342{ 341{
343 atomic_inc(&net->rt_genid); 342 atomic_inc(&net->ipv4.rt_genid);
343}
344
345#if IS_ENABLED(CONFIG_IPV6)
346static inline int rt_genid_ipv6(struct net *net)
347{
348 return atomic_read(&net->ipv6.rt_genid);
349}
350
351static inline void rt_genid_bump_ipv6(struct net *net)
352{
353 atomic_inc(&net->ipv6.rt_genid);
354}
355#else
356static inline int rt_genid_ipv6(struct net *net)
357{
358 return 0;
359}
360
361static inline void rt_genid_bump_ipv6(struct net *net)
362{
363}
364#endif
365
366/* For callers who don't really care about whether it's IPv4 or IPv6 */
367static inline void rt_genid_bump_all(struct net *net)
368{
369 rt_genid_bump_ipv4(net);
370 rt_genid_bump_ipv6(net);
344} 371}
345 372
346static inline int fnhe_genid(struct net *net) 373static inline int fnhe_genid(struct net *net)