libnl  3.2.24-rc1
Queueing Disciplines

Modules

 (Fast) Prio
 
 Blackhole
 
 Class Based Queueing (CBQ)
 
 Differentiated Services Marker (DSMARK)
 
 Fair Queue CoDel
 
 Hierachical Token Bucket (HTB)
 
 Ingress qdisc
 
 Network Emulator
 For further documentation see http://linux-net.osdl.org/index.php/Netem.
 
 Packet/Bytes FIFO (pfifo/bfifo)
 The FIFO qdisc comes in two flavours:
 
 Plug/Unplug Traffic (PLUG)
 Queue traffic until an explicit release command.
 
 Random Early Detection (RED)
 
 Stochastic Fairness Queueing (SFQ)
 
 Token Bucket Filter (TBF)
 

Allocation/Freeing

struct rtnl_qdisc * rtnl_qdisc_alloc (void)
 
void rtnl_qdisc_put (struct rtnl_qdisc *qdisc)
 

Addition / Modification / Deletion

int rtnl_qdisc_build_add_request (struct rtnl_qdisc *qdisc, int flags, struct nl_msg **result)
 Build a netlink message requesting the addition of a qdisc. More...
 
int rtnl_qdisc_add (struct nl_sock *sk, struct rtnl_qdisc *qdisc, int flags)
 Add qdisc. More...
 
int rtnl_qdisc_build_update_request (struct rtnl_qdisc *qdisc, struct rtnl_qdisc *new, int flags, struct nl_msg **result)
 Build netlink message requesting the update of a qdisc. More...
 
int rtnl_qdisc_update (struct nl_sock *sk, struct rtnl_qdisc *qdisc, struct rtnl_qdisc *new, int flags)
 Update qdisc. More...
 
int rtnl_qdisc_build_delete_request (struct rtnl_qdisc *qdisc, struct nl_msg **result)
 Build netlink message requesting the deletion of a qdisc. More...
 
int rtnl_qdisc_delete (struct nl_sock *sk, struct rtnl_qdisc *qdisc)
 Delete qdisc. More...
 

Cache Related Functions

int rtnl_qdisc_alloc_cache (struct nl_sock *sk, struct nl_cache **result)
 Allocate a cache and fill it with all configured qdiscs. More...
 
struct rtnl_qdisc * rtnl_qdisc_get_by_parent (struct nl_cache *cache, int ifindex, uint32_t parent)
 Search qdisc by interface index and parent. More...
 
struct rtnl_qdisc * rtnl_qdisc_get (struct nl_cache *cache, int ifindex, uint32_t handle)
 Search qdisc by interface index and handle. More...
 

Deprecated Functions

void rtnl_qdisc_foreach_child (struct rtnl_qdisc *qdisc, struct nl_cache *cache, void(*cb)(struct nl_object *, void *), void *arg)
 Call a callback for each child class of a qdisc (deprecated) More...
 
void rtnl_qdisc_foreach_cls (struct rtnl_qdisc *qdisc, struct nl_cache *cache, void(*cb)(struct nl_object *, void *), void *arg)
 Call a callback for each filter attached to the qdisc (deprecated) More...
 
int rtnl_qdisc_build_change_request (struct rtnl_qdisc *qdisc, struct rtnl_qdisc *new, struct nl_msg **result)
 Build a netlink message requesting the update of a qdisc. More...
 
int rtnl_qdisc_change (struct nl_sock *sk, struct rtnl_qdisc *qdisc, struct rtnl_qdisc *new)
 Change attributes of a qdisc. More...
 

Detailed Description

Function Documentation

int rtnl_qdisc_build_add_request ( struct rtnl_qdisc *  qdisc,
int  flags,
struct nl_msg **  result 
)

Build a netlink message requesting the addition of a qdisc.

Parameters
qdiscQdisc to add
flagsAdditional netlink message flags
resultPointer to store resulting netlink message

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

See Also
rtnl_qdisc_add()
Returns
0 on success or a negative error code.

Definition at line 114 of file qdisc.c.

Referenced by rtnl_qdisc_add().

+ Here is the caller graph for this function:

int rtnl_qdisc_add ( struct nl_sock *  sk,
struct rtnl_qdisc *  qdisc,
int  flags 
)

Add qdisc.

Parameters
skNetlink socket
qdiscQdisc to add
flagsAdditional netlink message flags

Builds a RTM_NEWQDISC netlink message requesting the addition of a new qdisc and sends the message to the kernel. The configuration of the qdisc is derived from the attributes of the specified qdisc.

The following flags may be specified:

  • NLM_F_CREATE: Create qdisc if it does not exist, otherwise -NLE_OBJ_NOTFOUND is returned.
  • NLM_F_REPLACE: If another qdisc is already attached to the parent, replace it even if the handles mismatch.
  • NLM_F_EXCL: Return -NLE_EXISTS if a qdisc with matching handle exists already.

Existing qdiscs with matching handles will be updated, unless the flag NLM_F_EXCL is specified. If their handles do not match, the error -NLE_EXISTS is returned unless the flag NLM_F_REPLACE is specified in which case the existing qdisc is replaced with the new one. If no matching qdisc 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 162 of file qdisc.c.

References nl_send_sync(), and rtnl_qdisc_build_add_request().

+ Here is the call graph for this function:

int rtnl_qdisc_build_update_request ( struct rtnl_qdisc *  qdisc,
struct rtnl_qdisc *  new,
int  flags,
struct nl_msg **  result 
)

Build netlink message requesting the update of a qdisc.

Parameters
qdiscQdisc to update
newQdisc with updated attributes
flagsAdditional netlink message flags
resultPointer to store resulting netlink message

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

See Also
rtnl_qdisc_update()
Returns
0 on success or a negative error code.

Definition at line 188 of file qdisc.c.

References rtnl_tc_set_handle(), rtnl_tc_set_ifindex(), rtnl_tc_set_parent(), and TC_CAST.

Referenced by rtnl_qdisc_build_change_request(), and rtnl_qdisc_update().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int rtnl_qdisc_update ( struct nl_sock *  sk,
struct rtnl_qdisc *  qdisc,
struct rtnl_qdisc *  new,
int  flags 
)

Update qdisc.

Parameters
skNetlink socket
qdiscQdisc to update
newQdisc with updated attributes
flagsAdditional netlink message flags

Builds a RTM_NEWQDISC netlink message requesting the update of an existing qdisc and sends the message to the kernel.

This function is a varation of rtnl_qdisc_add() to update qdiscs if the qdisc to be updated is available as qdisc object. The behaviour is identical to the one of rtnl_qdisc_add except that before constructing the message, it copies the ifindex, handle, and parent from the original qdisc to the new qdisc.

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 247 of file qdisc.c.

References nl_send_sync(), and rtnl_qdisc_build_update_request().

Referenced by rtnl_qdisc_change().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int rtnl_qdisc_build_delete_request ( struct rtnl_qdisc *  qdisc,
struct nl_msg **  result 
)

Build netlink message requesting the deletion of a qdisc.

Parameters
qdiscQdisc to delete
resultPointer to store resulting netlink message

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

See Also
rtnl_qdisc_delete()
Returns
0 on success or a negative error code.

Definition at line 273 of file qdisc.c.

References NLA_PUT_STRING, nlmsg_alloc_simple(), nlmsg_append(), and nlmsg_free().

Referenced by rtnl_qdisc_delete().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int rtnl_qdisc_delete ( struct nl_sock *  sk,
struct rtnl_qdisc *  qdisc 
)

Delete qdisc.

Parameters
skNetlink socket
qdiscQdisc to add

Builds a RTM_NEWQDISC netlink message requesting the deletion of a qdisc and sends the message to the kernel.

The message is constructed out of the following attributes:

  • ifindex and parent
  • handle (optional, must match if provided)
  • kind (optional, must match if provided)

All other qdisc attributes including all qdisc 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
It is not possible to delete default qdiscs.
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 340 of file qdisc.c.

References nl_send_sync(), and rtnl_qdisc_build_delete_request().

+ Here is the call graph for this function:

int rtnl_qdisc_alloc_cache ( struct nl_sock *  sk,
struct nl_cache **  result 
)

Allocate a cache and fill it with all configured qdiscs.

Parameters
skNetlink socket
resultPointer to store the created cache

Allocates a new qdisc cache and fills it with a list of all configured qdiscs on all network devices. Release the cache with nl_cache_free().

Returns
0 on success or a negative error code.

Definition at line 368 of file qdisc.c.

References nl_cache_alloc_and_fill().

+ Here is the call graph for this function:

struct rtnl_qdisc* rtnl_qdisc_get_by_parent ( struct nl_cache *  cache,
int  ifindex,
uint32_t  parent 
)
read

Search qdisc by interface index and parent.

Parameters
cacheQdisc cache
ifindexInterface index
parentHandle of parent qdisc

Searches a qdisc cache previously allocated with rtnl_qdisc_alloc_cache() and searches for a qdisc matching the interface index and parent qdisc.

The reference counter is incremented before returning the qdisc, therefore the reference must be given back with rtnl_qdisc_put() after usage.

Returns
pointer to qdisc inside the cache or NULL if no match was found.

Definition at line 387 of file qdisc.c.

References nl_object_get().

Referenced by rtnl_class_leaf_qdisc().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

struct rtnl_qdisc* rtnl_qdisc_get ( struct nl_cache *  cache,
int  ifindex,
uint32_t  handle 
)
read

Search qdisc by interface index and handle.

Parameters
cacheQdisc cache
ifindexInterface index
handleHandle

Searches a qdisc cache previously allocated with rtnl_qdisc_alloc_cache() and searches for a qdisc matching the interface index and handle.

The reference counter is incremented before returning the qdisc, therefore the reference must be given back with rtnl_qdisc_put() after usage.

Returns
Qdisc or NULL if no match was found.

Definition at line 419 of file qdisc.c.

References nl_object_get().

+ Here is the call graph for this function:

void rtnl_qdisc_foreach_child ( struct rtnl_qdisc *  qdisc,
struct nl_cache *  cache,
void(*)(struct nl_object *, void *)  cb,
void *  arg 
)

Call a callback for each child class of a qdisc (deprecated)

Deprecated:
Use of this function is deprecated, it does not allow to handle the out of memory situation that can occur.

Definition at line 450 of file qdisc.c.

References nl_cache_foreach_filter(), rtnl_tc_set_ifindex(), rtnl_tc_set_kind(), rtnl_tc_set_parent(), and TC_CAST.

+ Here is the call graph for this function:

void rtnl_qdisc_foreach_cls ( struct rtnl_qdisc *  qdisc,
struct nl_cache *  cache,
void(*)(struct nl_object *, void *)  cb,
void *  arg 
)

Call a callback for each filter attached to the qdisc (deprecated)

Deprecated:
Use of this function is deprecated, it does not allow to handle the out of memory situation that can occur.

Definition at line 474 of file qdisc.c.

References nl_cache_foreach_filter(), rtnl_tc_set_ifindex(), rtnl_tc_set_parent(), and TC_CAST.

+ Here is the call graph for this function:

int rtnl_qdisc_build_change_request ( struct rtnl_qdisc *  qdisc,
struct rtnl_qdisc *  new,
struct nl_msg **  result 
)

Build a netlink message requesting the update of a qdisc.

Deprecated:
Use of this function is deprecated in favour of rtnl_qdisc_build_update_request() due to the missing possibility of specifying additional flags.

Definition at line 496 of file qdisc.c.

References rtnl_qdisc_build_update_request().

+ Here is the call graph for this function:

int rtnl_qdisc_change ( struct nl_sock *  sk,
struct rtnl_qdisc *  qdisc,
struct rtnl_qdisc *  new 
)

Change attributes of a qdisc.

Deprecated:
Use of this function is deprecated in favour of rtnl_qdisc_update() due to the missing possibility of specifying additional flags.

Definition at line 511 of file qdisc.c.

References rtnl_qdisc_update().

+ Here is the call graph for this function: