libnl  3.2.24-rc1

Functions

struct rtnl_linkrtnl_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

struct rtnl_link* rtnl_link_bond_alloc ( void  )
read

Allocate link object of type bond.

Returns
Allocated link object or NULL.

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

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

Create a new kernel bonding device.

Parameters
socknetlink socket
namename of bonding device or NULL
optsbonding 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 72 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:

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

Add a link to a bond (enslave)

Parameters
socknetlink socket
masterifindex of bonding master
slaveifindex 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 107 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:

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
socknetlink socket
masterbonding master
slaveslave 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 163 of file bonding.c.

References rtnl_link_bond_enslave_ifindex(), and rtnl_link_get_ifindex().

+ Here is the call graph for this function:

int rtnl_link_bond_release_ifindex ( struct nl_sock *  sock,
int  slave 
)

Release a link from a bond.

Parameters
socknetlink socket
slaveslave 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 183 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:

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

Release a link from a bond.

Parameters
socknetlink socket
slaveslave 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 207 of file bonding.c.

References rtnl_link_bond_release_ifindex(), and rtnl_link_get_ifindex().

+ Here is the call graph for this function: