Skip to content

Commit 61f69d4

Browse files
yuwatabluca
authored andcommitted
network/link: ENODATA from reading IFLA_MASTER when an interface has no master
When an interface leaved from the master interface, then reading IFLA_MASTER attribute causes ENODATA. When the interface was previously enslaved to another interface, we need to remove reference to the interface from the previous master interface. This is especially important when ``` ip link set dev eth0 nomaster ``` is called. Fixes a bug introduced by 0d411b7 (v249). Fixes #37629. (cherry picked from commit f44b20b7b6c6b0a089a3ec2392ac85e4772e0357) (cherry picked from commit 2ad46c06069ad4241c94124dd5a3a73da7828048) (cherry picked from commit c584dfb2051207af017ea1437b3d255023c902f5) (cherry picked from commit a023d22)
1 parent 47ed4d5 commit 61f69d4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/network/networkd-link.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1993,8 +1993,8 @@ static int link_update_master(Link *link, sd_netlink_message *message) {
19931993

19941994
r = sd_netlink_message_read_u32(message, IFLA_MASTER, (uint32_t*) &master_ifindex);
19951995
if (r == -ENODATA)
1996-
return 0;
1997-
if (r < 0)
1996+
master_ifindex = 0; /* no master interface */
1997+
else if (r < 0)
19981998
return log_link_debug_errno(link, r, "rtnl: failed to read master ifindex: %m");
19991999

20002000
if (master_ifindex == link->ifindex)

0 commit comments

Comments
 (0)