diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-11-01 16:13:00 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-11-02 14:42:01 +0100 |
commit | 500c61ee490225e1d6481e38449ea358135b30d0 (patch) | |
tree | 211ab4befd2b6e42e41ba738fef48cedeb31ab5d /src/network/networkd-ipv4ll.c | |
parent | network/dhcp4: do not restart IPv4LL client when KeepConfiguration=dhcp (diff) | |
download | systemd-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.c | 15 |
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; |