Lines Matching full:net
15 #include <net/flow.h>
16 #include <net/netns/core.h>
17 #include <net/netns/mib.h>
18 #include <net/netns/unix.h>
19 #include <net/netns/packet.h>
20 #include <net/netns/ipv4.h>
21 #include <net/netns/ipv6.h>
22 #include <net/netns/nexthop.h>
23 #include <net/netns/ieee802154_6lowpan.h>
24 #include <net/netns/sctp.h>
25 #include <net/netns/netfilter.h>
27 #include <net/netns/conntrack.h>
30 #include <net/netns/flow_table.h>
32 #include <net/netns/nftables.h>
33 #include <net/netns/xfrm.h>
34 #include <net/netns/mpls.h>
35 #include <net/netns/can.h>
36 #include <net/netns/xdp.h>
37 #include <net/netns/smc.h>
38 #include <net/netns/bpf.h>
39 #include <net/netns/mctp.h>
40 #include <net/net_trackers.h>
61 struct net { struct
78 * methods on dead net ( argument
196 extern struct net init_net; argument
199 struct net *copy_net_ns(unsigned long flags, struct user_namespace *user_ns,
200 struct net *old_net);
202 void net_ns_get_ownership(const struct net *net, kuid_t *uid, kgid_t *gid);
207 struct net *get_net_ns_by_fd(int fd);
211 static inline struct net *copy_net_ns(unsigned long flags, in copy_net_ns()
212 struct user_namespace *user_ns, struct net *old_net) in copy_net_ns()
219 static inline void net_ns_get_ownership(const struct net *net, in net_ns_get_ownership() argument
233 static inline struct net *get_net_ns_by_fd(int fd) in get_net_ns_by_fd()
242 struct net *get_net_ns_by_pid(pid_t pid);
253 void __put_net(struct net *net);
256 static inline struct net *get_net(struct net *net) in get_net() argument
258 refcount_inc(&net->ns.count); in get_net()
259 return net; in get_net()
262 static inline struct net *maybe_get_net(struct net *net) in maybe_get_net() argument
264 /* Used when we know struct net exists but we in maybe_get_net()
269 if (!refcount_inc_not_zero(&net->ns.count)) in maybe_get_net()
270 net = NULL; in maybe_get_net()
271 return net; in maybe_get_net()
275 static inline void put_net(struct net *net) in put_net() argument
277 if (refcount_dec_and_test(&net->ns.count)) in put_net()
278 __put_net(net); in put_net()
282 int net_eq(const struct net *net1, const struct net *net2) in net_eq()
287 static inline int check_net(const struct net *net) in check_net() argument
289 return refcount_read(&net->ns.count) != 0; in check_net()
296 static inline struct net *get_net(struct net *net) in get_net() argument
298 return net; in get_net()
301 static inline void put_net(struct net *net) in put_net() argument
305 static inline struct net *maybe_get_net(struct net *net) in maybe_get_net() argument
307 return net; in maybe_get_net()
311 int net_eq(const struct net *net1, const struct net *net2) in net_eq()
316 static inline int check_net(const struct net *net) in check_net() argument
325 static inline void __netns_tracker_alloc(struct net *net, in __netns_tracker_alloc() argument
331 ref_tracker_alloc(refcounted ? &net->refcnt_tracker : in __netns_tracker_alloc()
332 &net->notrefcnt_tracker, in __netns_tracker_alloc()
337 static inline void netns_tracker_alloc(struct net *net, netns_tracker *tracker, in netns_tracker_alloc() argument
340 __netns_tracker_alloc(net, tracker, true, gfp); in netns_tracker_alloc()
343 static inline void __netns_tracker_free(struct net *net, in __netns_tracker_free() argument
348 ref_tracker_free(refcounted ? &net->refcnt_tracker : in __netns_tracker_free()
349 &net->notrefcnt_tracker, tracker); in __netns_tracker_free()
353 static inline struct net *get_net_track(struct net *net, in get_net_track() argument
356 get_net(net); in get_net_track()
357 netns_tracker_alloc(net, tracker, gfp); in get_net_track()
358 return net; in get_net_track()
361 static inline void put_net_track(struct net *net, netns_tracker *tracker) in put_net_track() argument
363 __netns_tracker_free(net, tracker, true); in put_net_track()
364 put_net(net); in put_net_track()
369 struct net __rcu *net; member
373 static inline void write_pnet(possible_net_t *pnet, struct net *net) in write_pnet() argument
376 rcu_assign_pointer(pnet->net, net); in write_pnet()
380 static inline struct net *read_pnet(const possible_net_t *pnet) in read_pnet()
383 return rcu_dereference_protected(pnet->net, true); in read_pnet()
389 static inline struct net *read_pnet_rcu(possible_net_t *pnet) in read_pnet_rcu()
392 return rcu_dereference(pnet->net); in read_pnet_rcu()
418 int peernet2id_alloc(struct net *net, struct net *peer, gfp_t gfp);
419 int peernet2id(const struct net *net, struct net *peer);
420 bool peernet_has_id(const struct net *net, struct net *peer);
421 struct net *get_net_ns_by_id(const struct net *net, int id);
427 * More than one net may be constructed and destructed
438 * Then, destruction of a group of net requires single
440 * instead of separate synchronize_rcu() for every net.
447 int (*init)(struct net *net);
448 void (*pre_exit)(struct net *net);
449 void (*exit)(struct net *net);
484 #define register_net_sysctl(net, path, table) \ argument
485 register_net_sysctl_sz(net, path, table, ARRAY_SIZE(table))
488 struct ctl_table_header *register_net_sysctl_sz(struct net *net, const char *path,
493 static inline struct ctl_table_header *register_net_sysctl_sz(struct net *net, in register_net_sysctl_sz() argument
503 static inline int rt_genid_ipv4(const struct net *net) in rt_genid_ipv4() argument
505 return atomic_read(&net->ipv4.rt_genid); in rt_genid_ipv4()
509 static inline int rt_genid_ipv6(const struct net *net) in rt_genid_ipv6() argument
511 return atomic_read(&net->ipv6.fib6_sernum); in rt_genid_ipv6()
515 static inline void rt_genid_bump_ipv4(struct net *net) in rt_genid_bump_ipv4() argument
517 atomic_inc(&net->ipv4.rt_genid); in rt_genid_bump_ipv4()
520 extern void (*__fib6_flush_trees)(struct net *net);
521 static inline void rt_genid_bump_ipv6(struct net *net) in rt_genid_bump_ipv6() argument
524 __fib6_flush_trees(net); in rt_genid_bump_ipv6()
529 net_ieee802154_lowpan(struct net *net) in net_ieee802154_lowpan() argument
531 return &net->ieee802154_lowpan; in net_ieee802154_lowpan()
536 static inline void rt_genid_bump_all(struct net *net) in rt_genid_bump_all() argument
538 rt_genid_bump_ipv4(net); in rt_genid_bump_all()
539 rt_genid_bump_ipv6(net); in rt_genid_bump_all()
542 static inline int fnhe_genid(const struct net *net) in fnhe_genid() argument
544 return atomic_read(&net->fnhe_genid); in fnhe_genid()
547 static inline void fnhe_genid_bump(struct net *net) in fnhe_genid_bump() argument
549 atomic_inc(&net->fnhe_genid); in fnhe_genid_bump()