This section describes how the traffic-control elements are configured from within the user space. To configure traffic-control elements, the tc tools are used. This toolset is a command-line configuration program (available in [Kuzn01] as part of the iproute2 package). In addition, the RT netlink interface is used to pass configuration information to the kernel. 18.7.1 The RT Netlink Interface The RT netlink interface is fully described in Chapter 26. For the purposes of this section, it is sufficient to know that the RT netlink interface is used to pass a pointer to the rtattr (in include/linux/rtnetlink.h) structure to the init() or change() functions of the traffic-control framework. The function rtatr_parse (net/core/rtnetlink.c) can be used to structure the data passed, and various macros, including RTA_PAYLOAD und RTA_DATA (include/linux/rtnetlink.h), can be used to print this information. The tcmsg (include/linux/rtnetlink.h) structure defines traffic-control messages that can be sent over the RT netlink interface from within the user space. 18.7.2 The User Interface The tc program provides a command-line user interface to configure the Linux traffic control. This tool is available from [Kuzn01]. The tc tool enables you to set up and configure all elements of the traffic-control framework discussed here, such as queuing disciplines, filters, and classes. To be able to use the Differentiated Services support in Linux, we first have to set the entry TC_CONFIG_DIFFSERV=y in the Config file in the iproutes/tc directory. If the kernel version and the version of your tc tool match, then calling make in the same directory should enable you to compile successfully. Depending on the element we want to configure, we now have to select the appropriate element, together with additional options: Usage: tc [ OPTIONS ] OBJECT { COMMAND | help } where OBJECT := { qdisc | class | filter } OPTIONS := { -s[tatistics] | -d[etails] | -r[aw] | -b[atch] file } A detailed description of all additional options would go beyond the scope and volume of this book. You can use the help command (e.g., tc qdisc add tbf help) to easily obtain information. In addition, you can find an overview of ongoing work in the field of more comfortable user interfaces in [Alme01]. |