[net-next,1/2] net: Make extern and export get_net_ns()

Message ID 151852144203.22861.12483846849729481318.stgit@localhost.localdomain
State Superseded
Delegated to: David Miller
Headers show
  • Add ioctl() SIOCGSKNS cmd to allow obtaining net ns of tun device
Related show

Commit Message

Kirill Tkhai Feb. 13, 2018, 11:30 a.m.
This function will be used to obtain net of tun device.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
 include/linux/socket.h |    2 ++
 net/socket.c           |    3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)


diff --git a/include/linux/socket.h b/include/linux/socket.h
index 9286a5a8c60c..1ce1f768a58c 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -353,4 +353,6 @@  extern int __sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen
 			  unsigned int flags, struct timespec *timeout);
 extern int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg,
 			  unsigned int vlen, unsigned int flags);
+extern struct ns_common *get_net_ns(struct ns_common *ns);
 #endif /* _LINUX_SOCKET_H */
diff --git a/net/socket.c b/net/socket.c
index fac8246a8ae8..7d1ffa755821 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -991,10 +991,11 @@  static long sock_do_ioctl(struct net *net, struct socket *sock,
  *	what to do with it - that's up to the protocol still.
-static struct ns_common *get_net_ns(struct ns_common *ns)
+struct ns_common *get_net_ns(struct ns_common *ns)
 	return &get_net(container_of(ns, struct net, ns))->ns;
 static long sock_ioctl(struct file *file, unsigned cmd, unsigned long arg)