From: Stephen Hemminger <stephen@networkplumber.org>
To: netdev@vger.kernel.org
Cc: dsahern@kernel.org, Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH iproute2-next 06/10] ip: rename and drop shadowing locals
Date: Mon, 30 Nov 2026 10:47:07 -0800 [thread overview]
Message-ID: <20261130184752.545119-7-stephen@networkplumber.org> (raw)
In-Reply-To: <20261130184752.545119-1-stephen@networkplumber.org>
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 <stephen@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
next prev parent reply other threads:[~2026-11-30 19:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 18:47 [PATCH iproute2-next 00/10] fix shadowed variable warnings Stephen Hemminger
2026-11-30 18:47 ` [PATCH iproute2-next 01/10] xfrm: rename shadowed SA direction local Stephen Hemminger
2026-11-30 18:47 ` [PATCH iproute2-next 02/10] ip address: rename the shadowed parameter of ipaddr_reset_filter() Stephen Hemminger
2026-11-30 18:47 ` [PATCH iproute2-next 03/10] lib: rename parameters that shadow globals Stephen Hemminger
2026-11-30 18:47 ` [PATCH iproute2-next 04/10] xfrm: rename local netlink handles that shadow the global rth Stephen Hemminger
2026-11-30 18:47 ` [PATCH iproute2-next 05/10] tc: rename and drop shadowing locals Stephen Hemminger
2026-11-30 18:47 ` Stephen Hemminger [this message]
2026-11-30 18:47 ` [PATCH iproute2-next 07/10] ifstat: rename shadowing local Stephen Hemminger
2026-11-30 18:47 ` [PATCH iproute2-next 08/10] bridge, devlink, rdma: rename shadowing locals Stephen Hemminger
2026-11-30 18:47 ` [PATCH iproute2-next 09/10] ss: fix shadowed variable warnings Stephen Hemminger
2026-11-30 18:47 ` [PATCH iproute2-next 10/10] Makefile: enable " Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261130184752.545119-7-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=dsahern@kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.