libnl: VLAN

libnl 3.7.0

VLAN
Routing Library (libnl-route) » Links (Interfaces)

Virtual LAN link module. More...

## VLAN Object
struct rtnl_link * | rtnl_link_vlan_alloc (void)
| Allocate link object of type VLAN. More...
int | rtnl_link_is_vlan (struct rtnl_link *link)
| Check if link is a VLAN link. More...
int | rtnl_link_vlan_set_id (struct rtnl_link *link, uint16_t id)
| Set VLAN ID. More...
int | rtnl_link_vlan_get_id (struct rtnl_link *link)
| Get VLAN Id. More...
int | rtnl_link_vlan_set_protocol (struct rtnl_link *link, uint16_t protocol)
| Set VLAN protocol. More...
int | rtnl_link_vlan_get_protocol (struct rtnl_link *link)
| Get VLAN protocol. More...
int | rtnl_link_vlan_set_flags (struct rtnl_link *link, unsigned int flags)
| Set VLAN flags. More...
int | rtnl_link_vlan_unset_flags (struct rtnl_link *link, unsigned int flags)
| Unset VLAN flags. More...
int | rtnl_link_vlan_get_flags (struct rtnl_link *link)
| Get VLAN flags. More...

## Quality of Service
int | rtnl_link_vlan_set_ingress_map (struct rtnl_link *link, int from, uint32_t to)
uint32_t * | rtnl_link_vlan_get_ingress_map (struct rtnl_link *link)
int | rtnl_link_vlan_set_egress_map (struct rtnl_link *link, uint32_t from, int to)
struct vlan_map * | rtnl_link_vlan_get_egress_map (struct rtnl_link *link, int *negress)

## Flag Translation
char * | rtnl_link_vlan_flags2str (int flags, char *buf, size_t len)
int | rtnl_link_vlan_str2flags (const char *name)

## Detailed Description

Virtual LAN link module.

Link Type Name: "vlan"

VLAN Documentation (Netlink Routing Development Guide)

## Function Documentation

## ◆ rtnl_link_vlan_alloc()

struct rtnl_link* rtnl_link_vlan_alloc | ( | void |  | ) |

Allocate link object of type VLAN.

Returns
  Allocated link object or NULL.

Definition at line 386 of file vlan.c.

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

Here is the call graph for this function:

## ◆ rtnl_link_is_vlan()

int rtnl_link_is_vlan | ( | struct rtnl_link * | link | ) |

Check if link is a VLAN link.

Parameters

  link | Link object

Returns
  True if link is a VLAN link, otherwise false is returned.

Definition at line 407 of file vlan.c.

## ◆ rtnl_link_vlan_set_id()

int rtnl_link_vlan_set_id | ( | struct rtnl_link * | link,
|  | uint16_t | id
| ) |  |

Set VLAN ID.

Parameters

  link | Link object
  id | VLAN identifier

Returns
  0 on success or a negative error code

Definition at line 419 of file vlan.c.

## ◆ rtnl_link_vlan_get_id()

int rtnl_link_vlan_get_id | ( | struct rtnl_link * | link | ) |

Get VLAN Id.

Parameters

  link | Link object

Returns
  VLAN id, 0 if not set or a negative error code.

Definition at line 437 of file vlan.c.

## ◆ rtnl_link_vlan_set_protocol()

int rtnl_link_vlan_set_protocol | ( | struct rtnl_link * | link,
|  | uint16_t | protocol
| ) |  |

Set VLAN protocol.

Parameters

  link | Link object
  protocol | VLAN protocol in network byte order. Probably you want to set it to something like htons(ETH_P_8021Q).

Returns
  0 on success or a negative error code

Definition at line 457 of file vlan.c.

## ◆ rtnl_link_vlan_get_protocol()

int rtnl_link_vlan_get_protocol | ( | struct rtnl_link * | link | ) |

Get VLAN protocol.

Parameters

  link | Link object

Returns
  VLAN protocol in network byte order like htons(ETH_P_8021Q), 0 if not set or a negative error code.

Definition at line 476 of file vlan.c.

## ◆ rtnl_link_vlan_set_flags()

int rtnl_link_vlan_set_flags | ( | struct rtnl_link * | link,
|  | unsigned int | flags
| ) |  |

Set VLAN flags.

Parameters

  link | Link object
  flags | VLAN flags

Returns
  0 on success or a negative error code.

Definition at line 495 of file vlan.c.

## ◆ rtnl_link_vlan_unset_flags()

int rtnl_link_vlan_unset_flags | ( | struct rtnl_link * | link,
|  | unsigned int | flags
| ) |  |

Unset VLAN flags.

Parameters

  link | Link object
  flags | VLAN flags

Returns
  0 on success or a negative error code.

Definition at line 515 of file vlan.c.

## ◆ rtnl_link_vlan_get_flags()

int rtnl_link_vlan_get_flags | ( | struct rtnl_link * | link | ) |

Get VLAN flags.

Parameters

  link | Link object

Returns
  VLAN flags, 0 if none set, or a negative error code.

Definition at line 534 of file vlan.c.