libnl: VETH

libnl 3.7.0

VETH
Routing Library (libnl-route) » Links (Interfaces)

Virtual Ethernet. More...

## VETH Object
struct rtnl_link * | rtnl_link_veth_alloc (void)
| Allocate link object of type veth. More...
struct rtnl_link * | rtnl_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.
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

## ◆ rtnl_link_veth_alloc()

struct rtnl_link* rtnl_link_veth_alloc | ( | void |  | ) |

Allocate link object of type veth.

Returns
  Allocated link object or NULL.

Definition at line 207 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:

## ◆ rtnl_link_veth_get_peer()

struct rtnl_link* rtnl_link_veth_get_peer | ( | struct rtnl_link * | link | ) |

Get the peer link of a veth link.

Returns
  the peer link object.

Definition at line 226 of file veth.c.

References nl_object_get().

Here is the call graph for this function:

## ◆ rtnl_link_is_veth()

int rtnl_link_is_veth | ( | struct rtnl_link * | link | ) |

Check if link is a veth link.

Parameters

  link | Link object

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

Definition at line 249 of file veth.c.

## ◆ rtnl_link_veth_add()

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

  sock | netlink socket
  name | name of the veth device or NULL
  peer_name | name of its peer or NULL
  pid | pid 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 268 of file veth.c.

References rtnl_link_set_name(), and rtnl_link_veth_alloc().

Here is the call graph for this function: