Loading...
Searching...
No Matches
netns.c File Reference
Netns
`#include "config.h"`
`#include <errno.h>`
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <unistd.h>`
`#include <signal.h>`
`#include <sys/types.h>`
`#include <sys/stat.h>`
`#include <fcntl.h>`
`#include <osmocom/core/utils.h>`
`#include <osmocom/core/netns.h>`

## Macros

#define | _GNU_SOURCE
#define | NETNS_PREFIX_PATH "/var/run/netns"
#define | NETNS_CURRENT_PATH "/proc/self/ns/net"

## Functions

int | osmo_netns_switch_enter (int nsfd, struct osmo_netns_switch_state *state)
| switch to a (non-default) namespace, store existing signal mask in oldmask.
int | osmo_netns_switch_exit (struct osmo_netns_switch_state *state)
| switch back to the previous namespace, restoring signal mask.
static int | create_netns (const char *name)
int | osmo_netns_open_fd (const char *name)
| Open a file descriptor for the network namespace with provided name.