]> git.proxmox.com Git - mirror_iproute2.git/blobdiff - tc/m_ipt.c
tc: replace left side comparison
[mirror_iproute2.git] / tc / m_ipt.c
index d6f62bd6b32c98aca862bf437c32205916a00f01..1d73cb98895a363943831bf1ac1f972e13268521 100644 (file)
@@ -10,7 +10,6 @@
  * Authors:  J Hadi Salim (hadi@cyberus.ca)
  */
 
-#include <syslog.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
@@ -287,7 +286,7 @@ static int parse_ipt(struct action_util *a, int *argc_p,
        int rargc = *argc_p;
        char **argv = *argv_p;
        int argc = 0, iargc = 0;
-       char k[16];
+       char k[FILTER_NAMESZ];
        int size = 0;
        int iok = 0, ok = 0;
        __u32 hook = 0, index = 0;
@@ -300,9 +299,8 @@ static int parse_ipt(struct action_util *a, int *argc_p,
                int i;
 
                for (i = 0; i < rargc; i++) {
-                       if (NULL == argv[i] || 0 == strcmp(argv[i], "action")) {
+                       if (!argv[i] || strcmp(argv[i], "action") == 0)
                                break;
-                       }
                }
                iargc = argc = i;
        }
@@ -384,8 +382,7 @@ static int parse_ipt(struct action_util *a, int *argc_p,
                }
        }
 
-       tail = NLMSG_TAIL(n);
-       addattr_l(n, MAX_MSG, tca_id, NULL, 0);
+       tail = addattr_nest(n, MAX_MSG, tca_id);
        fprintf(stdout, "tablename: %s hook: %s\n ", tname, ipthooks[hook]);
        fprintf(stdout, "\ttarget: ");
 
@@ -406,7 +403,7 @@ static int parse_ipt(struct action_util *a, int *argc_p,
        addattr_l(n, MAX_MSG, TCA_IPT_INDEX, &index, 4);
        if (m)
                addattr_l(n, MAX_MSG, TCA_IPT_TARG, m->t, m->t->u.target_size);
-       tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
+       addattr_nest_end(n, tail);
 
        argc -= optind;
        argv += optind;
@@ -489,7 +486,7 @@ print_ipt(struct action_util *au, FILE * f, struct rtattr *arg)
                        __u32 index;
 
                        index = rta_getattr_u32(tb[TCA_IPT_INDEX]);
-                       fprintf(f, "\n\tindex %d", index);
+                       fprintf(f, "\n\tindex %u", index);
                }
 
                if (tb[TCA_IPT_CNT]) {