]> git.proxmox.com Git - mirror_iproute2.git/blobdiff - tc/q_drr.c
m_vlan: add pop_eth and push_eth actions
[mirror_iproute2.git] / tc / q_drr.c
index 81de44d909a53c2223ba9d80d041fa11209669c4..f9c90f3035f388163d8dcb41331fabd726bde2fc 100644 (file)
@@ -13,7 +13,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
-#include <syslog.h>
 #include <fcntl.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
@@ -34,9 +33,10 @@ static void explain2(void)
 }
 
 
-static int drr_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n)
+static int drr_parse_opt(struct qdisc_util *qu, int argc, char **argv,
+                        struct nlmsghdr *n, const char *dev)
 {
-       while (argc > 0) {
+       while (argc) {
                if (strcmp(*argv, "help") == 0) {
                        explain();
                        return -1;
@@ -45,19 +45,17 @@ static int drr_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
                        explain();
                        return -1;
                }
-               argc--; argv++;
        }
        return 0;
 }
 
 static int drr_parse_class_opt(struct qdisc_util *qu, int argc, char **argv,
-                              struct nlmsghdr *n)
+                              struct nlmsghdr *n, const char *dev)
 {
        struct rtattr *tail;
        __u32 tmp;
 
-       tail = NLMSG_TAIL(n);
-       addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
+       tail = addattr_nest(n, 1024, TCA_OPTIONS);
 
        while (argc > 0) {
                if (strcmp(*argv, "quantum") == 0) {
@@ -78,13 +76,14 @@ static int drr_parse_class_opt(struct qdisc_util *qu, int argc, char **argv,
                argc--; argv++;
        }
 
-       tail->rta_len = (void *) NLMSG_TAIL(n) - (void *)tail;
+       addattr_nest_end(n, tail);
        return 0;
 }
 
 static int drr_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 {
        struct rtattr *tb[TCA_DRR_MAX + 1];
+
        SPRINT_BUF(b1);
 
        if (opt == NULL)
@@ -94,13 +93,14 @@ static int drr_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 
        if (tb[TCA_DRR_QUANTUM])
                fprintf(f, "quantum %s ",
-                       sprint_size(*(__u32 *)RTA_DATA(tb[TCA_DRR_QUANTUM]), b1));
+                       sprint_size(rta_getattr_u32(tb[TCA_DRR_QUANTUM]), b1));
        return 0;
 }
 
 static int drr_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstats)
 {
        struct tc_drr_stats *x;
+
        SPRINT_BUF(b1);
 
        if (xstats == NULL)