Modules

Classifiers
[Traffic Control]

Modules

 Basic Classifier
 Control Groups Classifier
 Extended Match
 Firewall Classifier
 Universal 32-bit Classifier

Allocation/Freeing



struct rtnl_cls * rtnl_cls_alloc (void)
void rtnl_cls_put (struct rtnl_cls *cls)

Attributes



void rtnl_cls_set_prio (struct rtnl_cls *cls, uint16_t prio)
uint16_t rtnl_cls_get_prio (struct rtnl_cls *cls)
void rtnl_cls_set_protocol (struct rtnl_cls *cls, uint16_t protocol)
uint16_t rtnl_cls_get_protocol (struct rtnl_cls *cls)

Classifier Addition/Modification/Deletion



int rtnl_cls_build_add_request (struct rtnl_cls *cls, int flags, struct nl_msg **result)
 Build a netlink message to add a new classifier.
int rtnl_cls_add (struct nl_sock *sk, struct rtnl_cls *cls, int flags)
 Add a new classifier.
int rtnl_cls_build_change_request (struct rtnl_cls *cls, int flags, struct nl_msg **result)
 Build a netlink message to change classifier attributes.
int rtnl_cls_change (struct nl_sock *sk, struct rtnl_cls *cls, int flags)
 Change a classifier.
int rtnl_cls_build_delete_request (struct rtnl_cls *cls, int flags, struct nl_msg **result)
 Build a netlink request message to delete a classifier.
int rtnl_cls_delete (struct nl_sock *sk, struct rtnl_cls *cls, int flags)
 Delete a classifier.

Cache Management



int rtnl_cls_alloc_cache (struct nl_sock *sk, int ifindex, uint32_t parent, struct nl_cache **result)
 Build a classifier cache including all classifiers attached to the specified class/qdisc on eht specified interface.

Detailed Description

Classifier Identification
  • protocol
  • priority
  • parent
  • interface
  • kind
  • handle

Function Documentation

int rtnl_cls_build_add_request ( struct rtnl_cls *  cls,
int  flags,
struct nl_msg **  result 
)

Build a netlink message to add a new classifier.

Parameters:
cls classifier to add
flags additional netlink message flags
result Pointer to store resulting message.

Builds a new netlink message requesting an addition of a classifier The netlink message header isn't fully equipped with all relevant fields and must be sent out via nl_send_auto_complete() or supplemented as needed. classifier must contain the attributes of the new classifier set via rtnl_cls_set_* functions. opts may point to the clsasifier specific options.

Returns:
0 on success or a negative error code.

Definition at line 141 of file cls.c.

Referenced by rtnl_cls_add().

Here is the caller graph for this function:

int rtnl_cls_add ( struct nl_sock *  sk,
struct rtnl_cls *  cls,
int  flags 
)

Add a new classifier.

Parameters:
sk Netlink socket.
cls classifier to add
flags additional netlink message flags

Builds a netlink message by calling rtnl_cls_build_add_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 159 of file cls.c.

References nl_wait_for_ack(), nlmsg_free(), and rtnl_cls_build_add_request().

Here is the call graph for this function:

int rtnl_cls_build_change_request ( struct rtnl_cls *  cls,
int  flags,
struct nl_msg **  result 
)

Build a netlink message to change classifier attributes.

Parameters:
cls classifier 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 188 of file cls.c.

Referenced by rtnl_cls_change().

Here is the caller graph for this function:

int rtnl_cls_change ( struct nl_sock *  sk,
struct rtnl_cls *  cls,
int  flags 
)

Change a classifier.

Parameters:
sk Netlink socket.
cls classifier to change
flags additional netlink message flags

Builds a netlink message by calling rtnl_cls_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 206 of file cls.c.

References nl_wait_for_ack(), nlmsg_free(), and rtnl_cls_build_change_request().

Here is the call graph for this function:

int rtnl_cls_build_delete_request ( struct rtnl_cls *  cls,
int  flags,
struct nl_msg **  result 
)

Build a netlink request message to delete a classifier.

Parameters:
cls classifier to delete
flags additional netlink message flags
result Pointer to store resulting message.

Builds a new netlink message requesting a deletion of a classifier. 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 235 of file cls.c.

Referenced by rtnl_cls_delete().

Here is the caller graph for this function:

int rtnl_cls_delete ( struct nl_sock *  sk,
struct rtnl_cls *  cls,
int  flags 
)

Delete a classifier.

Parameters:
sk Netlink socket.
cls classifier to delete
flags additional netlink message flags

Builds a netlink message by calling rtnl_cls_build_delete_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 254 of file cls.c.

References nl_wait_for_ack(), nlmsg_free(), and rtnl_cls_build_delete_request().

Here is the call graph for this function:

int rtnl_cls_alloc_cache ( struct nl_sock *  sk,
int  ifindex,
uint32_t  parent,
struct nl_cache **  result 
)

Build a classifier cache including all classifiers attached to the specified class/qdisc on eht specified interface.

Parameters:
sk Netlink socket.
ifindex interface index of the link the classes are attached to.
parent parent qdisc/class
result Pointer to store resulting cache.

Allocates a new cache, initializes it properly and updates it to include all classes attached to the specified interface.

Note:
The caller is responsible for destroying and freeing the cache after using it.
Returns:
0 on success or a negative error code.

Definition at line 293 of file cls.c.

References nl_cache_alloc(), nl_cache_free(), and nl_cache_refill().

Here is the call graph for this function: