]> git.proxmox.com Git - mirror_iproute2.git/blobdiff - tc/f_flow.c
tc: Remove pointless assignments in batch()
[mirror_iproute2.git] / tc / f_flow.c
index 6ee4dd5e50f1fbb8cc1a097dc38966184f837fac..badeaa2907285db2ad55c7e8639ec06b304cc124 100644 (file)
@@ -133,7 +133,6 @@ out:
 static int flow_parse_opt(struct filter_util *fu, char *handle,
                          int argc, char **argv, struct nlmsghdr *n)
 {
-       struct tc_police tp;
        struct tcmsg *t = NLMSG_DATA(n);
        struct rtattr *tail;
        __u32 mask = ~0U, xor = 0;
@@ -141,8 +140,6 @@ static int flow_parse_opt(struct filter_util *fu, char *handle,
        __u32 mode = FLOW_MODE_MAP;
        __u32 tmp;
 
-       memset(&tp, 0, sizeof(tp));
-
        if (handle) {
                if (get_u32(&t->tcm_handle, handle, 0)) {
                        fprintf(stderr, "Illegal \"handle\"\n");
@@ -150,8 +147,7 @@ static int flow_parse_opt(struct filter_util *fu, char *handle,
                }
        }
 
-       tail = NLMSG_TAIL(n);
-       addattr_l(n, 4096, TCA_OPTIONS, NULL, 0);
+       tail = addattr_nest(n, 4096, TCA_OPTIONS);
 
        while (argc > 0) {
                if (matches(*argv, "map") == 0) {
@@ -262,7 +258,7 @@ static int flow_parse_opt(struct filter_util *fu, char *handle,
                addattr32(n, 4096, TCA_FLOW_XOR, xor);
        }
 
-       tail->rta_len = (void *)NLMSG_TAIL(n) - (void *)tail;
+       addattr_nest_end(n, tail);
        return 0;
 }
 
@@ -350,7 +346,7 @@ static int flow_print_opt(struct filter_util *fu, FILE *f, struct rtattr *opt,
                tc_print_police(f, tb[TCA_FLOW_POLICE]);
        if (tb[TCA_FLOW_ACT]) {
                fprintf(f, "\n");
-               tc_print_action(f, tb[TCA_FLOW_ACT]);
+               tc_print_action(f, tb[TCA_FLOW_ACT], 0);
        }
        return 0;
 }