]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
tc: declaration hides parameter
authorStephen Hemminger <stephen@networkplumber.org>
Thu, 2 Jun 2022 21:38:52 +0000 (14:38 -0700)
committerStephen Hemminger <stephen@networkplumber.org>
Fri, 17 Jun 2022 17:14:40 +0000 (10:14 -0700)
In several places (code reuse?), the variable handle
is a parameter to the function, but then
is defined inside basic block for classid.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
tc/f_basic.c
tc/f_bpf.c
tc/f_flower.c
tc/f_fw.c
tc/f_matchall.c
tc/f_route.c
tc/f_rsvp.c

index 7b19cea6e87e75c060ab822d5463ee73370a1405..9a60758e803ef2ffebd90a0590d94cf5de24b35a 100644 (file)
@@ -70,14 +70,14 @@ static int basic_parse_opt(struct filter_util *qu, char *handle,
                        continue;
                } else if (matches(*argv, "classid") == 0 ||
                           strcmp(*argv, "flowid") == 0) {
-                       unsigned int handle;
+                       unsigned int classid;
 
                        NEXT_ARG();
-                       if (get_tc_classid(&handle, *argv)) {
+                       if (get_tc_classid(&classid, *argv)) {
                                fprintf(stderr, "Illegal \"classid\"\n");
                                return -1;
                        }
-                       addattr_l(n, MAX_MSG, TCA_BASIC_CLASSID, &handle, 4);
+                       addattr_l(n, MAX_MSG, TCA_BASIC_CLASSID, &classid, 4);
                } else if (matches(*argv, "action") == 0) {
                        NEXT_ARG();
                        if (parse_action(&argc, &argv, TCA_BASIC_ACT, n)) {
index fa3552aefffdca88553b479432b3b9d638582640..96e4576aa2f88b25aadcf5e9492c86a2240bfe71 100644 (file)
@@ -126,14 +126,14 @@ opt_bpf:
                        bpf_uds_name = cfg.uds;
                } else if (matches(*argv, "classid") == 0 ||
                           matches(*argv, "flowid") == 0) {
-                       unsigned int handle;
+                       unsigned int classid;
 
                        NEXT_ARG();
-                       if (get_tc_classid(&handle, *argv)) {
+                       if (get_tc_classid(&classid, *argv)) {
                                fprintf(stderr, "Illegal \"classid\"\n");
                                return -1;
                        }
-                       addattr32(n, MAX_MSG, TCA_BPF_CLASSID, handle);
+                       addattr32(n, MAX_MSG, TCA_BPF_CLASSID, classid);
                } else if (matches(*argv, "direct-action") == 0 ||
                           matches(*argv, "da") == 0) {
                        bpf_flags |= TCA_BPF_FLAG_ACT_DIRECT;
index 805ca6718fa7cf7afd115a953baa82b06e277adf..622ec321f310708bf67241d20ad702158de920b2 100644 (file)
@@ -1452,17 +1452,17 @@ static int flower_parse_opt(struct filter_util *qu, char *handle,
        while (argc > 0) {
                if (matches(*argv, "classid") == 0 ||
                    matches(*argv, "flowid") == 0) {
-                       unsigned int handle;
+                       unsigned int classid;
 
                        NEXT_ARG();
-                       ret = get_tc_classid(&handle, *argv);
+                       ret = get_tc_classid(&classid, *argv);
                        if (ret) {
                                fprintf(stderr, "Illegal \"classid\"\n");
                                return -1;
                        }
-                       addattr_l(n, MAX_MSG, TCA_FLOWER_CLASSID, &handle, 4);
+                       addattr_l(n, MAX_MSG, TCA_FLOWER_CLASSID, &classid, 4);
                } else if (matches(*argv, "hw_tc") == 0) {
-                       unsigned int handle;
+                       unsigned int classid;
                        __u32 tc;
                        char *end;
 
@@ -1476,10 +1476,10 @@ static int flower_parse_opt(struct filter_util *qu, char *handle,
                                fprintf(stderr, "TC index exceeds max range\n");
                                return -1;
                        }
-                       handle = TC_H_MAKE(TC_H_MAJ(t->tcm_parent),
+                       classid = TC_H_MAKE(TC_H_MAJ(t->tcm_parent),
                                           TC_H_MIN(tc + TC_H_MIN_PRIORITY));
-                       addattr_l(n, MAX_MSG, TCA_FLOWER_CLASSID, &handle,
-                                 sizeof(handle));
+                       addattr_l(n, MAX_MSG, TCA_FLOWER_CLASSID, &classid,
+                                 sizeof(classid));
                } else if (matches(*argv, "ip_flags") == 0) {
                        NEXT_ARG();
                        ret = flower_parse_matching_flags(*argv,
index 688364f55d1d326489345942184d84b8b60fdd32..3c6ea93d2944ad21ecb61ec1455c0d343e0ba2a9 100644 (file)
--- a/tc/f_fw.c
+++ b/tc/f_fw.c
@@ -70,14 +70,14 @@ static int fw_parse_opt(struct filter_util *qu, char *handle, int argc, char **a
        while (argc > 0) {
                if (matches(*argv, "classid") == 0 ||
                    matches(*argv, "flowid") == 0) {
-                       unsigned int handle;
+                       unsigned int classid;
 
                        NEXT_ARG();
-                       if (get_tc_classid(&handle, *argv)) {
+                       if (get_tc_classid(&classid, *argv)) {
                                fprintf(stderr, "Illegal \"classid\"\n");
                                return -1;
                        }
-                       addattr_l(n, 4096, TCA_FW_CLASSID, &handle, 4);
+                       addattr_l(n, 4096, TCA_FW_CLASSID, &classid, 4);
                } else if (matches(*argv, "police") == 0) {
                        NEXT_ARG();
                        if (parse_police(&argc, &argv, TCA_FW_POLICE, n)) {
index 253ed5ce42e0aa3e249a826724510289fc9921a5..231d749e1f432b48536fb242974cbbfd5054c4ee 100644 (file)
@@ -63,14 +63,14 @@ static int matchall_parse_opt(struct filter_util *qu, char *handle,
        while (argc > 0) {
                if (matches(*argv, "classid") == 0 ||
                           strcmp(*argv, "flowid") == 0) {
-                       unsigned int handle;
+                       unsigned int classid;
 
                        NEXT_ARG();
-                       if (get_tc_classid(&handle, *argv)) {
+                       if (get_tc_classid(&classid, *argv)) {
                                fprintf(stderr, "Illegal \"classid\"\n");
                                return -1;
                        }
-                       addattr_l(n, MAX_MSG, TCA_MATCHALL_CLASSID, &handle, 4);
+                       addattr_l(n, MAX_MSG, TCA_MATCHALL_CLASSID, &classid, 4);
                } else if (matches(*argv, "action") == 0) {
                        NEXT_ARG();
                        if (parse_action(&argc, &argv, TCA_MATCHALL_ACT, n)) {
index 31fa96a0565e35a6d45c2b700bf0234e13ba55a5..ad516b382ac0dabfff7928f520218d5ca48c3be6 100644 (file)
@@ -91,14 +91,14 @@ static int route_parse_opt(struct filter_util *qu, char *handle, int argc, char
                        fh |= (0x8000|id)<<16;
                } else if (matches(*argv, "classid") == 0 ||
                           strcmp(*argv, "flowid") == 0) {
-                       unsigned int handle;
+                       unsigned int classid;
 
                        NEXT_ARG();
-                       if (get_tc_classid(&handle, *argv)) {
+                       if (get_tc_classid(&classid, *argv)) {
                                fprintf(stderr, "Illegal \"classid\"\n");
                                return -1;
                        }
-                       addattr_l(n, 4096, TCA_ROUTE4_CLASSID, &handle, 4);
+                       addattr_l(n, 4096, TCA_ROUTE4_CLASSID, &classid, 4);
                } else if (matches(*argv, "police") == 0) {
                        NEXT_ARG();
                        if (parse_police(&argc, &argv, TCA_ROUTE4_POLICE, n)) {
index 388e9ee59ad39e266e3f02375a658453b4082306..0211c3f5e74b1f084cafc1f1a630898b0811a53e 100644 (file)
@@ -230,14 +230,14 @@ static int rsvp_parse_opt(struct filter_util *qu, char *handle, int argc,
                        pinfo_ok++;
                } else if (matches(*argv, "classid") == 0 ||
                           strcmp(*argv, "flowid") == 0) {
-                       unsigned int handle;
+                       unsigned int classid;
 
                        NEXT_ARG();
-                       if (get_tc_classid(&handle, *argv)) {
+                       if (get_tc_classid(&classid, *argv)) {
                                fprintf(stderr, "Illegal \"classid\"\n");
                                return -1;
                        }
-                       addattr_l(n, 4096, TCA_RSVP_CLASSID, &handle, 4);
+                       addattr_l(n, 4096, TCA_RSVP_CLASSID, &classid, 4);
                } else if (strcmp(*argv, "tunnelid") == 0) {
                        unsigned int tid;