libnl 3.10.0
|
Data Structures | |
struct | bridge_info |
Macros | |
#define | VLAN_VID_MASK 0x0fff /* VLAN Identifier */ |
#define | BRIDGE_ATTR_VLAN_FILTERING (1 << 0) |
#define | BRIDGE_ATTR_VLAN_PROTOCOL (1 << 1) |
#define | BRIDGE_ATTR_VLAN_STATS_ENABLED (1 << 2) |
#define | BRIDGE_ATTR_AGEING_TIME (1 << 3) |
#define | BRIDGE_ATTR_VLAN_DEFAULT_PVID (1 << 4) |
#define | BRIDGE_ATTR_NF_CALL_IPTABLES (1 << 5) |
#define | BRIDGE_ATTR_NF_CALL_IP6TABLES (1 << 6) |
#define | BRIDGE_ATTR_NF_CALL_ARPTABLES (1 << 7) |
#define | IS_BRIDGE_INFO_ASSERT(link) |
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 , RTNL_BRIDGE_UNICAST_FLOOD = 0x0010 , RTNL_BRIDGE_LEARNING = 0x0020 , RTNL_BRIDGE_LEARNING_SYNC = 0x0040 } |
Bridge flags. More... | |
Functions | |
struct rtnl_link * | rtnl_link_bridge_alloc (void) |
Allocate link object of type bridge. | |
int | rtnl_link_bridge_add (struct nl_sock *sk, const char *name) |
Create a new kernel bridge device. | |
int | rtnl_link_is_bridge (struct rtnl_link *link) |
Check if a link is a bridge. | |
int | rtnl_link_bridge_has_ext_info (struct rtnl_link *link) |
Check if bridge has extended information. | |
int | rtnl_link_bridge_set_port_state (struct rtnl_link *link, uint8_t state) |
Set Spanning Tree Protocol (STP) port state. | |
int | rtnl_link_bridge_get_port_state (struct rtnl_link *link) |
Get Spanning Tree Protocol (STP) port state. | |
int | rtnl_link_bridge_set_priority (struct rtnl_link *link, uint16_t prio) |
Set priority. | |
int | rtnl_link_bridge_get_priority (struct rtnl_link *link) |
Get priority. | |
int | rtnl_link_bridge_set_cost (struct rtnl_link *link, uint32_t cost) |
Set Spanning Tree Protocol (STP) path cost. | |
int | rtnl_link_bridge_get_cost (struct rtnl_link *link, uint32_t *cost) |
Get Spanning Tree Protocol (STP) path cost. | |
int | rtnl_link_bridge_unset_flags (struct rtnl_link *link, unsigned int flags) |
Unset flags. | |
int | rtnl_link_bridge_set_flags (struct rtnl_link *link, unsigned int flags) |
Set flags. | |
int | rtnl_link_bridge_get_flags (struct rtnl_link *link) |
Get flags. | |
int | rtnl_link_bridge_set_self (struct rtnl_link *link) |
Set link change type to self. | |
int | rtnl_link_bridge_set_master (struct rtnl_link *link) |
Set link change type to master. | |
int | rtnl_link_bridge_get_hwmode (struct rtnl_link *link, uint16_t *hwmode) |
Get hardware mode. | |
int | rtnl_link_bridge_set_hwmode (struct rtnl_link *link, uint16_t hwmode) |
Set hardware mode. | |
int | rtnl_link_bridge_enable_vlan (struct rtnl_link *link) |
Enable the ability to set vlan info. | |
int | rtnl_link_bridge_pvid (struct rtnl_link *link) |
int | rtnl_link_bridge_has_vlan (struct rtnl_link *link) |
struct rtnl_link_bridge_vlan * | rtnl_link_bridge_get_port_vlan (struct rtnl_link *link) |
void | rtnl_link_bridge_set_ageing_time (struct rtnl_link *link, uint32_t ageing_time) |
Set ageing time for dynamic forwarding entries. | |
int | rtnl_link_bridge_get_ageing_time (struct rtnl_link *link, uint32_t *ageing_time) |
Get ageing time for dynamic forwarding entries. | |
void | rtnl_link_bridge_set_vlan_filtering (struct rtnl_link *link, uint8_t vlan_filtering) |
Set VLAN filtering flag. | |
int | rtnl_link_bridge_get_vlan_filtering (struct rtnl_link *link, uint8_t *vlan_filtering) |
Get VLAN filtering flag. | |
void | rtnl_link_bridge_set_vlan_protocol (struct rtnl_link *link, uint16_t vlan_protocol) |
Set VLAN protocol. | |
int | rtnl_link_bridge_get_vlan_protocol (struct rtnl_link *link, uint16_t *vlan_protocol) |
Get VLAN protocol. | |
void | rtnl_link_bridge_set_vlan_default_pvid (struct rtnl_link *link, uint16_t default_pvid) |
Set VLAN default pvid. | |
int | rtnl_link_bridge_get_vlan_default_pvid (struct rtnl_link *link, uint16_t *default_pvid) |
Get VLAN default pvid. | |
void | rtnl_link_bridge_set_vlan_stats_enabled (struct rtnl_link *link, uint8_t vlan_stats_enabled) |
Set VLAN stats enabled flag. | |
int | rtnl_link_bridge_get_vlan_stats_enabled (struct rtnl_link *link, uint8_t *vlan_stats_enabled) |
Get VLAN stats enabled flag. | |
void | rtnl_link_bridge_set_nf_call_iptables (struct rtnl_link *link, uint8_t call_enabled) |
Set call enabled flag for passing IPv4 traffic to iptables. | |
void | rtnl_link_bridge_set_nf_call_ip6tables (struct rtnl_link *link, uint8_t call_enabled) |
Set call enabled flag for passing IPv6 traffic to ip6tables. | |
void | rtnl_link_bridge_set_nf_call_arptables (struct rtnl_link *link, uint8_t call_enabled) |
Set call enabled flag for passing ARP traffic to arptables. | |
Flag Translation | |
char * | rtnl_link_bridge_flags2str (int flags, char *buf, size_t len) |
int | rtnl_link_bridge_str2flags (const char *name) |
Port State Translation | |
char * | rtnl_link_bridge_portstate2str (int st, char *buf, size_t len) |
int | rtnl_link_bridge_str2portstate (const char *name) |
Hardware Mode Translation | |
char * | rtnl_link_bridge_hwmode2str (uint16_t st, char *buf, size_t len) |
uint16_t | rtnl_link_bridge_str2hwmode (const char *name) |
Quality of Service | |
int | rtnl_link_bridge_set_port_vlan_map_range (struct rtnl_link *link, uint16_t start, uint16_t end, int untagged) |
Set port vlan membership range. | |
int | rtnl_link_bridge_unset_port_vlan_map_range (struct rtnl_link *link, uint16_t start, uint16_t end) |
Unset port vlan membership range. | |
int | rtnl_link_bridge_set_port_vlan_pvid (struct rtnl_link *link, uint16_t pvid) |
Set port primary vlan id. | |
#define BRIDGE_ATTR_VLAN_FILTERING (1 << 0) |
Definition at line 21 of file bridge_info.c.
#define BRIDGE_ATTR_VLAN_PROTOCOL (1 << 1) |
Definition at line 22 of file bridge_info.c.
#define BRIDGE_ATTR_VLAN_STATS_ENABLED (1 << 2) |
Definition at line 23 of file bridge_info.c.
#define BRIDGE_ATTR_AGEING_TIME (1 << 3) |
Definition at line 24 of file bridge_info.c.
#define BRIDGE_ATTR_VLAN_DEFAULT_PVID (1 << 4) |
Definition at line 25 of file bridge_info.c.
#define BRIDGE_ATTR_NF_CALL_IPTABLES (1 << 5) |
Definition at line 26 of file bridge_info.c.
#define BRIDGE_ATTR_NF_CALL_IP6TABLES (1 << 6) |
Definition at line 27 of file bridge_info.c.
#define BRIDGE_ATTR_NF_CALL_ARPTABLES (1 << 7) |
Definition at line 28 of file bridge_info.c.
#define IS_BRIDGE_INFO_ASSERT | ( | link | ) |
Definition at line 202 of file bridge_info.c.
struct rtnl_link * rtnl_link_bridge_alloc | ( | void | ) |
Allocate link object of type bridge.
Definition at line 618 of file bridge.c.
References rtnl_link_alloc(), rtnl_link_put(), and rtnl_link_set_type().
Referenced by rtnl_link_bridge_add().
int rtnl_link_bridge_add | ( | struct nl_sock * | sk, |
const char * | name ) |
Create a new kernel bridge device.
sk | netlink socket |
name | name 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.)
Definition at line 644 of file bridge.c.
References rtnl_link_add(), rtnl_link_bridge_alloc(), rtnl_link_put(), and rtnl_link_set_name().
int rtnl_link_is_bridge | ( | struct rtnl_link * | link | ) |
Check if a link is a bridge.
link | Link object |
Definition at line 667 of file bridge.c.
Referenced by rtnl_link_bridge_has_ext_info().
int rtnl_link_bridge_has_ext_info | ( | struct rtnl_link * | link | ) |
Check if bridge has extended information.
link | Link 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:
Definition at line 686 of file bridge.c.
References rtnl_link_is_bridge().
int rtnl_link_bridge_set_port_state | ( | struct rtnl_link * | link, |
uint8_t | state ) |
Set Spanning Tree Protocol (STP) port state.
link | Link object of type bridge |
state | New STP port state |
The value of state must be one of the following:
-NLE_OPNOTSUPP | Link is not a bridge |
-NLE_INVAL | Invalid state value (0..BR_STATE_BLOCKING) |
int rtnl_link_bridge_get_port_state | ( | struct rtnl_link * | link | ) |
Get Spanning Tree Protocol (STP) port state.
link | Link object of type bridge |
-NLE_OPNOTSUPP | Link is not a bridge |
int rtnl_link_bridge_set_priority | ( | struct rtnl_link * | link, |
uint16_t | prio ) |
Set priority.
link | Link object of type bridge |
prio | Bridge priority |
-NLE_OPNOTSUPP | Link is not a bridge |
int rtnl_link_bridge_get_priority | ( | struct rtnl_link * | link | ) |
Get priority.
link | Link object of type bridge |
-NLE_OPNOTSUPP | Link is not a bridge |
int rtnl_link_bridge_set_cost | ( | struct rtnl_link * | link, |
uint32_t | cost ) |
Set Spanning Tree Protocol (STP) path cost.
link | Link object of type bridge |
cost | New STP path cost value |
-NLE_OPNOTSUPP | Link is not a bridge |
int rtnl_link_bridge_get_cost | ( | struct rtnl_link * | link, |
uint32_t * | cost ) |
Get Spanning Tree Protocol (STP) path cost.
link | Link object of type bridge |
cost | Pointer to store STP cost value |
-NLE_OPNOTSUPP | Link is not a bridge |
-NLE_INVAL | cost is not a valid pointer |
int rtnl_link_bridge_unset_flags | ( | struct rtnl_link * | link, |
unsigned int | flags ) |
Unset flags.
link | Link object of type bridge |
flags | Bridging flags to unset |
-NLE_OPNOTSUPP | Link is not a bridge |
int rtnl_link_bridge_set_flags | ( | struct rtnl_link * | link, |
unsigned int | flags ) |
Set flags.
link | Link object of type bridge |
flags | Bridging flags to set |
Valid flags are:
-NLE_OPNOTSUPP | Link is not a bridge |
int rtnl_link_bridge_get_flags | ( | struct rtnl_link * | link | ) |
Get flags.
link | Link object of type bridge |
-NLE_OPNOTSUPP | Link is not a bridge |
int rtnl_link_bridge_set_self | ( | struct rtnl_link * | link | ) |
Set link change type to self.
link | Link Object of type bridge |
This will set the bridge change flag to self, meaning that changes to be applied with this link object will be applied directly to the physical device in a bridge instead of the virtual device.
Definition at line 922 of file bridge.c.
Referenced by rtnl_link_bridge_set_hwmode().
int rtnl_link_bridge_set_master | ( | struct rtnl_link * | link | ) |
Set link change type to master.
link | Link Object of type bridge |
This will set the bridge change flag to master, meaning that changes to be applied with this link object will be applied directly to the virtual device in a bridge instead of the physical device.
int rtnl_link_bridge_get_hwmode | ( | struct rtnl_link * | link, |
uint16_t * | hwmode ) |
Get hardware mode.
link | Link object of type bridge |
hwmode | Output argument. |
int rtnl_link_bridge_set_hwmode | ( | struct rtnl_link * | link, |
uint16_t | hwmode ) |
Set hardware mode.
link | Link object of type bridge |
hwmode | Hardware mode to set on link |
This will set the hardware mode of a link when it supports hardware offloads for bridging.
Valid modes are:
When setting hardware mode, the change type will be set to self.
Definition at line 1001 of file bridge.c.
References rtnl_link_bridge_set_self().
char * rtnl_link_bridge_flags2str | ( | int | flags, |
char * | buf, | ||
size_t | len ) |
char * rtnl_link_bridge_portstate2str | ( | int | st, |
char * | buf, | ||
size_t | len ) |
char * rtnl_link_bridge_hwmode2str | ( | uint16_t | st, |
char * | buf, | ||
size_t | len ) |
int rtnl_link_bridge_enable_vlan | ( | struct rtnl_link * | link | ) |
int rtnl_link_bridge_set_port_vlan_map_range | ( | struct rtnl_link * | link, |
uint16_t | start, | ||
uint16_t | end, | ||
int | untagged ) |
Set port vlan membership range.
link | Link object of type bridge |
start | Start of membership range. |
end | End of membership range. |
untagged | Set membership range to be untagged. |
This will set the vlan membership range for a bridge port. This will unset the untagged membership if untagged is false. Supported range is 1-4094
int rtnl_link_bridge_unset_port_vlan_map_range | ( | struct rtnl_link * | link, |
uint16_t | start, | ||
uint16_t | end ) |
Unset port vlan membership range.
link | Link object of type bridge |
start | Start of membership range. |
end | End of membership range. |
This will unset the vlan membership range for a bridge port for both tagged and untagged membership. Supported range is 1-4094
int rtnl_link_bridge_set_port_vlan_pvid | ( | struct rtnl_link * | link, |
uint16_t | pvid ) |
Set port primary vlan id.
link | Link object of type bridge |
pvid | PVID to set. |
untagged | Set vlan id to be untagged. |
This will set the primary vlan id for a bridge port. Supported range is 0-4094, Setting pvid to 0 will unset it. You will most likely want to set/unset pvid in the vlan map.
struct rtnl_link_bridge_vlan * rtnl_link_bridge_get_port_vlan | ( | struct rtnl_link * | link | ) |
void rtnl_link_bridge_set_ageing_time | ( | struct rtnl_link * | link, |
uint32_t | ageing_time ) |
Set ageing time for dynamic forwarding entries.
link | Link object of type bridge |
ageing_time | Interval to set. |
Definition at line 216 of file bridge_info.c.
int rtnl_link_bridge_get_ageing_time | ( | struct rtnl_link * | link, |
uint32_t * | ageing_time ) |
Get ageing time for dynamic forwarding entries.
link | Link object of type bridge |
ageing_time | Output argument. |
-NLE_NOATTR | |
-NLE_INVAL |
Definition at line 238 of file bridge_info.c.
void rtnl_link_bridge_set_vlan_filtering | ( | struct rtnl_link * | link, |
uint8_t | vlan_filtering ) |
Set VLAN filtering flag.
link | Link object of type bridge |
vlan_filtering | VLAN_filtering boolean flag to set. |
Definition at line 265 of file bridge_info.c.
int rtnl_link_bridge_get_vlan_filtering | ( | struct rtnl_link * | link, |
uint8_t * | vlan_filtering ) |
Get VLAN filtering flag.
link | Link object of type bridge |
vlan_filtering | Output argument. |
-NLE_NOATTR | |
-NLE_INVAL |
Definition at line 288 of file bridge_info.c.
void rtnl_link_bridge_set_vlan_protocol | ( | struct rtnl_link * | link, |
uint16_t | vlan_protocol ) |
Set VLAN protocol.
link | Link object of type bridge |
vlan_protocol | VLAN protocol to set. The protocol numbers is in host byte order. |
Definition at line 315 of file bridge_info.c.
int rtnl_link_bridge_get_vlan_protocol | ( | struct rtnl_link * | link, |
uint16_t * | vlan_protocol ) |
Get VLAN protocol.
link | Link object of type bridge |
vlan_protocol | Output argument. The protocol number is in host byte order. |
-NLE_NOATTR | |
-NLE_INVAL |
Definition at line 338 of file bridge_info.c.
void rtnl_link_bridge_set_vlan_default_pvid | ( | struct rtnl_link * | link, |
uint16_t | default_pvid ) |
Set VLAN default pvid.
link | Link object of type bridge |
default | pvid VLAN default pvid to set. |
Definition at line 365 of file bridge_info.c.
int rtnl_link_bridge_get_vlan_default_pvid | ( | struct rtnl_link * | link, |
uint16_t * | default_pvid ) |
Get VLAN default pvid.
link | Link object of type bridge |
default_pvid | Output argument. |
-NLE_NOATTR | |
-NLE_INVAL |
Definition at line 388 of file bridge_info.c.
void rtnl_link_bridge_set_vlan_stats_enabled | ( | struct rtnl_link * | link, |
uint8_t | vlan_stats_enabled ) |
Set VLAN stats enabled flag.
link | Link object of type bridge |
vlan_stats_enabled | VLAN stats enabled flag to set |
Definition at line 415 of file bridge_info.c.
int rtnl_link_bridge_get_vlan_stats_enabled | ( | struct rtnl_link * | link, |
uint8_t * | vlan_stats_enabled ) |
Get VLAN stats enabled flag.
link | Link object of type bridge |
vlan_stats_enabled | Output argument. |
-NLE_NOATTR | |
-NLE_INVAL |
Definition at line 438 of file bridge_info.c.
void rtnl_link_bridge_set_nf_call_iptables | ( | struct rtnl_link * | link, |
uint8_t | call_enabled ) |
Set call enabled flag for passing IPv4 traffic to iptables.
link | Link object of type bridge |
call_enabled | call enabled boolean flag to set. |
Definition at line 463 of file bridge_info.c.
void rtnl_link_bridge_set_nf_call_ip6tables | ( | struct rtnl_link * | link, |
uint8_t | call_enabled ) |
Set call enabled flag for passing IPv6 traffic to ip6tables.
link | Link object of type bridge |
call_enabled | call enabled boolean flag to set. |
Definition at line 482 of file bridge_info.c.
void rtnl_link_bridge_set_nf_call_arptables | ( | struct rtnl_link * | link, |
uint8_t | call_enabled ) |
Set call enabled flag for passing ARP traffic to arptables.
link | Link object of type bridge |
call_enabled | call enabled boolean flag to set. |
Definition at line 501 of file bridge_info.c.