libnl  3.2.28

Macros

#define VLAN_VID_MASK   0x0fff /* VLAN Identifier */
 

Enumerations

enum  rtnl_link_bridge_flags {
  RTNL_BRIDGE_HAIRPIN_MODE = 0x0001,
  RTNL_BRIDGE_BPDU_GUARD = 0x0002,
  RTNL_BRIDGE_ROOT_BLOCK = 0x0004,
  RTNL_BRIDGE_FAST_LEAVE = 0x0008
}
 Bridge flags.
 

Functions

struct rtnl_linkrtnl_link_bridge_alloc (void)
 Allocate link object of type bridge. More...
 
int rtnl_link_bridge_add (struct nl_sock *sk, const char *name)
 Create a new kernel bridge device. More...
 
int rtnl_link_is_bridge (struct rtnl_link *link)
 Check if a link is a bridge. More...
 
int rtnl_link_bridge_has_ext_info (struct rtnl_link *link)
 Check if bridge has extended information. More...
 
int rtnl_link_bridge_set_port_state (struct rtnl_link *link, uint8_t state)
 Set Spanning Tree Protocol (STP) port state. More...
 
int rtnl_link_bridge_get_port_state (struct rtnl_link *link)
 Get Spanning Tree Protocol (STP) port state. More...
 
int rtnl_link_bridge_set_priority (struct rtnl_link *link, uint16_t prio)
 Set priority. More...
 
int rtnl_link_bridge_get_priority (struct rtnl_link *link)
 Get priority. More...
 
int rtnl_link_bridge_set_cost (struct rtnl_link *link, uint32_t cost)
 Set Spanning Tree Protocol (STP) path cost. More...
 
int rtnl_link_bridge_get_cost (struct rtnl_link *link, uint32_t *cost)
 Get Spanning Tree Protocol (STP) path cost. More...
 
int rtnl_link_bridge_unset_flags (struct rtnl_link *link, unsigned int flags)
 Unset flags. More...
 
int rtnl_link_bridge_set_flags (struct rtnl_link *link, unsigned int flags)
 Set flags. More...
 
int rtnl_link_bridge_get_flags (struct rtnl_link *link)
 Get flags. More...
 
int rtnl_link_bridge_pvid (struct rtnl_link *link)
 
int rtnl_link_bridge_has_vlan (struct rtnl_link *link)
 
struct rtnl_link_bridge_vlanrtnl_link_bridge_get_port_vlan (struct rtnl_link *link)
 

Flag Translation

char * rtnl_link_bridge_flags2str (int flags, char *buf, size_t len)
 
int rtnl_link_bridge_str2flags (const char *name)
 

Detailed Description

Function Documentation

struct rtnl_link* rtnl_link_bridge_alloc ( void  )

Allocate link object of type bridge.

Returns
Allocated link object or NULL.

Definition at line 358 of file bridge.c.

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

Referenced by rtnl_link_bridge_add().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int rtnl_link_bridge_add ( struct nl_sock *  sk,
const char *  name 
)

Create a new kernel bridge device.

Parameters
sknetlink socket
namename of the bridge device or NULL

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

Returns
0 on success or a negative error code

Definition at line 385 of file bridge.c.

References rtnl_link_add(), rtnl_link_bridge_alloc(), rtnl_link_put(), and rtnl_link_set_name().

+ Here is the call graph for this function:

int rtnl_link_is_bridge ( struct rtnl_link link)

Check if a link is a bridge.

Parameters
linkLink object
Returns
1 if the link is a bridge, 0 otherwise.

Definition at line 408 of file bridge.c.

Referenced by rtnl_link_bridge_get_flags(), and rtnl_link_bridge_has_ext_info().

+ Here is the caller graph for this function:

int rtnl_link_bridge_has_ext_info ( struct rtnl_link link)

Check if bridge has extended information.

Parameters
linkLink object of type bridge

Checks if the bridge object has been constructed based on information that is only available in newer kernels. This affectes the following functions:

Returns
1 if extended information is available, otherwise 0 is returned.

Definition at line 427 of file bridge.c.

References rtnl_link_is_bridge().

+ Here is the call graph for this function:

int rtnl_link_bridge_set_port_state ( struct rtnl_link link,
uint8_t  state 
)

Set Spanning Tree Protocol (STP) port state.

Parameters
linkLink object of type bridge
stateNew STP port state

The value of state must be one of the following:

  • BR_STATE_DISABLED
  • BR_STATE_LISTENING
  • BR_STATE_LEARNING
  • BR_STATE_FORWARDING
  • BR_STATE_BLOCKING
See also
rtnl_link_bridge_get_port_state()
Returns
0 on success or a negative error code.
Return values
-NLE_OPNOTSUPPLink is not a bridge
-NLE_INVALInvalid state value (0..BR_STATE_BLOCKING)

Definition at line 456 of file bridge.c.

int rtnl_link_bridge_get_port_state ( struct rtnl_link link)

Get Spanning Tree Protocol (STP) port state.

Parameters
linkLink object of type bridge
See also
rtnl_link_bridge_set_port_state()
Returns
The STP port state or a negative error code.
Return values
-NLE_OPNOTSUPPLink is not a bridge

Definition at line 480 of file bridge.c.

int rtnl_link_bridge_set_priority ( struct rtnl_link link,
uint16_t  prio 
)

Set priority.

Parameters
linkLink object of type bridge
prioBridge priority
See also
rtnl_link_bridge_get_priority()
Returns
0 on success or a negative error code.
Return values
-NLE_OPNOTSUPPLink is not a bridge

Definition at line 499 of file bridge.c.

int rtnl_link_bridge_get_priority ( struct rtnl_link link)

Get priority.

Parameters
linkLink object of type bridge
See also
rtnl_link_bridge_set_priority()
Returns
0 on success or a negative error code.
Return values
-NLE_OPNOTSUPPLink is not a bridge

Definition at line 520 of file bridge.c.

int rtnl_link_bridge_set_cost ( struct rtnl_link link,
uint32_t  cost 
)

Set Spanning Tree Protocol (STP) path cost.

Parameters
linkLink object of type bridge
costNew STP path cost value
See also
rtnl_link_bridge_get_cost()
Returns
The bridge priority or a negative error code.
Return values
-NLE_OPNOTSUPPLink is not a bridge

Definition at line 539 of file bridge.c.

int rtnl_link_bridge_get_cost ( struct rtnl_link link,
uint32_t *  cost 
)

Get Spanning Tree Protocol (STP) path cost.

Parameters
linkLink object of type bridge
costPointer to store STP cost value
See also
rtnl_link_bridge_set_cost()
Returns
0 on success or a negative error code.
Return values
-NLE_OPNOTSUPPLink is not a bridge
-NLE_INVALcost is not a valid pointer

Definition at line 562 of file bridge.c.

int rtnl_link_bridge_unset_flags ( struct rtnl_link link,
unsigned int  flags 
)

Unset flags.

Parameters
linkLink object of type bridge
flagsBridging flags to unset
See also
rtnl_link_bridge_set_flags()
rtnl_link_bridge_get_flags()
Returns
0 on success or a negative error code.
Return values
-NLE_OPNOTSUPPLink is not a bridge

Definition at line 587 of file bridge.c.

int rtnl_link_bridge_set_flags ( struct rtnl_link link,
unsigned int  flags 
)

Set flags.

Parameters
linkLink object of type bridge
flagsBridging flags to set

Valid flags are:

  • RTNL_BRIDGE_HAIRPIN_MODE
  • RTNL_BRIDGE_BPDU_GUARD
  • RTNL_BRIDGE_ROOT_BLOCK
  • RTNL_BRIDGE_FAST_LEAVE
See also
rtnl_link_bridge_unset_flags()
rtnl_link_bridge_get_flags()
Returns
0 on success or a negative error code.
Return values
-NLE_OPNOTSUPPLink is not a bridge

Definition at line 617 of file bridge.c.

int rtnl_link_bridge_get_flags ( struct rtnl_link link)

Get flags.

Parameters
linkLink object of type bridge
See also
rtnl_link_bridge_set_flags()
rtnl_link_bridge_unset_flags()
Returns
Flags or a negative error code.
Return values
-NLE_OPNOTSUPPLink is not a bridge

Definition at line 640 of file bridge.c.

References NL_DUMP_DETAILS, rtnl_link_af_register(), rtnl_link_af_unregister(), and rtnl_link_is_bridge().

+ Here is the call graph for this function: