[PATCH] lwip: use default values for invalid IPv4 addresses
Joan Lledó <[email protected]> Thu, 23 Jul 2026 19:08:21 +0200
| Newsgroups | gmane.os.hurd.bugs |
|---|---|
| Message-ID | <[email protected]> |
From: Joan Lledó <[email protected]> When configuring a network interface with an invalid IPv4 address (INADDR_ANY or INADDR_NONE), set the address to INADDR_ANY and the netmask to 255.0.0.0 instead of INADDR_NONE. This passes validation and is consistent with pfinet behavior * lwip/lwip-util.c (init_ifs, configure_device): Use INADDR_ANY and inet_addr ("255.0.0.0") as defaults for invalid addresses. --- lwip/lwip-util.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lwip/lwip-util.c b/lwip/lwip-util.c index d6c3f41e..4a83b8f0 100644 --- a/lwip/lwip-util.c +++ b/lwip/lwip-util.c @@ -171,12 +171,12 @@ init_ifs (void *arg) /* * The caller is trying to set an invalid address, - * set all fields to empty so it passes the validation + * set all fields to default values so it passes the validation */ if (in->address.addr == INADDR_ANY || in->address.addr == INADDR_NONE) { - in->address.addr = INADDR_NONE; - in->netmask.addr = INADDR_NONE; + in->address.addr = INADDR_ANY; + in->netmask.addr = inet_addr ("255.0.0.0"); in->peer.addr = INADDR_NONE; in->gateway.addr = INADDR_NONE; } @@ -342,8 +342,8 @@ configure_device (struct netif *netif, ip4_addr_t addr, ip4_addr_t netmask, */ if (addr.addr == INADDR_ANY || addr.addr == INADDR_NONE) { - addr.addr = INADDR_NONE; - netmask.addr = INADDR_NONE; + addr.addr = INADDR_ANY; + netmask.addr = inet_addr ("255.0.0.0"); peer.addr = INADDR_NONE; broadcast.addr = INADDR_NONE; gateway.addr = INADDR_NONE; -- 2.50.1