[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250731215920.3675217-1-william@wkennington.com>
Date: Thu, 31 Jul 2025 14:59:19 -0700
From: "William A. Kennington III" <william@...nnington.com>
To: netdev@...r.kernel.org
Cc: "William A. Kennington III" <william@...nnington.com>
Subject: [PATCH iproute2-next 1/2] lib/ll_map: Update name when changed
On systems with a predictable naming scheme, our interfaces always first
come up with the incremental kernel name prior to being renamed. If we
have multiple links that come up at different times, they will usually
use overlapping names when first seen. The predictable name is then set
shorlty after. When using ip-monitor, all routes will then end up
printing with this same first name (usually best seen with eth0). In
these instances the routes cannot have their interfaces distinguished,
as they are printed with a stale name.
Consider the following example while running `ip-monitor`
```
$ sudo ip link add dummy1 type dummy
$ sudo ip link set dummy1 name dummy2
$ sudo ip link set dummy2 addr 00:00:00:00:00:02
$ sudo ip link add dummy1 type dummy
$ sudo ip link set dummy1 addr 00:00:00:00:00:01
$ sudo ip link set dummy2 up
$ sudo ip link set dummy1 up
```
We currently see the following, notice the address and route lines
```
20: dummy1: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default
link/ether 82:49:17:d4:21:88 brd ff:ff:ff:ff:ff:ff
20: dummy1: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default
link/ether 86:61:a6:69:1d:7b brd ff:ff:ff:ff:ff:ff
20: dummy2: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default
link/ether 86:61:a6:69:1d:7b brd ff:ff:ff:ff:ff:ff
20: dummy2: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default
link/ether 00:00:00:00:00:02 brd ff:ff:ff:ff:ff:ff
21: dummy1: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default
link/ether d6:f6:da:e5:d7:7c brd ff:ff:ff:ff:ff:ff
21: dummy1: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default
link/ether 86:61:a6:69:1d:7b brd ff:ff:ff:ff:ff:ff
21: dummy1: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default
link/ether 00:00:00:00:00:01 brd ff:ff:ff:ff:ff:ff
20: dummy2: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default
link/ether 00:00:00:00:00:02 brd ff:ff:ff:ff:ff:ff
multicast ff00::/8 dev dummy1 table local proto kernel metric 256 pref medium
fe80::/64 dev dummy1 proto kernel metric 256 pref medium
20: dummy1 inet6 fe80::200:ff:fe00:2/64 scope link proto kernel_ll
valid_lft forever preferred_lft forever
local fe80::200:ff:fe00:2 dev dummy1 table local proto kernel metric 0 pref medium
21: dummy1: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default
link/ether 00:00:00:00:00:01 brd ff:ff:ff:ff:ff:ff
multicast ff00::/8 dev dummy1 table local proto kernel metric 256 pref medium
fe80::/64 dev dummy1 proto kernel metric 256 pref medium
21: dummy1 inet6 fe80::200:ff:fe00:1/64 scope link proto kernel_ll
valid_lft forever preferred_lft forever
local fe80::200:ff:fe00:1 dev dummy1 table local proto kernel metric 0 pref medium
```
Signed-off-by: William A. Kennington III <william@...nnington.com>
---
lib/ll_map.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lib/ll_map.c b/lib/ll_map.c
index 8970c20f..431946f5 100644
--- a/lib/ll_map.c
+++ b/lib/ll_map.c
@@ -118,9 +118,8 @@ static void ll_entry_update(struct ll_cache *im, struct ifinfomsg *ifi,
{
unsigned int h;
+ strcpy(im->name, ifname);
im->flags = ifi->ifi_flags;
- if (!strcmp(im->name, ifname))
- return;
hlist_del(&im->name_hash);
h = namehash(ifname) & (IDXMAP_SIZE - 1);
hlist_add_head(&im->name_hash, &name_head[h]);
--
2.50.1.565.gc32cd1483b-goog
Powered by blists - more mailing lists