]> git.proxmox.com Git - mirror_iproute2.git/blobdiff - tc/f_u32.c
rdma: Properly mark RDMAtool license
[mirror_iproute2.git] / tc / f_u32.c
index 5815be9cd23e6c9809f375886cb54f035e537bfe..e0a322d5a11c891107b95520ce480a50b41b689a 100644 (file)
@@ -14,7 +14,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
-#include <syslog.h>
 #include <fcntl.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
@@ -26,8 +25,6 @@
 #include "utils.h"
 #include "tc_util.h"
 
-extern int show_pretty;
-
 static void explain(void)
 {
        fprintf(stderr,
@@ -385,8 +382,7 @@ static int parse_ip6_addr(int *argc_p, char ***argv_p,
 
        plen = addr.bitlen;
        for (i = 0; i < plen; i += 32) {
-               /* if (((i + 31) & ~0x1F) <= plen) { */
-               if (i + 31 <= plen) {
+               if (i + 31 < plen) {
                        res = pack_key(sel, addr.data[i / 32],
                                       0xFFFFFFFF, off + 4 * (i / 32), offmask);
                        if (res < 0)
@@ -967,7 +963,7 @@ static void show_keys(FILE *f, const struct tc_u32_key *key)
 {
        int i = 0;
 
-       if (!show_pretty)
+       if (!pretty)
                goto show_k;
 
        for (i = 0; i < ARRAY_SIZE(u32_pprinters); i++) {
@@ -1005,8 +1001,7 @@ static int u32_parse_opt(struct filter_util *qu, char *handle,
        if (argc == 0)
                return 0;
 
-       tail = NLMSG_TAIL(n);
-       addattr_l(n, MAX_MSG, TCA_OPTIONS, NULL, 0);
+       tail = addattr_nest(n, MAX_MSG, TCA_OPTIONS);
 
        while (argc > 0) {
                if (matches(*argv, "match") == 0) {
@@ -1152,13 +1147,9 @@ static int u32_parse_opt(struct filter_util *qu, char *handle,
                        terminal_ok++;
                        continue;
                } else if (strcmp(*argv, "skip_hw") == 0) {
-                       NEXT_ARG();
                        flags |= TCA_CLS_FLAGS_SKIP_HW;
-                       continue;
                } else if (strcmp(*argv, "skip_sw") == 0) {
-                       NEXT_ARG();
                        flags |= TCA_CLS_FLAGS_SKIP_SW;
-                       continue;
                } else if (strcmp(*argv, "help") == 0) {
                        explain();
                        return -1;
@@ -1170,7 +1161,7 @@ static int u32_parse_opt(struct filter_util *qu, char *handle,
                argc--; argv++;
        }
 
-       /* We dont necessarily need class/flowids */
+       /* We don't necessarily need class/flowids */
        if (terminal_ok)
                sel.sel.flags |= TC_U32_TERMINAL;
 
@@ -1199,7 +1190,7 @@ static int u32_parse_opt(struct filter_util *qu, char *handle,
                addattr_l(n, MAX_MSG, TCA_U32_FLAGS, &flags, 4);
        }
 
-       tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
+       addattr_nest_end(n, tail);
        return 0;
 }