From 86173383a3ca5e877f3b741101a1d72552dded32 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 8 Sep 2021 14:08:13 +0900 Subject: [PATCH] network: introduce ipv4acd_set_ifname() --- src/network/networkd-ipv4acd.c | 15 +++++++++++++++ src/network/networkd-ipv4acd.h | 1 + src/network/networkd-link.c | 9 +++------ 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/network/networkd-ipv4acd.c b/src/network/networkd-ipv4acd.c index 5c57032f2a8..74a669ead43 100644 --- a/src/network/networkd-ipv4acd.c +++ b/src/network/networkd-ipv4acd.c @@ -288,3 +288,18 @@ int ipv4acd_stop(Link *link) { return r; } + +int ipv4acd_set_ifname(Link *link) { + Address *address; + int r; + + assert(link); + + SET_FOREACH(address, link->addresses_ipv4acd) { + r = sd_ipv4acd_set_ifname(address->acd, link->ifname); + if (r < 0) + return r; + } + + return 0; +} diff --git a/src/network/networkd-ipv4acd.h b/src/network/networkd-ipv4acd.h index d2b4ff775f5..c3d8b0ec387 100644 --- a/src/network/networkd-ipv4acd.h +++ b/src/network/networkd-ipv4acd.h @@ -8,3 +8,4 @@ int ipv4acd_address_is_ready_to_configure(Link *link, const Address *address); int ipv4acd_update_mac(Link *link); int ipv4acd_start(Link *link); int ipv4acd_stop(Link *link); +int ipv4acd_set_ifname(Link *link); diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 4afd540d201..96c0a3e048b 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -2276,12 +2276,9 @@ static int link_update_name(Link *link, sd_netlink_message *message) { return log_link_debug_errno(link, r, "Failed to update interface name in IPv4LL client: %m"); } - Address *a; - SET_FOREACH(a, link->addresses_ipv4acd) { - r = sd_ipv4acd_set_ifname(a->acd, link->ifname); - if (r < 0) - return log_link_debug_errno(link, r, "Failed to update interface name in IPv4ACD client: %m"); - } + r = ipv4acd_set_ifname(link); + if (r < 0) + return log_link_debug_errno(link, r, "Failed to update interface name in IPv4ACD client: %m"); return 0; }