libosmocore 1.13.1.12-8e6ea
Osmocom core library
netns.c File Reference
#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. More...
 
int osmo_netns_switch_exit (struct osmo_netns_switch_state *state)
 switch back to the previous namespace, restoring signal mask. More...
 
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. More...