diff options
| author | Jakub Kicinski <kuba@kernel.org> | 2021-06-18 19:47:02 -0700 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2021-06-18 19:47:02 -0700 |
| commit | adc2e56ebe6377f5c032d96aee0feac30a640453 (patch) | |
| tree | f8937ffc72e1991418b0d54a0672766237855c94 /net/core/net_namespace.c | |
| parent | 4bea7207a80c8bba3b3eb5b84c407b162968475f (diff) | |
| parent | 9ed13a17e38e0537e24d9b507645002bf8d0201f (diff) | |
| download | linux-adc2e56ebe6377f5c032d96aee0feac30a640453.tar.gz linux-adc2e56ebe6377f5c032d96aee0feac30a640453.tar.bz2 linux-adc2e56ebe6377f5c032d96aee0feac30a640453.zip | |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Trivial conflicts in net/can/isotp.c and
tools/testing/selftests/net/mptcp/mptcp_connect.sh
scaled_ppm_to_ppb() was moved from drivers/ptp/ptp_clock.c
to include/linux/ptp_clock_kernel.h in -next so re-apply
the fix there.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/core/net_namespace.c')
| -rw-r--r-- | net/core/net_namespace.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 43b6ac4c4439..9b5a767eddd5 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c @@ -641,6 +641,18 @@ void __put_net(struct net *net) } EXPORT_SYMBOL_GPL(__put_net); +/** + * get_net_ns - increment the refcount of the network namespace + * @ns: common namespace (net) + * + * Returns the net's common namespace. + */ +struct ns_common *get_net_ns(struct ns_common *ns) +{ + return &get_net(container_of(ns, struct net, ns))->ns; +} +EXPORT_SYMBOL_GPL(get_net_ns); + struct net *get_net_ns_by_fd(int fd) { struct file *file; @@ -660,14 +672,8 @@ struct net *get_net_ns_by_fd(int fd) fput(file); return net; } - -#else -struct net *get_net_ns_by_fd(int fd) -{ - return ERR_PTR(-EINVAL); -} -#endif EXPORT_SYMBOL_GPL(get_net_ns_by_fd); +#endif struct net *get_net_ns_by_pid(pid_t pid) { |
