]> git.proxmox.com Git - mirror_iproute2.git/blobdiff - tc/m_xt.c
tc flower: fix parsing vlan_id and vlan_prio
[mirror_iproute2.git] / tc / m_xt.c
index 29574bd41f93eefb46214e969cec8772f568e72c..deaf96a26f7517665973ff110a2b7354127437ce 100644 (file)
--- a/tc/m_xt.c
+++ b/tc/m_xt.c
@@ -317,9 +317,10 @@ print_ipt(struct action_util *au, FILE *f, struct rtattr *arg)
        struct xtables_target *m;
        struct rtattr *tb[TCA_IPT_MAX + 1];
        struct xt_entry_target *t = NULL;
+       __u32 hook;
 
        if (arg == NULL)
-               return -1;
+               return 0;
 
        /* copy tcipt_globals because .opts will be modified by iptables */
        struct xtables_globals tmp_tcipt_globals = tcipt_globals;
@@ -330,27 +331,25 @@ print_ipt(struct action_util *au, FILE *f, struct rtattr *arg)
        parse_rtattr_nested(tb, TCA_IPT_MAX, arg);
 
        if (tb[TCA_IPT_TABLE] == NULL) {
-               fprintf(f, "[NULL ipt table name ] assuming mangle ");
+               fprintf(stderr, "Missing ipt table name, assuming mangle\n");
        } else {
                fprintf(f, "tablename: %s ",
                        rta_getattr_str(tb[TCA_IPT_TABLE]));
        }
 
        if (tb[TCA_IPT_HOOK] == NULL) {
-               fprintf(f, "[NULL ipt hook name ]\n ");
+               fprintf(stderr, "Missing ipt hook name\n ");
                return -1;
-       } else {
-               __u32 hook;
-
-               hook = rta_getattr_u32(tb[TCA_IPT_HOOK]);
-               fprintf(f, " hook: %s\n", ipthooks[hook]);
        }
 
        if (tb[TCA_IPT_TARG] == NULL) {
-               fprintf(f, "\t[NULL ipt target parameters ]\n");
+               fprintf(stderr, "Missing ipt target parameters\n");
                return -1;
        }
 
+       hook = rta_getattr_u32(tb[TCA_IPT_HOOK]);
+       fprintf(f, " hook: %s\n", ipthooks[hook]);
+
        t = RTA_DATA(tb[TCA_IPT_TARG]);
        m = xtables_find_target(t->u.user.name, XTF_TRY_LOAD);
        if (!m) {
@@ -392,7 +391,7 @@ print_ipt(struct action_util *au, FILE *f, struct rtattr *arg)
                        print_tm(f, tm);
                }
        }
-       fprintf(f, "\n");
+       print_nl();
 
        xtables_free_opts(1);