From: Joan Lledó <[email protected]>
When the caller passes INADDR_ANY or INADDR_NONE as the address, reset
netmask, peer and gateway to INADDR_NONE too, so the configuration passes
ipv4config_is_valid() validation instead of being silently dropped.
---
lwip/lwip-util.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/lwip/lwip-util.c b/lwip/lwip-util.c
index 988e3675..f6f0a631 100644
--- a/lwip/lwip-util.c
+++ b/lwip/lwip-util.c
@@ -169,6 +169,18 @@ init_ifs (void *arg)
if (!in->dev_name[0])
continue;
+ /*
+ * The caller is trying to set an invalid address,
+ * set all fields to empty 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->peer.addr = INADDR_NONE;
+ in->gateway.addr = INADDR_NONE;
+ }
+
if (!ipv4config_is_valid (in->address.addr, in->netmask.addr,
in->gateway.addr, INADDR_NONE))
continue;
--
2.50.1