xref: /openbmc/linux/include/net/net_namespace.h (revision c122e14d)
15f256becSEric W. Biederman /*
25f256becSEric W. Biederman  * Operations on the network namespace
35f256becSEric W. Biederman  */
45f256becSEric W. Biederman #ifndef __NET_NET_NAMESPACE_H
55f256becSEric W. Biederman #define __NET_NET_NAMESPACE_H
65f256becSEric W. Biederman 
760063497SArun Sharma #include <linux/atomic.h>
8c122e14dSReshetova, Elena #include <linux/refcount.h>
95f256becSEric W. Biederman #include <linux/workqueue.h>
105f256becSEric W. Biederman #include <linux/list.h>
11bee95250SDavid S. Miller #include <linux/sysctl.h>
125f256becSEric W. Biederman 
136a662719SCong Wang #include <net/flow.h>
148efa6e93SPavel Emelyanov #include <net/netns/core.h>
15852566f5SPavel Emelyanov #include <net/netns/mib.h>
16a0a53c8bSDenis V. Lunev #include <net/netns/unix.h>
172aaef4e4SDenis V. Lunev #include <net/netns/packet.h>
188afd351cSPavel Emelyanov #include <net/netns/ipv4.h>
19b0f159dbSDaniel Lezcano #include <net/netns/ipv6.h>
20633fc86fSAlexander Aring #include <net/netns/ieee802154_6lowpan.h>
214db67e80SEric W. Biederman #include <net/netns/sctp.h>
2267019cc9SPavel Emelyanov #include <net/netns/dccp.h>
23f3c1a44aSGao feng #include <net/netns/netfilter.h>
248d870052SAlexey Dobriyan #include <net/netns/x_tables.h>
25dfdb8d79SAlexey Dobriyan #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
26dfdb8d79SAlexey Dobriyan #include <net/netns/conntrack.h>
27dfdb8d79SAlexey Dobriyan #endif
2899633ab2SPablo Neira Ayuso #include <net/netns/nftables.h>
29d62ddc21SAlexey Dobriyan #include <net/netns/xfrm.h>
300189197fSEric W. Biederman #include <net/netns/mpls.h>
318e8cda6dSMario Kicherer #include <net/netns/can.h>
32435d5f4bSAl Viro #include <linux/ns_common.h>
3304c52decSPablo Neira Ayuso #include <linux/idr.h>
3404c52decSPablo Neira Ayuso #include <linux/skbuff.h>
35a0a53c8bSDenis V. Lunev 
36038e7332SEric W. Biederman struct user_namespace;
37457c4cbcSEric W. Biederman struct proc_dir_entry;
382774c7abSEric W. Biederman struct net_device;
3997c53cacSDenis V. Lunev struct sock;
401597fbc0SPavel Emelyanov struct ctl_table_header;
41dec827d1SPavel Emelyanov struct net_generic;
42134e6375SJohannes Berg struct sock;
432553d064SJulian Anastasov struct netns_ipvs;
441597fbc0SPavel Emelyanov 
457c28bd0bSEric Dumazet 
467c28bd0bSEric Dumazet #define NETDEV_HASHBITS    8
477c28bd0bSEric Dumazet #define NETDEV_HASHENTRIES (1 << NETDEV_HASHBITS)
487c28bd0bSEric Dumazet 
495f256becSEric W. Biederman struct net {
50c122e14dSReshetova, Elena 	refcount_t		passive;	/* To decided when the network
515f256becSEric W. Biederman 						 * namespace should be freed.
525f256becSEric W. Biederman 						 */
53a685e089SAl Viro 	atomic_t		count;		/* To decided when the network
54a685e089SAl Viro 						 *  namespace should be shut down.
55a685e089SAl Viro 						 */
568e602ce2SEric Dumazet 	spinlock_t		rules_mod_lock;
578e602ce2SEric Dumazet 
5833cf7c90SEric Dumazet 	atomic64_t		cookie_gen;
5933cf7c90SEric Dumazet 
605f256becSEric W. Biederman 	struct list_head	list;		/* list of network namespaces */
612b035b39SEric W. Biederman 	struct list_head	cleanup_list;	/* namespaces on death row */
6272ad937aSEric W. Biederman 	struct list_head	exit_list;	/* Use only net_mutex */
63457c4cbcSEric W. Biederman 
64038e7332SEric W. Biederman 	struct user_namespace   *user_ns;	/* Owning user namespace */
6570328660SEric W. Biederman 	struct ucounts		*ucounts;
66de133464SWANG Cong 	spinlock_t		nsid_lock;
670c7aecd4SNicolas Dichtel 	struct idr		netns_ids;
68038e7332SEric W. Biederman 
69435d5f4bSAl Viro 	struct ns_common	ns;
7098f842e6SEric W. Biederman 
71457c4cbcSEric W. Biederman 	struct proc_dir_entry 	*proc_net;
72457c4cbcSEric W. Biederman 	struct proc_dir_entry 	*proc_net_stat;
73881d966bSEric W. Biederman 
7473455092SAl Viro #ifdef CONFIG_SYSCTL
7573455092SAl Viro 	struct ctl_table_set	sysctls;
7673455092SAl Viro #endif
7795bdfccbSEric W. Biederman 
788e602ce2SEric Dumazet 	struct sock 		*rtnl;			/* rtnetlink socket */
798e602ce2SEric Dumazet 	struct sock		*genl_sock;
802774c7abSEric W. Biederman 
81881d966bSEric W. Biederman 	struct list_head 	dev_base_head;
82881d966bSEric W. Biederman 	struct hlist_head 	*dev_name_head;
83881d966bSEric W. Biederman 	struct hlist_head	*dev_index_head;
844e985adaSThomas Graf 	unsigned int		dev_base_seq;	/* protected by rtnl_mutex */
85aa79e66eSPavel Emelyanov 	int			ifindex;
8650624c93SEric W. Biederman 	unsigned int		dev_unreg_count;
8797c53cacSDenis V. Lunev 
885fd30ee7SDenis V. Lunev 	/* core fib_rules */
895fd30ee7SDenis V. Lunev 	struct list_head	rules_ops;
905fd30ee7SDenis V. Lunev 
91d12d01d6SDenis V. Lunev 
928e602ce2SEric Dumazet 	struct net_device       *loopback_dev;          /* The loopback */
938efa6e93SPavel Emelyanov 	struct netns_core	core;
94852566f5SPavel Emelyanov 	struct netns_mib	mib;
952aaef4e4SDenis V. Lunev 	struct netns_packet	packet;
96a0a53c8bSDenis V. Lunev 	struct netns_unix	unx;
978afd351cSPavel Emelyanov 	struct netns_ipv4	ipv4;
98dfd56b8bSEric Dumazet #if IS_ENABLED(CONFIG_IPV6)
99b0f159dbSDaniel Lezcano 	struct netns_ipv6	ipv6;
100b0f159dbSDaniel Lezcano #endif
101633fc86fSAlexander Aring #if IS_ENABLED(CONFIG_IEEE802154_6LOWPAN)
102633fc86fSAlexander Aring 	struct netns_ieee802154_lowpan	ieee802154_lowpan;
103633fc86fSAlexander Aring #endif
1044db67e80SEric W. Biederman #if defined(CONFIG_IP_SCTP) || defined(CONFIG_IP_SCTP_MODULE)
1054db67e80SEric W. Biederman 	struct netns_sctp	sctp;
1064db67e80SEric W. Biederman #endif
10767019cc9SPavel Emelyanov #if defined(CONFIG_IP_DCCP) || defined(CONFIG_IP_DCCP_MODULE)
10867019cc9SPavel Emelyanov 	struct netns_dccp	dccp;
10967019cc9SPavel Emelyanov #endif
1108d870052SAlexey Dobriyan #ifdef CONFIG_NETFILTER
111f3c1a44aSGao feng 	struct netns_nf		nf;
1128d870052SAlexey Dobriyan 	struct netns_xt		xt;
113dfdb8d79SAlexey Dobriyan #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
114dfdb8d79SAlexey Dobriyan 	struct netns_ct		ct;
115dfdb8d79SAlexey Dobriyan #endif
11699633ab2SPablo Neira Ayuso #if defined(CONFIG_NF_TABLES) || defined(CONFIG_NF_TABLES_MODULE)
11799633ab2SPablo Neira Ayuso 	struct netns_nftables	nft;
11899633ab2SPablo Neira Ayuso #endif
119c038a767SAmerigo Wang #if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)
120c038a767SAmerigo Wang 	struct netns_nf_frag	nf_frag;
121c038a767SAmerigo Wang #endif
122cd8c20b6SAlexey Dobriyan 	struct sock		*nfnl;
123cd8c20b6SAlexey Dobriyan 	struct sock		*nfnl_stash;
1243499abb2SAndreas Schultz #if IS_ENABLED(CONFIG_NETFILTER_NETLINK_ACCT)
1253499abb2SAndreas Schultz 	struct list_head        nfnl_acct_list;
1263499abb2SAndreas Schultz #endif
12719576c94SPablo Neira #if IS_ENABLED(CONFIG_NF_CT_NETLINK_TIMEOUT)
12819576c94SPablo Neira 	struct list_head	nfct_timeout_list;
12919576c94SPablo Neira #endif
1308d870052SAlexey Dobriyan #endif
1313d23e349SJohannes Berg #ifdef CONFIG_WEXT_CORE
132b333b3d2SJohannes Berg 	struct sk_buff_head	wext_nlevents;
133b333b3d2SJohannes Berg #endif
1341c87733dSEric Dumazet 	struct net_generic __rcu	*gen;
1358e602ce2SEric Dumazet 
1368e602ce2SEric Dumazet 	/* Note : following structs are cache line aligned */
1378e602ce2SEric Dumazet #ifdef CONFIG_XFRM
1388e602ce2SEric Dumazet 	struct netns_xfrm	xfrm;
1398e602ce2SEric Dumazet #endif
1408b4d14d8SJunweiZhang #if IS_ENABLED(CONFIG_IP_VS)
14161b1ab45SHans Schillstrom 	struct netns_ipvs	*ipvs;
1428b4d14d8SJunweiZhang #endif
1430189197fSEric W. Biederman #if IS_ENABLED(CONFIG_MPLS)
1440189197fSEric W. Biederman 	struct netns_mpls	mpls;
1450189197fSEric W. Biederman #endif
1468e8cda6dSMario Kicherer #if IS_ENABLED(CONFIG_CAN)
1478e8cda6dSMario Kicherer 	struct netns_can	can;
1488e8cda6dSMario Kicherer #endif
14951d7cccfSAndrey Vagin 	struct sock		*diag_nlsk;
1505aad1de5STimo Teräs 	atomic_t		fnhe_genid;
1515f256becSEric W. Biederman };
1525f256becSEric W. Biederman 
153c0f39322SDenis V. Lunev #include <linux/seq_file_net.h>
154c0f39322SDenis V. Lunev 
1554fabcd71SDaniel Lezcano /* Init's network namespace */
1565f256becSEric W. Biederman extern struct net init_net;
157a4aa834aSDenis V. Lunev 
158d727abcbSEric W. Biederman #ifdef CONFIG_NET_NS
159e67e16eaSJoe Perches struct net *copy_net_ns(unsigned long flags, struct user_namespace *user_ns,
160e67e16eaSJoe Perches 			struct net *old_net);
161225c0a01SDenis V. Lunev 
1627866cc57SFlorian Westphal void net_ns_barrier(void);
163d727abcbSEric W. Biederman #else /* CONFIG_NET_NS */
164d727abcbSEric W. Biederman #include <linux/sched.h>
165d727abcbSEric W. Biederman #include <linux/nsproxy.h>
166038e7332SEric W. Biederman static inline struct net *copy_net_ns(unsigned long flags,
167038e7332SEric W. Biederman 	struct user_namespace *user_ns, struct net *old_net)
1689dd776b6SEric W. Biederman {
169d727abcbSEric W. Biederman 	if (flags & CLONE_NEWNET)
170d727abcbSEric W. Biederman 		return ERR_PTR(-EINVAL);
171d727abcbSEric W. Biederman 	return old_net;
1729dd776b6SEric W. Biederman }
1737866cc57SFlorian Westphal 
1747866cc57SFlorian Westphal static inline void net_ns_barrier(void) {}
175d727abcbSEric W. Biederman #endif /* CONFIG_NET_NS */
176225c0a01SDenis V. Lunev 
177225c0a01SDenis V. Lunev 
178225c0a01SDenis V. Lunev extern struct list_head net_namespace_list;
1799dd776b6SEric W. Biederman 
180e67e16eaSJoe Perches struct net *get_net_ns_by_pid(pid_t pid);
1810f5258cdSStefan Hajnoczi struct net *get_net_ns_by_fd(int fd);
18230ffee84SJohannes Berg 
183535d3ae9SRashika Kheria #ifdef CONFIG_SYSCTL
184535d3ae9SRashika Kheria void ipx_register_sysctl(void);
185535d3ae9SRashika Kheria void ipx_unregister_sysctl(void);
186535d3ae9SRashika Kheria #else
187535d3ae9SRashika Kheria #define ipx_register_sysctl()
188535d3ae9SRashika Kheria #define ipx_unregister_sysctl()
189535d3ae9SRashika Kheria #endif
190535d3ae9SRashika Kheria 
191d4655795SPavel Emelyanov #ifdef CONFIG_NET_NS
192e67e16eaSJoe Perches void __put_net(struct net *net);
1935f256becSEric W. Biederman 
1945f256becSEric W. Biederman static inline struct net *get_net(struct net *net)
1955f256becSEric W. Biederman {
1965f256becSEric W. Biederman 	atomic_inc(&net->count);
1975f256becSEric W. Biederman 	return net;
1985f256becSEric W. Biederman }
1995f256becSEric W. Biederman 
200077130c0SEric W. Biederman static inline struct net *maybe_get_net(struct net *net)
201077130c0SEric W. Biederman {
202077130c0SEric W. Biederman 	/* Used when we know struct net exists but we
203077130c0SEric W. Biederman 	 * aren't guaranteed a previous reference count
204077130c0SEric W. Biederman 	 * exists.  If the reference count is zero this
205077130c0SEric W. Biederman 	 * function fails and returns NULL.
206077130c0SEric W. Biederman 	 */
207077130c0SEric W. Biederman 	if (!atomic_inc_not_zero(&net->count))
208077130c0SEric W. Biederman 		net = NULL;
209077130c0SEric W. Biederman 	return net;
210077130c0SEric W. Biederman }
211077130c0SEric W. Biederman 
2125f256becSEric W. Biederman static inline void put_net(struct net *net)
2135f256becSEric W. Biederman {
2145f256becSEric W. Biederman 	if (atomic_dec_and_test(&net->count))
2155f256becSEric W. Biederman 		__put_net(net);
2165f256becSEric W. Biederman }
2175f256becSEric W. Biederman 
218878628fbSYOSHIFUJI Hideaki static inline
219878628fbSYOSHIFUJI Hideaki int net_eq(const struct net *net1, const struct net *net2)
220878628fbSYOSHIFUJI Hideaki {
221878628fbSYOSHIFUJI Hideaki 	return net1 == net2;
222878628fbSYOSHIFUJI Hideaki }
223a685e089SAl Viro 
224e67e16eaSJoe Perches void net_drop_ns(void *);
225a685e089SAl Viro 
226d4655795SPavel Emelyanov #else
227b9f75f45SEric W. Biederman 
228d4655795SPavel Emelyanov static inline struct net *get_net(struct net *net)
229d4655795SPavel Emelyanov {
230d4655795SPavel Emelyanov 	return net;
231d4655795SPavel Emelyanov }
232d4655795SPavel Emelyanov 
233d4655795SPavel Emelyanov static inline void put_net(struct net *net)
234d4655795SPavel Emelyanov {
235d4655795SPavel Emelyanov }
236d4655795SPavel Emelyanov 
237d4655795SPavel Emelyanov static inline struct net *maybe_get_net(struct net *net)
238d4655795SPavel Emelyanov {
239d4655795SPavel Emelyanov 	return net;
240d4655795SPavel Emelyanov }
241878628fbSYOSHIFUJI Hideaki 
242878628fbSYOSHIFUJI Hideaki static inline
243878628fbSYOSHIFUJI Hideaki int net_eq(const struct net *net1, const struct net *net2)
244878628fbSYOSHIFUJI Hideaki {
245878628fbSYOSHIFUJI Hideaki 	return 1;
246878628fbSYOSHIFUJI Hideaki }
247a685e089SAl Viro 
248a685e089SAl Viro #define net_drop_ns NULL
249d4655795SPavel Emelyanov #endif
2505f256becSEric W. Biederman 
2515d1e4468SDenis V. Lunev 
2520c5c9fb5SEric W. Biederman typedef struct {
2538f424b5fSEric Dumazet #ifdef CONFIG_NET_NS
2540c5c9fb5SEric W. Biederman 	struct net *net;
2558f424b5fSEric Dumazet #endif
2560c5c9fb5SEric W. Biederman } possible_net_t;
2570c5c9fb5SEric W. Biederman 
2580c5c9fb5SEric W. Biederman static inline void write_pnet(possible_net_t *pnet, struct net *net)
2590c5c9fb5SEric W. Biederman {
2600c5c9fb5SEric W. Biederman #ifdef CONFIG_NET_NS
2610c5c9fb5SEric W. Biederman 	pnet->net = net;
2620c5c9fb5SEric W. Biederman #endif
2630c5c9fb5SEric W. Biederman }
2640c5c9fb5SEric W. Biederman 
2650c5c9fb5SEric W. Biederman static inline struct net *read_pnet(const possible_net_t *pnet)
2660c5c9fb5SEric W. Biederman {
2670c5c9fb5SEric W. Biederman #ifdef CONFIG_NET_NS
2680c5c9fb5SEric W. Biederman 	return pnet->net;
2690c5c9fb5SEric W. Biederman #else
2700c5c9fb5SEric W. Biederman 	return &init_net;
2710c5c9fb5SEric W. Biederman #endif
2720c5c9fb5SEric W. Biederman }
2735d1e4468SDenis V. Lunev 
2745f256becSEric W. Biederman #define for_each_net(VAR)				\
2755f256becSEric W. Biederman 	list_for_each_entry(VAR, &net_namespace_list, list)
2765f256becSEric W. Biederman 
27711a28d37SJohannes Berg #define for_each_net_rcu(VAR)				\
27811a28d37SJohannes Berg 	list_for_each_entry_rcu(VAR, &net_namespace_list, list)
27911a28d37SJohannes Berg 
2804665079cSPavel Emelyanov #ifdef CONFIG_NET_NS
2814665079cSPavel Emelyanov #define __net_init
2824665079cSPavel Emelyanov #define __net_exit
283022cbae6SDenis V. Lunev #define __net_initdata
28404a6f82cSAndi Kleen #define __net_initconst
2854665079cSPavel Emelyanov #else
2864665079cSPavel Emelyanov #define __net_init	__init
287bd721ea7SFabian Frederick #define __net_exit	__ref
288022cbae6SDenis V. Lunev #define __net_initdata	__initdata
28904a6f82cSAndi Kleen #define __net_initconst	__initconst
2904665079cSPavel Emelyanov #endif
2915f256becSEric W. Biederman 
2927a0877d4SNicolas Dichtel int peernet2id_alloc(struct net *net, struct net *peer);
29359324cf3SNicolas Dichtel int peernet2id(struct net *net, struct net *peer);
29459324cf3SNicolas Dichtel bool peernet_has_id(struct net *net, struct net *peer);
2950c7aecd4SNicolas Dichtel struct net *get_net_ns_by_id(struct net *net, int id);
2960c7aecd4SNicolas Dichtel 
2975f256becSEric W. Biederman struct pernet_operations {
2985f256becSEric W. Biederman 	struct list_head list;
2995f256becSEric W. Biederman 	int (*init)(struct net *net);
3005f256becSEric W. Biederman 	void (*exit)(struct net *net);
30172ad937aSEric W. Biederman 	void (*exit_batch)(struct list_head *net_exit_list);
302c7d03a00SAlexey Dobriyan 	unsigned int *id;
303f875bae0SEric W. Biederman 	size_t size;
3045f256becSEric W. Biederman };
3055f256becSEric W. Biederman 
30617edde52SEric W. Biederman /*
30717edde52SEric W. Biederman  * Use these carefully.  If you implement a network device and it
30817edde52SEric W. Biederman  * needs per network namespace operations use device pernet operations,
30917edde52SEric W. Biederman  * otherwise use pernet subsys operations.
31017edde52SEric W. Biederman  *
3114edf547bSJohannes Berg  * Network interfaces need to be removed from a dying netns _before_
3124edf547bSJohannes Berg  * subsys notifiers can be called, as most of the network code cleanup
3134edf547bSJohannes Berg  * (which is done from subsys notifiers) runs with the assumption that
3144edf547bSJohannes Berg  * dev_remove_pack has been called so no new packets will arrive during
3154edf547bSJohannes Berg  * and after the cleanup functions have been called.  dev_remove_pack
3164edf547bSJohannes Berg  * is not per namespace so instead the guarantee of no more packets
3174edf547bSJohannes Berg  * arriving in a network namespace is provided by ensuring that all
3184edf547bSJohannes Berg  * network devices and all sockets have left the network namespace
3194edf547bSJohannes Berg  * before the cleanup methods are called.
32017edde52SEric W. Biederman  *
32117edde52SEric W. Biederman  * For the longest time the ipv4 icmp code was registered as a pernet
32217edde52SEric W. Biederman  * device which caused kernel oops, and panics during network
32317edde52SEric W. Biederman  * namespace cleanup.   So please don't get this wrong.
32417edde52SEric W. Biederman  */
325e67e16eaSJoe Perches int register_pernet_subsys(struct pernet_operations *);
326e67e16eaSJoe Perches void unregister_pernet_subsys(struct pernet_operations *);
327e67e16eaSJoe Perches int register_pernet_device(struct pernet_operations *);
328e67e16eaSJoe Perches void unregister_pernet_device(struct pernet_operations *);
329f875bae0SEric W. Biederman 
33095bdfccbSEric W. Biederman struct ctl_table;
33195bdfccbSEric W. Biederman struct ctl_table_header;
332d62c612eSPavel Emelyanov 
3332ca794e5SEric W. Biederman #ifdef CONFIG_SYSCTL
334e67e16eaSJoe Perches int net_sysctl_init(void);
335e67e16eaSJoe Perches struct ctl_table_header *register_net_sysctl(struct net *net, const char *path,
336e67e16eaSJoe Perches 					     struct ctl_table *table);
337e67e16eaSJoe Perches void unregister_net_sysctl_table(struct ctl_table_header *header);
33848c74958SEric W. Biederman #else
33948c74958SEric W. Biederman static inline int net_sysctl_init(void) { return 0; }
34048c74958SEric W. Biederman static inline struct ctl_table_header *register_net_sysctl(struct net *net,
34148c74958SEric W. Biederman 	const char *path, struct ctl_table *table)
34248c74958SEric W. Biederman {
34348c74958SEric W. Biederman 	return NULL;
34448c74958SEric W. Biederman }
34548c74958SEric W. Biederman static inline void unregister_net_sysctl_table(struct ctl_table_header *header)
34648c74958SEric W. Biederman {
34748c74958SEric W. Biederman }
34848c74958SEric W. Biederman #endif
34948c74958SEric W. Biederman 
350ca4c3fc2Sfan.du static inline int rt_genid_ipv4(struct net *net)
351b42664f8SNicolas Dichtel {
352ca4c3fc2Sfan.du 	return atomic_read(&net->ipv4.rt_genid);
353b42664f8SNicolas Dichtel }
354b42664f8SNicolas Dichtel 
355ca4c3fc2Sfan.du static inline void rt_genid_bump_ipv4(struct net *net)
356b42664f8SNicolas Dichtel {
357ca4c3fc2Sfan.du 	atomic_inc(&net->ipv4.rt_genid);
358ca4c3fc2Sfan.du }
359ca4c3fc2Sfan.du 
360705f1c86SHannes Frederic Sowa extern void (*__fib6_flush_trees)(struct net *net);
361ca4c3fc2Sfan.du static inline void rt_genid_bump_ipv6(struct net *net)
362ca4c3fc2Sfan.du {
363705f1c86SHannes Frederic Sowa 	if (__fib6_flush_trees)
364705f1c86SHannes Frederic Sowa 		__fib6_flush_trees(net);
365ca4c3fc2Sfan.du }
366ca4c3fc2Sfan.du 
367599018a7SLuis R. Rodriguez #if IS_ENABLED(CONFIG_IEEE802154_6LOWPAN)
368599018a7SLuis R. Rodriguez static inline struct netns_ieee802154_lowpan *
369599018a7SLuis R. Rodriguez net_ieee802154_lowpan(struct net *net)
370599018a7SLuis R. Rodriguez {
371599018a7SLuis R. Rodriguez 	return &net->ieee802154_lowpan;
372599018a7SLuis R. Rodriguez }
373599018a7SLuis R. Rodriguez #endif
374599018a7SLuis R. Rodriguez 
375ca4c3fc2Sfan.du /* For callers who don't really care about whether it's IPv4 or IPv6 */
376ca4c3fc2Sfan.du static inline void rt_genid_bump_all(struct net *net)
377ca4c3fc2Sfan.du {
378ca4c3fc2Sfan.du 	rt_genid_bump_ipv4(net);
379ca4c3fc2Sfan.du 	rt_genid_bump_ipv6(net);
380b42664f8SNicolas Dichtel }
38195bdfccbSEric W. Biederman 
3825aad1de5STimo Teräs static inline int fnhe_genid(struct net *net)
3835aad1de5STimo Teräs {
3845aad1de5STimo Teräs 	return atomic_read(&net->fnhe_genid);
3855aad1de5STimo Teräs }
3865aad1de5STimo Teräs 
3875aad1de5STimo Teräs static inline void fnhe_genid_bump(struct net *net)
3885aad1de5STimo Teräs {
3895aad1de5STimo Teräs 	atomic_inc(&net->fnhe_genid);
3905aad1de5STimo Teräs }
3915aad1de5STimo Teräs 
3925f256becSEric W. Biederman #endif /* __NET_NET_NAMESPACE_H */
393