libnl 3.10.0

Data Structures

struct  bond_info
 

Macros

#define BOND_HAS_MODE   (1 << 0)
 
#define BOND_HAS_ACTIVE_SLAVE   (1 << 1)
 
#define BOND_HAS_HASHING_TYPE   (1 << 2)
 
#define BOND_HAS_MIIMON   (1 << 3)
 
#define BOND_HAS_MIN_LINKS   (1 << 4)
 
#define IS_BOND_INFO_ASSERT(link)
 

Functions

void rtnl_link_bond_set_activeslave (struct rtnl_link *link, int active_slave)
 Set active slave for bond.
 
void rtnl_link_bond_set_mode (struct rtnl_link *link, uint8_t mode)
 Set bond mode.
 
void rtnl_link_bond_set_hashing_type (struct rtnl_link *link, uint8_t type)
 Set hashing type.
 
void rtnl_link_bond_set_miimon (struct rtnl_link *link, uint32_t miimon)
 Set MII monitoring interval.
 
void rtnl_link_bond_set_min_links (struct rtnl_link *link, uint32_t min_links)
 Set the minimum number of member ports that must be up before marking the bond device as up.
 
struct rtnl_linkrtnl_link_bond_alloc (void)
 Allocate link object of type bond.
 
int rtnl_link_bond_add (struct nl_sock *sock, const char *name, struct rtnl_link *opts)
 Create a new kernel bonding device.
 
int rtnl_link_bond_enslave_ifindex (struct nl_sock *sock, int master, int slave)
 Add a link to a 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)
 
int rtnl_link_bond_release_ifindex (struct nl_sock *sock, int slave)
 Release a link from a bond.
 
int rtnl_link_bond_release (struct nl_sock *sock, struct rtnl_link *slave)
 Release a link from a bond.
 

Detailed Description

Link Type Name: "bond"

Bonding Documentation (Netlink Routing Development Guide)

Macro Definition Documentation

◆ BOND_HAS_MODE

#define BOND_HAS_MODE   (1 << 0)

Definition at line 25 of file bonding.c.

◆ BOND_HAS_ACTIVE_SLAVE

#define BOND_HAS_ACTIVE_SLAVE   (1 << 1)

Definition at line 26 of file bonding.c.

◆ BOND_HAS_HASHING_TYPE

#define BOND_HAS_HASHING_TYPE   (1 << 2)

Definition at line 27 of file bonding.c.

◆ BOND_HAS_MIIMON

#define BOND_HAS_MIIMON   (1 << 3)

Definition at line 28 of file bonding.c.

◆ BOND_HAS_MIN_LINKS

#define BOND_HAS_MIN_LINKS   (1 << 4)

Definition at line 29 of file bonding.c.

◆ IS_BOND_INFO_ASSERT

#define IS_BOND_INFO_ASSERT ( link)
Value:
do { \
if (link->l_info_ops != &bonding_info_ops) { \
APPBUG("Link is not a bond link. Set type \"bond\" first."); \
} \
} while (0)

Definition at line 100 of file bonding.c.

Function Documentation

◆ rtnl_link_bond_set_activeslave()

void rtnl_link_bond_set_activeslave ( struct rtnl_link * link,
int active_slave )

Set active slave for bond.

Parameters
linkLink object of type bond
activeifindex of active slave to set
Returns
void

Definition at line 114 of file bonding.c.

◆ rtnl_link_bond_set_mode()

void rtnl_link_bond_set_mode ( struct rtnl_link * link,
uint8_t mode )

Set bond mode.

Parameters
linkLink object of type bond
modebond mode to set
Returns
void

Definition at line 132 of file bonding.c.

◆ rtnl_link_bond_set_hashing_type()

void rtnl_link_bond_set_hashing_type ( struct rtnl_link * link,
uint8_t type )

Set hashing type.

Parameters
linkLink object of type bond
typebond hashing type to set
Returns
void

Definition at line 150 of file bonding.c.

◆ rtnl_link_bond_set_miimon()

void rtnl_link_bond_set_miimon ( struct rtnl_link * link,
uint32_t miimon )

Set MII monitoring interval.

Parameters
linkLink object of type bond
miimoninterval in milliseconds
Returns
void

Definition at line 168 of file bonding.c.

◆ rtnl_link_bond_set_min_links()

void rtnl_link_bond_set_min_links ( struct rtnl_link * link,
uint32_t min_links )

Set the minimum number of member ports that must be up before marking the bond device as up.

Parameters
linkLink object of type bond
min_linksNumber of links
Returns
void

Definition at line 187 of file bonding.c.

◆ 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 203 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
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 242 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
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 277 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
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 333 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
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 353 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
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 377 of file bonding.c.

References rtnl_link_bond_release_ifindex(), and rtnl_link_get_ifindex().

+ Here is the call graph for this function: