]> 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 942b4f23be830fc27b1da06d0306c5f98fc23b84..1d73cb98895a363943831bf1ac1f972e13268521 100644 (file)
@@ -286,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;
@@ -299,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;
        }
@@ -383,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: ");
 
@@ -405,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;