summaryrefslogtreecommitdiff
path: root/src/network/networkd-dhcp4.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2020-12-02 19:19:06 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2020-12-03 10:22:50 +0900
commitdf8aa086420e6ce61e32898b2bb7c88b87fd1c43 (patch)
treea5678efe7577ed227b75683fe3b16e80ddd29b30 /src/network/networkd-dhcp4.c
parent565147b7bb2156277a2efaccd920d3ca9c21f8a8 (diff)
downloadsystemd-df8aa086420e6ce61e32898b2bb7c88b87fd1c43.tar.gz
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.
Diffstat (limited to 'src/network/networkd-dhcp4.c')
-rw-r--r--src/network/networkd-dhcp4.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
index 8f661c646f..14e7a28774 100644
--- a/src/network/networkd-dhcp4.c
+++ b/src/network/networkd-dhcp4.c
@@ -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