summaryrefslogtreecommitdiffstats
path: root/src/network/networkd-ipv4ll.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2024-11-01 16:13:00 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2024-11-02 14:42:01 +0100
commit500c61ee490225e1d6481e38449ea358135b30d0 (patch)
tree211ab4befd2b6e42e41ba738fef48cedeb31ab5d /src/network/networkd-ipv4ll.c
parentnetwork/dhcp4: do not restart IPv4LL client when KeepConfiguration=dhcp (diff)
downloadsystemd-500c61ee490225e1d6481e38449ea358135b30d0.tar.xz
systemd-500c61ee490225e1d6481e38449ea358135b30d0.zip
network/ipv4ll: not necessary to set initial address on each start
Diffstat (limited to '')
-rw-r--r--src/network/networkd-ipv4ll.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/network/networkd-ipv4ll.c b/src/network/networkd-ipv4ll.c
index ea960593bb..648f20d596 100644
--- a/src/network/networkd-ipv4ll.c
+++ b/src/network/networkd-ipv4ll.c
@@ -174,6 +174,17 @@ static int ipv4ll_check_mac(sd_ipv4ll *ll, const struct ether_addr *mac, void *u
return link_get_by_hw_addr(m, &hw_addr, NULL) >= 0;
}
+static int ipv4ll_set_address(Link *link) {
+ assert(link);
+ assert(link->network);
+ assert(link->ipv4ll);
+
+ if (!in4_addr_is_set(&link->network->ipv4ll_start_address))
+ return 0;
+
+ return sd_ipv4ll_set_address(link->ipv4ll, &link->network->ipv4ll_start_address);
+}
+
int ipv4ll_configure(Link *link) {
uint64_t seed;
int r;
@@ -201,6 +212,10 @@ int ipv4ll_configure(Link *link) {
return r;
}
+ r = ipv4ll_set_address(link);
+ if (r < 0)
+ return r;
+
r = sd_ipv4ll_set_mac(link->ipv4ll, &link->hw_addr.ether);
if (r < 0)
return r;