libnl  3.2.24-rc1

Virtual Ethernet. More...

VETH Object

struct rtnl_linkrtnl_link_veth_alloc (void)
 Allocate link object of type veth. More...
 
struct rtnl_linkrtnl_link_veth_get_peer (struct rtnl_link *link)
 Get the peer link of a veth link. More...
 
void rtnl_link_veth_release (struct rtnl_link *link)
 Release a veth link and its peer. More...
 
int rtnl_link_is_veth (struct rtnl_link *link)
 Check if link is a veth link. More...
 
int rtnl_link_veth_add (struct nl_sock *sock, const char *name, const char *peer_name, pid_t pid)
 Create a new kernel veth device. More...
 

Detailed Description

Virtual Ethernet.

Link Type Name: "veth"

VETH Documentation (Netlink Routing Development Guide)

Function Documentation

struct rtnl_link* rtnl_link_veth_alloc ( void  )
read

Allocate link object of type veth.

Returns
Allocated link object or NULL.

Definition at line 173 of file veth.c.

References rtnl_link_alloc(), rtnl_link_put(), and rtnl_link_set_type().

Referenced by rtnl_link_veth_add().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

struct rtnl_link* rtnl_link_veth_get_peer ( struct rtnl_link link)
read

Get the peer link of a veth link.

Returns
the peer link object.

Definition at line 206 of file veth.c.

Referenced by rtnl_link_veth_add(), and rtnl_link_veth_release().

+ Here is the caller graph for this function:

void rtnl_link_veth_release ( struct rtnl_link link)

Release a veth link and its peer.

Definition at line 216 of file veth.c.

References rtnl_link_put(), and rtnl_link_veth_get_peer().

+ Here is the call graph for this function:

int rtnl_link_is_veth ( struct rtnl_link link)

Check if link is a veth link.

Parameters
linkLink object
Returns
True if link is a veth link, otherwise false is returned.

Definition at line 229 of file veth.c.

int rtnl_link_veth_add ( struct nl_sock *  sock,
const char *  name,
const char *  peer_name,
pid_t  pid 
)

Create a new kernel veth device.

Parameters
socknetlink socket
namename of the veth device or NULL
peer_namename of its peer or NULL
pidpid of the process in the new netns

Creates a new veth device pair in the kernel and move the peer to the network namespace where the process is. If no name is provided, the kernel will automatically pick a name of the form "veth%d" (e.g. veth0, veth1, etc.)

Returns
0 on success or a negative error code

Definition at line 248 of file veth.c.

References rtnl_link_add(), rtnl_link_put(), rtnl_link_set_name(), rtnl_link_veth_alloc(), and rtnl_link_veth_get_peer().

+ Here is the call graph for this function: