diff -Naur iproute2/tc/tc_class.c iproute2-newifindex/tc/tc_class.c --- iproute2/tc/tc_class.c 2011-07-18 11:10:41.390973397 +0300 +++ iproute2-newifindex/tc/tc_class.c 2011-07-18 11:29:50.177611576 +0300 @@ -67,7 +67,16 @@ NEXT_ARG(); if (d[0]) duparg("dev", *argv); + if (req.t.tcm_ifindex) + duparg("ifindex", *argv); strncpy(d, *argv, sizeof(d)-1); + } else if (strcmp(*argv, "ifindex") == 0) { + NEXT_ARG(); + if (d[0]) + duparg("dev", *argv); + if (req.t.tcm_ifindex) + duparg("ifindex", *argv); + req.t.tcm_ifindex = atoi(*argv); } else if (strcmp(*argv, "classid") == 0) { __u32 handle; NEXT_ARG(); @@ -246,7 +255,16 @@ NEXT_ARG(); if (d[0]) duparg("dev", *argv); + if (t.tcm_ifindex) + duparg("ifindex", *argv); strncpy(d, *argv, sizeof(d)-1); + } else if (strcmp(*argv, "ifindex") == 0) { + NEXT_ARG(); + if (d[0]) + duparg("dev", *argv); + if (t.tcm_ifindex) + duparg("ifindex", *argv); + t.tcm_ifindex = atoi(*argv); } else if (strcmp(*argv, "qdisc") == 0) { NEXT_ARG(); if (filter_qdisc) @@ -290,9 +308,10 @@ fprintf(stderr, "Cannot find device \"%s\"\n", d); return 1; } - filter_ifindex = t.tcm_ifindex; } + filter_ifindex = t.tcm_ifindex; + if (rtnl_dump_request(&rth, RTM_GETTCLASS, &t, sizeof(t)) < 0) { perror("Cannot send dump request"); return 1; diff -Naur iproute2/tc/tc_filter.c iproute2-newifindex/tc/tc_filter.c --- iproute2/tc/tc_filter.c 2011-07-18 11:10:41.390973397 +0300 +++ iproute2-newifindex/tc/tc_filter.c 2011-07-18 11:28:18.097762745 +0300 @@ -80,7 +80,16 @@ NEXT_ARG(); if (d[0]) duparg("dev", *argv); + if (req.t.tcm_ifindex) + duparg("ifindex", *argv); strncpy(d, *argv, sizeof(d)-1); + } else if (strcmp(*argv, "ifindex") == 0) { + NEXT_ARG(); + if (d[0]) + duparg("dev", *argv); + if (req.t.tcm_ifindex) + duparg("ifindex", *argv); + req.t.tcm_ifindex = atoi(*argv); } else if (strcmp(*argv, "root") == 0) { if (req.t.tcm_parent) { fprintf(stderr, "Error: \"root\" is duplicate parent ID\n"); @@ -277,7 +286,16 @@ NEXT_ARG(); if (d[0]) duparg("dev", *argv); + if (t.tcm_ifindex) + duparg("ifindex", *argv); strncpy(d, *argv, sizeof(d)-1); + } else if (strcmp(*argv, "ifindex") == 0) { + NEXT_ARG(); + if (d[0]) + duparg("dev", *argv); + if (t.tcm_ifindex) + duparg("ifindex", *argv); + t.tcm_ifindex = atoi(*argv); } else if (strcmp(*argv, "root") == 0) { if (t.tcm_parent) { fprintf(stderr, "Error: \"root\" is duplicate parent ID\n"); @@ -332,10 +350,11 @@ if ((t.tcm_ifindex = ll_name_to_index(d)) == 0) { fprintf(stderr, "Cannot find device \"%s\"\n", d); return 1; - } - filter_ifindex = t.tcm_ifindex; + } } + filter_ifindex = t.tcm_ifindex; + if (rtnl_dump_request(&rth, RTM_GETTFILTER, &t, sizeof(t)) < 0) { perror("Cannot send dump request"); return 1; diff -Naur iproute2/tc/tc_qdisc.c iproute2-newifindex/tc/tc_qdisc.c --- iproute2/tc/tc_qdisc.c 2011-07-18 11:10:41.390973397 +0300 +++ iproute2-newifindex/tc/tc_qdisc.c 2011-07-18 11:29:09.322122349 +0300 @@ -76,7 +76,16 @@ NEXT_ARG(); if (d[0]) duparg("dev", *argv); + if (req.t.tcm_ifindex) + duparg("ifindex", *argv); strncpy(d, *argv, sizeof(d)-1); + } else if (strcmp(*argv, "ifindex") == 0) { + NEXT_ARG(); + if (d[0]) + duparg("dev", *argv); + if (req.t.tcm_ifindex) + duparg("ifindex", *argv); + req.t.tcm_ifindex = atoi(*argv); } else if (strcmp(*argv, "handle") == 0) { __u32 handle; if (req.t.tcm_handle) @@ -289,7 +298,18 @@ while (argc > 0) { if (strcmp(*argv, "dev") == 0) { NEXT_ARG(); + if (d[0]) + duparg("dev", *argv); + if (t.tcm_ifindex) + duparg("ifindex", *argv); strncpy(d, *argv, sizeof(d)-1); + } else if (strcmp(*argv, "ifindex") == 0) { + NEXT_ARG(); + if (d[0]) + duparg("dev", *argv); + if (t.tcm_ifindex) + duparg("ifindex", *argv); + t.tcm_ifindex = atoi(*argv); #ifdef TC_H_INGRESS } else if (strcmp(*argv, "ingress") == 0) { if (t.tcm_parent) { @@ -315,9 +335,10 @@ fprintf(stderr, "Cannot find device \"%s\"\n", d); return 1; } - filter_ifindex = t.tcm_ifindex; } + filter_ifindex = t.tcm_ifindex; + if (rtnl_dump_request(&rth, RTM_GETQDISC, &t, sizeof(t)) < 0) { perror("Cannot send dump request"); return 1;