]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: do not set broadcast if prefixlen is 31 or 32
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 2 Dec 2020 10:19:06 +0000 (19:19 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 3 Dec 2020 01:22:50 +0000 (10:22 +0900)
After fe841414ef157f7f01d339c5d5730126e7b5fe0a, broadcast address is
also compared with existing one to determine whether the address is
foregin or not. So, the address object should not contain unnecessary
information.

Fixes #17803.

src/network/networkd-dhcp4.c

index 8f661c646fd678be2d95966c7be44d37791c5877..14e7a287746448296c6b0de473846f0a16956755 100644 (file)
@@ -865,7 +865,8 @@ static int dhcp4_update_address(Link *link, bool announce) {
         addr->cinfo.ifa_prefered = lifetime;
         addr->cinfo.ifa_valid = lifetime;
         addr->prefixlen = prefixlen;
-        addr->broadcast.s_addr = address.s_addr | ~netmask.s_addr;
+        if (prefixlen <= 30)
+                addr->broadcast.s_addr = address.s_addr | ~netmask.s_addr;
         SET_FLAG(addr->flags, IFA_F_NOPREFIXROUTE, !link_prefixroute(link));
 
         /* allow reusing an existing address and simply update its lifetime