print_linkinfo() declares char *name inside the LINK_NETNSID and
NEW_NETNSID blocks, shadowing the interface name in the enclosing
scope; rename them to nsname.
filter_nlmsg() declares struct rtvia *via, shadowing the inet_prefix
via used for the gateway filter match; rename it to rtvia, matching
the local used for the same attribute a few lines below.
ipnh_modify() redeclares int ret inside the hw_stats branch while the
enclosing ret is not yet live; drop the inner declaration.
Signed-off-by: Stephen Hemminger <step…@networkplumber.org>
---
ip/ipaddress.c | 12 ++++++------
ip/ipnexthop.c | 1 -
ip/iproute.c | 4 ++--
3 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 976fe83c..94e98102 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -1118,11 +1118,11 @@ int print_linkinfo(struct nlmsghdr *n, void *arg)
print_int(PRINT_JSON, "link_netnsid", NULL, id);
} else {
if (id >= 0) {
- char *name = get_name_from_nsid(id);
+ char *nsname = get_name_from_nsid(id);
- if (name)
+ if (nsname)
print_string(PRINT_FP, NULL,
- " link-netns %s", name);
+ " link-netns %s", nsname);
else
print_int(PRINT_FP, NULL,
" link-netnsid %d", id);
@@ -1134,10 +1134,10 @@ int print_linkinfo(struct nlmsghdr *n, void *arg)
if (tb[IFLA_NEW_NETNSID]) {
int id = rta_getattr_u32(tb[IFLA_NEW_NETNSID]);
- char *name = get_name_from_nsid(id);
+ char *nsname = get_name_from_nsid(id);
- if (name)
- print_string(PRINT_FP, NULL, " new-netns %s", name);
+ if (nsname)
+ print_string(PRINT_FP, NULL, " new-netns %s", nsname);
else
print_int(PRINT_FP, NULL, " new-netnsid %d", id);
}
diff --git a/ip/ipnexthop.c b/ip/ipnexthop.c
index ae6a28d4..fd854f89 100644
--- a/ip/ipnexthop.c
+++ b/ip/ipnexthop.c
@@ -1144,7 +1144,6 @@ static int ipnh_modify(int cmd, unsigned int flags, int argc, char **argv)
req.nhm.nh_protocol = prot;
} else if (!strcmp(*argv, "hw_stats")) {
bool hw_stats;
- int ret;
NEXT_ARG();
hw_stats = parse_on_off("hw_stats", *argv, &ret);
diff --git a/ip/iproute.c b/ip/iproute.c
index 067569c2..ce7c9ef2 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -259,9 +259,9 @@ static int filter_nlmsg(struct nlmsghdr *n, struct rtattr **tb, int host_len)
int family = r->rtm_family;
if (tb[RTA_VIA]) {
- struct rtvia *via = RTA_DATA(tb[RTA_VIA]);
+ struct rtvia *rtvia = RTA_DATA(tb[RTA_VIA]);
- family = via->rtvia_family;
+ family = rtvia->rtvia_family;
}
if (family != filter.rvia.family)
return 0;
--
2.53.0