Article View: linux.kernel.netdev
Article #24751[PATCH iproute2-next 06/10] ip: rename and drop shadowing locals
From: Stephen Hemminger
Date: Mon, 30 Nov 2026 18:47
Date: Mon, 30 Nov 2026 18:47
82 lines
13529 bytes
13529 bytes
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
Technical Details
Message-ID:
<20261130184752.545119-7-stephen@networkplumber.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374404-linux-kernel-netdev=dewy.ruReferences:
<20261130184752.545119-1-stephen@networkplumber.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374404-linux-kernel-netdev=dewy.ru
From: stephen@networkplumber.org (Stephen Hemminger)
Newsgroups: linux.kernel.netdev
Subject: [PATCH iproute2-next 06/10] ip: rename and drop shadowing locals
Date: Mon, 30 Nov 2026 10:47:07 -0800
Organization: Usenet Network
Message-ID: <20261130184752.545119-7-stephen@networkplumber.org>
References: <20261130184752.545119-1-stephen@networkplumber.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="1512422"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:+w7mRTHIVZCAbCa2JU5SfabSMdQ= sha256:rkyhH8uZ9cwZWPMuHn0cFmWkLvlpAGaT+Zx6uF/6aG8=
sha1:v8LcWWV0SuasgN1SnQpBOrrQ/+I= sha256:wgvEspw5XLazvM55QixAyEKoGx++mD/CHnKLh1v6WZs=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id 16830126008; Mon, 30 Nov 2026 22:11:37 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.951
X-Spam-Status: No, score=-2.951 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=networkplumber-org.20260707.gappssmtp.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id BNvOiPA9QDvg;
Mon, 30 Nov 2026 22:11:34 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-374404-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=quarantine dis=none) header.from=networkplumber.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
by mail.dewy.ru (Postfix) with ESMTPS id 38796126003; Mon, 30 Nov 2026 22:11:26 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by tor.lore.kernel.org (Postfix) with ESMTP id 3E1F027E26; Mon, 30 Nov 2026 19:11:22 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1796065881;
b=4ZZshEj8a0g3HQPZc6Iven0FyDl1oYP8egg1cL+pBF1Z/xlUl6xBHahZM4BkbeE9HIcL
n6HBX8nW5q7Glk10yAZ9DUkwhuLY3cHEIFL/zgdS70q9Id3IcV2ZrntwQEKOVBqa7viL8
8wB+agWNY7KukfIjf+GeyNuZ7Bitnz8ei1jI1ItaMrG9UU9tnFFBWhvf2wtH28eDVBTcZ
Q9Nhd3XJFfl4SeTQPNfe16W7KAlpQH1RRCAFeEegiYNlitkIYs48uHyJML8Uq2hnR73Zn
fe9+vnH946H0oS+7lsfkAAoNELbXNu7DlAazy829y7F8HJatGDxPYCWTNIVOzZCI9Og==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796065881;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:
References:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
List-Unsubscribe:List-Owner:Precedence:MIME-Version:
Content-Transfer-Encoding;
bh=7zC6ZOVRqGAHduVpoQl0GWF79U16s9RR81+Y7insA+c=;
b=ABI0P3UE9Pgc91N8FNE9waj2t4mmFlB1dP5v4fO6pHJkoU4+CzjybcfNQ1tx1EbMnZqG
Gnp27C6TYMKsxu2phEAuin5GvqdLNaJCDGgWm0OtAHKvdTKKe7kB6iBFvBzWUc9ben2EP
AlL+aehcCnppVxQFKdC0SPe5YJpwEPDUXCbg5BSzyPwkYPlys6z1HtKpUy3nlZ0ysP25K
3dus3WxjT/fCf2HaTexGebR62+ksqkAxy/Y81/bobkXvp8jpWpslI+er4ynXnlq+JHkTx
sTX0uolyeEazj/R3+/OPFFiLRSBgmS7Ycvfhj0jjrwNtDbc5KeI2SDuTJSHST+bj9Eg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=networkplumber-org.20260707.gappssmtp.com header.i=@networkplumber-org.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b="Z11nXm/i";
dmarc=pass header.from=networkplumber.org;
spf=pass smtp.mailfrom=networkplumber.org;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 22675606A680;
Mon, 30 Nov 2026 19:11:21 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=networkplumber-org.20260707.gappssmtp.com header.i=@networkplumber-org.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=Z11nXm/i
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.216.50
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1796065880;
b=R685t7r2c3MbNGaSMvbRHbrT+7UYkbY1fgVamayJY3N6ye+bcxTCj54RC3jJvTD0GLJH
UC5jqF7xEy9tTh/gGjQdxpQ4LrbOXIxY7iIbMVSnvI7NBxQ5Bwq7+CiCSbcT4FvAYFMAu
6Q6FQchXczU14A4YMPIsUruFrDXElzkPzxdQqCuCTzbtfgOrVtD6Zy5KsGJ7Egu5FQXq7
j85hu34jV73DUbL1h8ljP2eJ32mIxFIjdhuHbz/pfQjm+IV9t7yHHbc+9M5NTAT9HhVjL
ZbgMHntkjvN0sDBfPHY72Cm/xtx5P2EWQpv+sUJNfFP1Skoh1dpJ1U9P8SW3uk5hX+g==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796065880;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:
Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version:
Content-Transfer-Encoding;
bh=7zC6ZOVRqGAHduVpoQl0GWF79U16s9RR81+Y7insA+c=;
b=UOuXtAmx2RU20nxMYhpGa6D/Yl5b6EobWAV67FcmmwAxFi91Tjm+7k2oDwH1Cfvr1q4J
I3A169BN+qUdP70EueNqffzUMlOsKDn6ohgyDnur/nP821MKG29RRics4jYknHTBf4cO9
hhHgXTAMa8ADoNfiZc6XZk+tIkMpM80hhnua5/Im4I7QSo7f+jPq2IsFxIafkzn5tBXar
2L7fjZz03MFBnxXdFIZa/sPWFHqdEHw1wYcS1wkKcKTJWw4H/3nWh0aEOP7vNOZsi5TEy
AVohbAVBkaCDzCSzgl9xHY2XlUwtNMDza3lz7dY7khkzvQkZXlZ0egrVqqTppqtLoIg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=networkplumber.org;
spf=pass smtp.mailfrom=networkplumber.org;
dkim=pass header.d=networkplumber-org.20260707.gappssmtp.com header.i=@networkplumber-org.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b="Z11nXm/i";
arc=none smtp.remote-ip=209.85.216.50
X-Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id F0A63606A32E
for <netdev@vger.kernel.org>; Mon, 30 Nov 2026 19:11:19 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org F0A63606A32E
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=networkplumber.org
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=networkplumber.org
X-Received: by mail-pj1-f50.google.com with SMTP id 98e67ed59e1d1-3b59bcb3301so122880a91.0
for <netdev@vger.kernel.org>; Mon, 30 Nov 2026 11:11:19 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=networkplumber-org.20260707.gappssmtp.com; s=20260707; t=1796065879; x=1796670679; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to:content-type;
bh=7zC6ZOVRqGAHduVpoQl0GWF79U16s9RR81+Y7insA+c=;
b=Z11nXm/iParclhRTJ6z2XY2juQDRMCI4RAeuLK3fo4wLN9SDrlApy6CTfrQsgK41c7
UrxIq3npXmOKeXfkuuls2YeTbDv7ZUjNmDGklnZBYdTEtHIPu+OqTEwcTpU6Kjke+7Rm
CzVhMLFuRQQP3cSM/sxnOzJ2Inkc2etu1G/aW83BXvb9ZbzBixBC6XJAvRJwjpQ9TjUV
K/K2BshzF37Flx6U7XCpkG4fNfMXNArPcsukE7LVd2N1GDV89oEvrK6cdFEySYMMYEwF
2FdieuybpvEErUFkSX6E2JL6+syaOWLdQMajKSdE0KHBL1a080VtQefpvAB+inMqo2cT
y+tA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1796065879; x=1796670679;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
:to:cc:subject:date:message-id:reply-to:content-type;
bh=7zC6ZOVRqGAHduVpoQl0GWF79U16s9RR81+Y7insA+c=;
b=0Lvtf8sqik7f25oVDgdUROUkP5VjvzoJbYINVtre32eT/YXSyJwRqSBrkHmyuSnG29
nsXEN3ASrhOmJDR/cF8kOjPY/MguCPM6qg4Q+za8yqbilU7ozE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e54a:b0:3b0:9310:b255 with SMTP id 98e67ed59e1d1-3b41c961506mr16495781a91.36.1796065879307;
Mon, 30 Nov 2026 11:11:19 -0800 (PST)
X-Received: from phoenix.lan (204-195-112-43.wavecable.com. [204.195.112.43])
by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b40f4312dfsm55591195a91.3.2026.11.30.11.11.18
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Mon, 30 Nov 2026 11:11:19 -0800 (PST)
X-Cc: dsahern@kernel.org,
Stephen Hemminger <stephen@networkplumber.org>
X-Mailer: git-send-email 2.53.0
X-In-Reply-To: <20261130184752.545119-1-stephen@networkplumber.org>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list