libnl 3.5.0

Modules | Functions
Action
Routing Library (libnl-route) » Traffic Control

## Modules
| GACT Editing
| Mirror and Redirect
| SKB Editing
| VLAN Manipulation

## Functions
struct rtnl_act * | rtnl_act_next (struct rtnl_act *act)
int | rtnl_act_append (struct rtnl_act **head, struct rtnl_act *new)
int | rtnl_act_remove (struct rtnl_act **head, struct rtnl_act *act)
int | rtnl_act_fill (struct nl_msg *msg, int attrtype, struct rtnl_act *act)
void | rtnl_act_put_all (struct rtnl_act **head)
int | rtnl_act_parse (struct rtnl_act **head, struct nlattr *tb)

## Allocation/Freeing
struct rtnl_act * | rtnl_act_alloc (void)
void | rtnl_act_get (struct rtnl_act *act)
void | rtnl_act_put (struct rtnl_act *act)

## Addition/Modification/Deletion
int | rtnl_act_build_add_request (struct rtnl_act *act, int flags, struct nl_msg **result)
| Build a netlink message requesting the addition of an action. More...
int | rtnl_act_add (struct nl_sock *sk, struct rtnl_act *act, int flags)
| Add/Update action. More...
int | rtnl_act_build_change_request (struct rtnl_act *act, int flags, struct nl_msg **result)
| Build a netlink message to change action attributes. More...
int | rtnl_act_change (struct nl_sock *sk, struct rtnl_act *act, int flags)
| Change an action. More...
int | rtnl_act_build_delete_request (struct rtnl_act *act, int flags, struct nl_msg **result)
| Build netlink message requesting the deletion of an action. More...
int | rtnl_act_delete (struct nl_sock *sk, struct rtnl_act *act, int flags)
| Delete action. More...

## Detailed Description

## Function Documentation

## ◆ rtnl_act_build_add_request()

int rtnl_act_build_add_request | ( | struct rtnl_act * | act,
|  | int | flags,
|  | struct nl_msg ** | result
| ) |  |

Build a netlink message requesting the addition of an action.

Parameters

  act | Action to add
  flags | Additional netlink message flags
  result | Pointer to store resulting netlink message

The behaviour of this function is identical to rtnl_act_add() with the exception that it will not send the message but return it int the provided return pointer instead.

See also
  rtnl_act_add()

Returns
  0 on success or a negative error code.

Definition at line 223 of file act.c.

Referenced by rtnl_act_add().

Here is the caller graph for this function:

## ◆ rtnl_act_add()

int rtnl_act_add | ( | struct nl_sock * | sk,
|  | struct rtnl_act * | act,
|  | int | flags
| ) |  |

Add/Update action.

Parameters

  sk | Netlink socket
  act | Action to add/update
  flags | Additional netlink message flags

Builds a `RTM_NEWACTION` netlink message requesting the addition of a new action and sends the message to the kernel. The configuration of the action is derived from the attributes of the specified traffic class.

The following flags may be specified:

- `NLM_F_CREATE:` Create action if it does not exist, otherwise -NLE_OBJ_NOTFOUND is returned.
- `NLM_F_EXCL:` Return -NLE_EXISTS if an action with matching handle exists already.

Existing actions with matching handles will be updated, unless the flag `NLM_F_EXCL` is specified. If no matching action exists, it will be created if the flag `NLM_F_CREATE` is set, otherwise the error -NLE_OBJ_NOTFOUND is returned.

After sending, the function will wait for the ACK or an eventual error message to be received and will therefore block until the operation has been completed.

Note
  Disabling auto-ack (nl_socket_disable_auto_ack()) will cause this function to return immediately after sending. In this case, it is the responsibility of the caller to handle any error messages returned.

Returns
  0 on success or a negative error code.

Definition at line 262 of file act.c.

References nl_send_sync(), and rtnl_act_build_add_request().

Here is the call graph for this function:

## ◆ rtnl_act_build_change_request()

int rtnl_act_build_change_request | ( | struct rtnl_act * | act,
|  | int | flags,
|  | struct nl_msg ** | result
| ) |  |

Build a netlink message to change action attributes.

Parameters

  act | Action to change
  flags | additional netlink message flags
  result | Pointer to store resulting message.

Builds a new netlink message requesting a change of a neigh attributes. The netlink message header isn't fully equipped with all relevant fields and must thus be sent out via nl_send_auto_complete() or supplemented as needed.

Returns
  0 on success or a negative error code.

Definition at line 286 of file act.c.

Referenced by rtnl_act_change().

Here is the caller graph for this function:

## ◆ rtnl_act_change()

int rtnl_act_change | ( | struct nl_sock * | sk,
|  | struct rtnl_act * | act,
|  | int | flags
| ) |  |

Change an action.

Parameters

  sk | Netlink socket.
  act | action to change
  flags | additional netlink message flags

Builds a netlink message by calling rtnl_act_build_change_request(), sends the request to the kernel and waits for the next ACK to be received and thus blocks until the request has been processed.

Returns
  0 on sucess or a negative error if an error occured.

Definition at line 304 of file act.c.

References nl_send_sync(), and rtnl_act_build_change_request().

Here is the call graph for this function:

## ◆ rtnl_act_build_delete_request()

int rtnl_act_build_delete_request | ( | struct rtnl_act * | act,
|  | int | flags,
|  | struct nl_msg ** | result
| ) |  |

Build netlink message requesting the deletion of an action.

Parameters

  act | Action to delete
  flags | Additional netlink message flags
  result | Pointer to store resulting netlink message

The behaviour of this function is identical to rtnl_act_delete() with the exception that it will not send the message but return it in the provided return pointer instead.

See also
  rtnl_act_delete()

Returns
  0 on success or a negative error code.

Definition at line 329 of file act.c.

Referenced by rtnl_act_delete().

Here is the caller graph for this function:

## ◆ rtnl_act_delete()

int rtnl_act_delete | ( | struct nl_sock * | sk,
|  | struct rtnl_act * | act,
|  | int | flags
| ) |  |

Delete action.

Parameters

  sk | Netlink socket
  act | Action to delete
  flags | Additional netlink message flags

Builds a `RTM_DELACTION` netlink message requesting the deletion of an action and sends the message to the kernel.

The message is constructed out of the following attributes:

- `ifindex` (required)
- `prio` (required)
- `protocol` (required)
- `handle` (required)
- `parent` (optional, if not specified parent equals root-qdisc)
- `kind` (optional, must match if provided)

All other action attributes including all class type specific attributes are ignored.

After sending, the function will wait for the ACK or an eventual error message to be received and will therefore block until the operation has been completed.

Note
  Disabling auto-ack (nl_socket_disable_auto_ack()) will cause this function to return immediately after sending. In this case, it is the responsibility of the caller to handle any error messages returned.

Returns
  0 on success or a negative error code.

Definition at line 366 of file act.c.

References nl_send_sync(), and rtnl_act_build_delete_request().

Here is the call graph for this function: