#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-#include <syslog.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <netinet/in.h>
static void explain(void)
{
- fprintf(stderr, "Usage: ... basic [ match EMATCH_TREE ] [ police POLICE_SPEC ]\n");
- fprintf(stderr, " [ action ACTION_SPEC ] [ classid CLASSID ]\n");
- fprintf(stderr, "\n");
- fprintf(stderr, "Where: SELECTOR := SAMPLE SAMPLE ...\n");
- fprintf(stderr, " FILTERID := X:Y:Z\n");
+ fprintf(stderr,
+ "Usage: ... basic [ match EMATCH_TREE ]\n"
+ " [ action ACTION_SPEC ] [ classid CLASSID ]\n"
+ "\n"
+ "Where: SELECTOR := SAMPLE SAMPLE ...\n"
+ " FILTERID := X:Y:Z\n"
+ " ACTION_SPEC := ... look at individual actions\n"
+ "\n"
+ "NOTE: CLASSID is parsed as hexadecimal input.\n");
}
static int basic_parse_opt(struct filter_util *qu, char *handle,
struct rtattr *tail;
long h = 0;
- if (argc == 0)
- return 0;
-
if (handle) {
h = strtol(handle, NULL, 0);
if (h == LONG_MIN || h == LONG_MAX) {
return -1;
}
}
-
t->tcm_handle = h;
- tail = (struct rtattr*)(((void*)n)+NLMSG_ALIGN(n->nlmsg_len));
+ if (argc == 0)
+ return 0;
+
+ tail = (struct rtattr *)(((void *)n)+NLMSG_ALIGN(n->nlmsg_len));
addattr_l(n, MAX_MSG, TCA_OPTIONS, NULL, 0);
while (argc > 0) {
continue;
} else if (matches(*argv, "classid") == 0 ||
strcmp(*argv, "flowid") == 0) {
- unsigned handle;
+ unsigned int handle;
+
NEXT_ARG();
if (get_tc_classid(&handle, *argv)) {
fprintf(stderr, "Illegal \"classid\"\n");
argc--; argv++;
}
- tail->rta_len = (((void*)n)+n->nlmsg_len) - (void*)tail;
+ tail->rta_len = (((void *)n)+n->nlmsg_len) - (void *)tail;
return 0;
}
if (tb[TCA_BASIC_CLASSID]) {
SPRINT_BUF(b1);
fprintf(f, "flowid %s ",
- sprint_tc_classid(*(__u32*)RTA_DATA(tb[TCA_BASIC_CLASSID]), b1));
+ sprint_tc_classid(rta_getattr_u32(tb[TCA_BASIC_CLASSID]), b1));
}
if (tb[TCA_BASIC_EMATCHES])
}
if (tb[TCA_BASIC_ACT]) {
- tc_print_action(f, tb[TCA_BASIC_ACT]);
+ tc_print_action(f, tb[TCA_BASIC_ACT], 0);
}
return 0;