From dc6ad6482a492a9aa04cd05181d6e3ab0d34b66a Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 2 Dec 2020 19:19:06 +0900 Subject: [PATCH] network: do not set broadcast if prefixlen is 31 or 32 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. (cherry picked from commit df8aa086420e6ce61e32898b2bb7c88b87fd1c43) --- src/network/networkd-dhcp4.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c index 02d33841b69..68d975924c9 100644 --- a/src/network/networkd-dhcp4.c +++ b/src/network/networkd-dhcp4.c @@ -861,7 +861,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 -- 2.47.3