#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-#include <syslog.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <netinet/in.h>
}
-static int accept_tcmsg(const struct sockaddr_nl *who,
- struct rtnl_ctrl_data *ctrl,
+static int accept_tcmsg(struct rtnl_ctrl_data *ctrl,
struct nlmsghdr *n, void *arg)
{
- FILE *fp = (FILE*)arg;
+ FILE *fp = (FILE *)arg;
if (timestamp)
print_timestamp(fp);
- if (n->nlmsg_type == RTM_NEWTFILTER || n->nlmsg_type == RTM_DELTFILTER) {
- print_filter(who, n, arg);
+ if (n->nlmsg_type == RTM_NEWTFILTER ||
+ n->nlmsg_type == RTM_DELTFILTER ||
+ n->nlmsg_type == RTM_NEWCHAIN ||
+ n->nlmsg_type == RTM_DELCHAIN) {
+ print_filter(n, arg);
return 0;
}
if (n->nlmsg_type == RTM_NEWTCLASS || n->nlmsg_type == RTM_DELTCLASS) {
- print_class(who, n, arg);
+ print_class(n, arg);
return 0;
}
if (n->nlmsg_type == RTM_NEWQDISC || n->nlmsg_type == RTM_DELQDISC) {
- print_qdisc(who, n, arg);
+ print_qdisc(n, arg);
return 0;
}
if (n->nlmsg_type == RTM_GETACTION || n->nlmsg_type == RTM_NEWACTION ||
n->nlmsg_type == RTM_DELACTION) {
- print_action(who, n, arg);
+ print_action(n, arg);
return 0;
}
if (n->nlmsg_type != NLMSG_ERROR && n->nlmsg_type != NLMSG_NOOP &&
{
struct rtnl_handle rth;
char *file = NULL;
- unsigned groups = nl_mgrp(RTNLGRP_TC);
+ unsigned int groups = nl_mgrp(RTNLGRP_TC);
while (argc > 0) {
if (matches(*argv, "file") == 0) {
ll_init_map(&rth);
- if (rtnl_listen(&rth, accept_tcmsg, (void*)stdout) < 0) {
+ if (rtnl_listen(&rth, accept_tcmsg, (void *)stdout) < 0) {
rtnl_close(&rth);
exit(2);
}