6 Commits

Author SHA1 Message Date
Andrei Vagin 46115504ec Implement the setns syscall
This change introduces the nsfs file system. Each new namespace allocates
a new nsfs inode.

Here are reasons why we need these inodes:
* each namespace has to have an unique id.
* proc/pid/ns/ contains one entry for each namespace. Bind mounting one of
  the files in this directory to somewhere else in the filesystem keeps the
  corresponding namespace alive even if all processes currently in
  the namespace terminate.
* setns() allows the calling process to join an existing namespace specified
  by a file descriptor.

PiperOrigin-RevId: 550694515
2023-07-24 15:45:08 -07:00
Nicolas Lacasse 70d8b97c89 Partial rollback of cl/522685544.
To re-enable hostinet tests that require CAP_NET_RAW and CAP_NET_ADMIN.

PiperOrigin-RevId: 526701516
2023-04-24 11:20:47 -07:00
Ghanan Gowripalan 39470428dd Use a shared method to get loopback index
Code to get the loopback interface's index is scattered throughout the
syscall tests. Implement the code once and use that in tests (where
applicable).

While I am here, trim the dependencies/includes for network namespace
tests.

PiperOrigin-RevId: 396718124
2021-09-14 17:20:30 -07:00
Ghanan Gowripalan aa26981700 Move socket_test_util to //test/util
...and rename the library to socket_util.

PiperOrigin-RevId: 386348306
2021-07-22 16:37:15 -07:00
Ting-Yu Wang bbf86003bf Remove flaky network namespace test that uses clone().
PiperOrigin-RevId: 300626011
2020-03-12 14:35:25 -07:00
gVisor bot 4a73bae269 Initial network namespace support.
TCP/IP will work with netstack networking. hostinet doesn't work, and sockets
will have the same behavior as it is now.

Before the userspace is able to create device, the default loopback device can
be used to test.

/proc/net and /sys/net will still be connected to the root network stack; this
is the same behavior now.

Issue #1833

PiperOrigin-RevId: 296309389
2020-02-20 15:20:40 -08:00