* Bernhard Reutner-Fischer adjusted for busybox
*/
+//usage:#define tc_trivial_usage
+/* //usage: "[OPTIONS] OBJECT CMD [dev STRING]" */
+//usage: "OBJECT CMD [dev STRING]"
+//usage:#define tc_full_usage "\n\n"
+//usage: "OBJECT: {qdisc|class|filter}\n"
+//usage: "CMD: {add|del|change|replace|show}\n"
+//usage: "\n"
+//usage: "qdisc [ handle QHANDLE ] [ root |"IF_FEATURE_TC_INGRESS(" ingress |")" parent CLASSID ]\n"
+/* //usage: "[ estimator INTERVAL TIME_CONSTANT ]\n" */
+//usage: " [ [ QDISC_KIND ] [ help | OPTIONS ] ]\n"
+//usage: " QDISC_KIND := { [p|b]fifo | tbf | prio | cbq | red | etc. }\n"
+//usage: "qdisc show [ dev STRING ]"IF_FEATURE_TC_INGRESS(" [ingress]")"\n"
+//usage: "class [ classid CLASSID ] [ root | parent CLASSID ]\n"
+//usage: " [ [ QDISC_KIND ] [ help | OPTIONS ] ]\n"
+//usage: "class show [ dev STRING ] [ root | parent CLASSID ]\n"
+//usage: "filter [ pref PRIO ] [ protocol PROTO ]\n"
+/* //usage: "\t[ estimator INTERVAL TIME_CONSTANT ]\n" */
+//usage: " [ root | classid CLASSID ] [ handle FILTERID ]\n"
+//usage: " [ [ FILTER_TYPE ] [ help | OPTIONS ] ]\n"
+//usage: "filter show [ dev STRING ] [ root | parent CLASSID ]"
+
#include "libbb.h"
#include "libiproute/utils.h"
struct globals {
int filter_ifindex;
- __u32 filter_qdisc;
- __u32 filter_parent;
- __u32 filter_prio;
- __u32 filter_proto;
+ uint32_t filter_qdisc;
+ uint32_t filter_parent;
+ uint32_t filter_prio;
+ uint32_t filter_proto;
} FIX_ALIASING;
#define G (*(struct globals*)&bb_common_bufsiz1)
struct BUG_G_too_big {
}
/* Get a qdisc handle. Return 0 on success, !0 otherwise. */
-static int get_qdisc_handle(__u32 *h, const char *str) {
- __u32 maj;
+static int get_qdisc_handle(uint32_t *h, const char *str) {
+ uint32_t maj;
char *p;
maj = TC_H_UNSPEC;
}
/* Get class ID. Return 0 on success, !0 otherwise. */
-static int get_tc_classid(__u32 *h, const char *str) {
- __u32 maj, min;
+static int get_tc_classid(uint32_t *h, const char *str) {
+ uint32_t maj, min;
char *p;
maj = TC_H_ROOT;
printf("root ");
else if (msg->tcm_parent) {
classid = print_tc_classid(filter_qdisc ?
- TC_H_MIN(msg->tcm_parent) : msg->tcm_parent);
+ TC_H_MIN(msg->tcm_parent) : msg->tcm_parent);
printf("parent %s ", classid);
if (ENABLE_FEATURE_CLEAN_UP)
free(classid);
if (obj == OBJ_filter)
filter_parent = TC_H_ROOT;
} else if (arg == ARG_parent) {
- __u32 handle;
+ uint32_t handle;
if (msg.tcm_parent)
duparg(*argv, "parent");
if (get_tc_classid(&handle, *argv))
duparg(*argv, "handle");
/* reject LONG_MIN || LONG_MAX */
/* TODO: for fw
- if ((slash = strchr(handle, '/')) != NULL)
+ slash = strchr(handle, '/');
+ if (slash != NULL)
*slash = '\0';
*/
msg.tcm_handle = get_u32(*argv, "handle");
- /* if (slash) {if (get_u32(__u32 &mask, slash+1, NULL)) inv mask; addattr32(n, MAX_MSG, TCA_FW_MASK, mask); */
+ /* if (slash) {if (get_u32(uint32_t &mask, slash+1, NULL)) inv mask; addattr32(n, MAX_MSG, TCA_FW_MASK, mask); */
} else if (arg == ARG_classid && obj == OBJ_class && cmd == CMD_change){
} else if (arg == ARG_pref || arg == ARG_prio) { /* filter::list */
if (filter_prio)