libnl 3.5.0

Functions
Bonding
Routing Library (libnl-route) » Links (Interfaces)

## Functions
struct rtnl_link * | rtnl_link_bond_alloc (void)
| Allocate link object of type bond. More...
int | rtnl_link_bond_add (struct nl_sock *sock, const char *name, struct rtnl_link *opts)
| Create a new kernel bonding device. More...
int | rtnl_link_bond_enslave_ifindex (struct nl_sock *sock, int master, int slave)
| Add a link to a bond (enslave) More...
int | rtnl_link_bond_enslave (struct nl_sock *sock, struct rtnl_link *master, struct rtnl_link *slave)
| Add a link to a bond (enslave) More...
int | rtnl_link_bond_release_ifindex (struct nl_sock *sock, int slave)
| Release a link from a bond. More...
int | rtnl_link_bond_release (struct nl_sock *sock, struct rtnl_link *slave)
| Release a link from a bond. More...

## Detailed Description

Link Type Name: "bond"

Bonding Documentation (Netlink Routing Development Guide)

## Function Documentation

## ◆ rtnl_link_bond_alloc()

struct rtnl_link* rtnl_link_bond_alloc | ( | void |  | ) |

Allocate link object of type bond.

Returns
  Allocated link object or NULL.

Definition at line 33 of file bonding.c.

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

Referenced by rtnl_link_bond_add(), and rtnl_link_bond_enslave_ifindex().

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ rtnl_link_bond_add()

int rtnl_link_bond_add | ( | struct nl_sock * | sock,
|  | const char * | name,
|  | struct rtnl_link * | opts
| ) |  |

Create a new kernel bonding device.

Parameters

  sock | netlink socket
  name | name of bonding device or NULL
  opts | bonding options (currently unused)

Creates a new bonding device in the kernel. If no name is provided, the kernel will automatically pick a name of the form "type%d" (e.g. bond0, vlan1, etc.)

The opts argument is currently unused. In the future, it may be used to carry additional bonding options to be set when creating the bonding device.

Note
  When letting the kernel assign a name, it will become difficult to retrieve the interface afterwards because you have to guess the name the kernel has chosen. It is therefore not recommended to not provide a device name.

See also
  rtnl_link_bond_enslave()
  rtnl_link_bond_release()

Returns
  0 on success or a negative error code

Definition at line 73 of file bonding.c.

References rtnl_link_add(), rtnl_link_bond_alloc(), rtnl_link_get_name(), rtnl_link_put(), and rtnl_link_set_name().

Here is the call graph for this function:

## ◆ rtnl_link_bond_enslave_ifindex()

int rtnl_link_bond_enslave_ifindex | ( | struct nl_sock * | sock,
|  | int | master,
|  | int | slave
| ) |  |

Add a link to a bond (enslave)

Parameters

  sock | netlink socket
  master | ifindex of bonding master
  slave | ifindex of slave link to add to bond

This function is identical to rtnl_link_bond_enslave() except that it takes interface indices instead of rtnl_link objcets.

See also
  rtnl_link_bond_enslave()

Returns
  0 on success or a negative error code.

Definition at line 108 of file bonding.c.

References rtnl_link_bond_alloc(), rtnl_link_change(), rtnl_link_get_kernel(), rtnl_link_get_master(), rtnl_link_put(), rtnl_link_set_ifindex(), and rtnl_link_set_master().

Referenced by rtnl_link_bond_enslave(), and rtnl_link_bond_release_ifindex().

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ rtnl_link_bond_enslave()

int rtnl_link_bond_enslave | ( | struct nl_sock * | sock,
|  | struct rtnl_link * | master,
|  | struct rtnl_link * | slave
| ) |  |

Add a link to a bond (enslave)

Parameters

  sock | netlink socket
  master | bonding master
  slave | slave link to add to bond

Constructs a RTM_NEWLINK or RTM_SETLINK message adding the slave to the master and sends the request via the specified netlink socket.

Note
  The feature of enslaving/releasing via netlink has only been added recently to the kernel (Feb 2011). Also, the kernel does not signal if the operation is not supported. Therefore this function will verify if the master assignment has changed and will return -NLE_OPNOTSUPP if it did not.

See also
  rtnl_link_bond_enslave_ifindex()
  rtnl_link_bond_release()

Returns
  0 on success or a negative error code.

Definition at line 164 of file bonding.c.

References rtnl_link_bond_enslave_ifindex(), and rtnl_link_get_ifindex().

Here is the call graph for this function:

## ◆ rtnl_link_bond_release_ifindex()

int rtnl_link_bond_release_ifindex | ( | struct nl_sock * | sock,
|  | int | slave
| ) |  |

Release a link from a bond.

Parameters

  sock | netlink socket
  slave | slave link to be released

This function is identical to rtnl_link_bond_release() except that it takes an interface index instead of a rtnl_link object.

See also
  rtnl_link_bond_release()

Returns
  0 on success or a negative error code.

Definition at line 184 of file bonding.c.

References rtnl_link_bond_enslave_ifindex().

Referenced by rtnl_link_bond_release().

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ rtnl_link_bond_release()

int rtnl_link_bond_release | ( | struct nl_sock * | sock,
|  | struct rtnl_link * | slave
| ) |  |

Release a link from a bond.

Parameters

  sock | netlink socket
  slave | slave link to be released

Constructs a RTM_NEWLINK or RTM_SETLINK message releasing the slave from its master and sends the request via the specified netlink socket.

Note
  The feature of enslaving/releasing via netlink has only been added recently to the kernel (Feb 2011). Also, the kernel does not signal if the operation is not supported. Therefore this function will verify if the master assignment has changed and will return -NLE_OPNOTSUPP if it did not.

See also
  rtnl_link_bond_release_ifindex()
  rtnl_link_bond_enslave()

Returns
  0 on success or a negative error code.

Definition at line 208 of file bonding.c.

References rtnl_link_bond_release_ifindex(), and rtnl_link_get_ifindex().

Here is the call graph for this function: