libnl 3.7.0

Modules

 GACT Editing
 
 Mirror and Redirect
 
 NAT
 
 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_next()

struct rtnl_act * rtnl_act_next ( struct rtnl_act *  act)

Definition at line 25 of file act.c.

◆ rtnl_act_append()

int rtnl_act_append ( struct rtnl_act **  head,
struct rtnl_act *  new 
)

Definition at line 34 of file act.c.

◆ rtnl_act_remove()

int rtnl_act_remove ( struct rtnl_act **  head,
struct rtnl_act *  act 
)

Definition at line 57 of file act.c.

◆ rtnl_act_fill()

int rtnl_act_fill ( struct nl_msg *  msg,
int  attrtype,
struct rtnl_act *  act 
)

Definition at line 110 of file act.c.

◆ rtnl_act_alloc()

struct rtnl_act * rtnl_act_alloc ( void  )

Definition at line 175 of file act.c.

◆ rtnl_act_get()

void rtnl_act_get ( struct rtnl_act *  act)

Definition at line 186 of file act.c.

◆ rtnl_act_put()

void rtnl_act_put ( struct rtnl_act *  act)

Definition at line 191 of file act.c.

◆ 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
actAction to add
flagsAdditional netlink message flags
resultPointer 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 217 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
skNetlink socket
actAction to add/update
flagsAdditional 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 256 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
actAction to change
flagsadditional netlink message flags
resultPointer 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 280 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
skNetlink socket.
actaction to change
flagsadditional 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 success or a negative error if an error occured.

Definition at line 298 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
actAction to delete
flagsAdditional netlink message flags
resultPointer 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 323 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
skNetlink socket
actAction to delete
flagsAdditional 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 360 of file act.c.

References nl_send_sync(), and rtnl_act_build_delete_request().

+ Here is the call graph for this function:

◆ rtnl_act_put_all()

void rtnl_act_put_all ( struct rtnl_act **  head)

Definition at line 377 of file act.c.

◆ rtnl_act_parse()

int rtnl_act_parse ( struct rtnl_act **  head,
struct nlattr *  tb 
)

Definition at line 390 of file act.c.