diff options
author | Joan Lledó <jlledom@member.fsf.org> | 2025-07-29 17:52:44 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2025-07-29 22:08:54 +0200 |
commit | ecbc38df9f62ecffd1349b6f3b4fd234dbc08fe4 (patch) | |
tree | b9b5affa83d4227064586967d668876ac52d3a4b /lwip | |
parent | 529b93b8f6cc94830325cfde1b237f0ca04af38e (diff) |
After DHCPRELEASE, DHCP client sends a SIOCSIFADDR to set the
interface address to 0.0.0.0. This is not accepted by our IP
validator `ipv4config_is_valid()`. I think this use case is legit
so this commit makes the translator accept 0.0.0.0 as a valid address.
This assumes that a client trying to set IP to 0.0.0.0 is in fact trying
to remove the IP from the interface. Then it sets all fields to NONE, in
order to pass the validation.
* lwip/lwip-util.c: `configure_device`: Add the exception for 0.0.0.0
and 255.255.255.255.
Message-ID: <20250729155244.7976-2-jlledom@mailfence.com>
Diffstat (limited to 'lwip')
-rw-r--r-- | lwip/lwip-util.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lwip/lwip-util.c b/lwip/lwip-util.c index 77d2c233..eff15137 100644 --- a/lwip/lwip-util.c +++ b/lwip/lwip-util.c @@ -333,6 +333,19 @@ configure_device (struct netif *netif, uint32_t addr, uint32_t netmask, { error_t err = 0; + /* + * The caller is trying to set an invalid address, + * set all fields to empty so it passes the validation + */ + if (addr == INADDR_ANY || addr == INADDR_NONE) + { + addr = INADDR_NONE; + netmask = INADDR_NONE; + peer = INADDR_NONE; + broadcast = INADDR_NONE; + gateway = INADDR_NONE; + } + if (netmask != INADDR_NONE) /* * If broadcasting is enabled and we have a netmask lesser than 31 bits |