History

net: add an ioctl to get a socket network namespace

Each socket operates in a network namespace where it has been created, so if we want to dump and restore a socket, we have to know its network namespace. We have a socket_diag to get information about sockets, it doesn't report sockets which are not bound or connected. This patch introduces a new socket ioctl, which is called SIOCGSKNS and used to get a file descriptor for a socket network namespace. A task must have CAP_NET_ADMIN in a target network namespace to use this ioctl.

Andrey Vagin committed 10 years ago

Commit c62cce21 parent 2a43ca04 files · +19 −1Browse files

Showing the changes to include/uapi (1 of 4 files). Show all

Unified · Split

include/uapi/linux/sockios.h+1−0
@@ -84,6 +84,7 @@ · 83 unmodified lines
8484 #define SIOCWANDEV 0x894A /* get/set netdev parameters */
8585
8686 #define SIOCOUTQNSD 0x894B /* output queue size (not sent only) */
87+#define SIOCGSKNS 0x894C /* get socket network namespace */
8788
8889 /* ARP cache control calls. */
8990 /* 0x8950 - 0x8952 * obsolete calls, don't re-use */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t