]> git.proxmox.com Git - mirror_iproute2.git/blobdiff - tc/tc_qdisc.c
tc: parse attributes with NLA_F_NESTED flag
[mirror_iproute2.git] / tc / tc_qdisc.c
index e573a1df4e1ad557bae0f2e419061006cf7632d5..181fe2f0403f5bc5b3f2c009a5912f550c9d0d7c 100644 (file)
@@ -235,7 +235,7 @@ int print_qdisc(struct nlmsghdr *n, void *arg)
        if (filter_ifindex && filter_ifindex != t->tcm_ifindex)
                return 0;
 
-       parse_rtattr(tb, TCA_MAX, TCA_RTA(t), len);
+       parse_rtattr_flags(tb, TCA_MAX, TCA_RTA(t), len, NLA_F_NESTED);
 
        if (tb[TCA_KIND] == NULL) {
                fprintf(stderr, "print_qdisc: NULL kind\n");
@@ -313,16 +313,15 @@ int print_qdisc(struct nlmsghdr *n, void *arg)
                if (q)
                        q->print_qopt(q, fp, tb[TCA_OPTIONS]);
                else
-                       print_string(PRINT_FP, NULL,
-                                    "[cannot parse qdisc parameters]", NULL);
+                       fprintf(stderr, "Cannot parse qdisc parameters\n");
        }
        close_json_object();
 
-       print_string(PRINT_FP, NULL, "\n", NULL);
+       print_nl();
 
        if (show_details && tb[TCA_STAB]) {
                print_size_table(fp, " ", tb[TCA_STAB]);
-               print_string(PRINT_FP, NULL, "\n", NULL);
+               print_nl();
        }
 
        if (show_stats) {
@@ -330,12 +329,12 @@ int print_qdisc(struct nlmsghdr *n, void *arg)
 
                if (tb[TCA_STATS] || tb[TCA_STATS2] || tb[TCA_XSTATS]) {
                        print_tcstats_attr(fp, tb, " ", &xstats);
-                       print_string(PRINT_FP, NULL, "\n", NULL);
+                       print_nl();
                }
 
                if (q && xstats && q->print_xstats) {
                        q->print_xstats(q, fp, xstats);
-                       print_string(PRINT_FP, NULL, "\n", NULL);
+                       print_nl();
                }
        }
        close_json_object();
@@ -462,7 +461,7 @@ static int tc_qdisc_block_exists_cb(struct nlmsghdr *n, void *arg)
        if (len < 0)
                return -1;
 
-       parse_rtattr(tb, TCA_MAX, TCA_RTA(t), len);
+       parse_rtattr_flags(tb, TCA_MAX, TCA_RTA(t), len, NLA_F_NESTED);
 
        if (tb[TCA_KIND] == NULL)
                return -1;