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.
Showing the changes to include/uapi (1 of 4 files). Show all
Unified · Split
| @@ -84,6 +84,7 @@ · 83 unmodified lines | ||
| 84 | 84 | #define SIOCWANDEV 0x894A /* get/set netdev parameters */ |
| 85 | 85 | |
| 86 | 86 | #define SIOCOUTQNSD 0x894B /* output queue size (not sent only) */ |
| 87 | +#define SIOCGSKNS 0x894C /* get socket network namespace */ | |
| 87 | 88 | |
| 88 | 89 | /* ARP cache control calls. */ |
| 89 | 90 | /* 0x8950 - 0x8952 * obsolete calls, don't re-use */ |