From: Joan Lledó <jlle...@member.fsf.org>

The translator received a null `netif_list` during initialization, this
caused a few bugs.

When started without parameters, the translator didn't add any new
interface to `netif_list`, and that broke any subsequent fsysopts over
the translator, as the stack was being initialized again instead of
being reconfigured.

DHCP was broken because the translator is usually installed without
parameters, which are supposed to be added by the DHCP client through
fsysopts.

The absence of an allocated `netif_list` also prevented configuring a
loopback interface.

After these changes, starting the translator always allocates one
interface and configures it as loopback.
---
 lwip/lwip-util.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/lwip/lwip-util.c b/lwip/lwip-util.c
index fc4cb137..77d2c233 100644
--- a/lwip/lwip-util.c
+++ b/lwip/lwip-util.c
@@ -149,13 +149,13 @@ init_ifs (void *arg)
   ip6_addr_t *address6;
   int i;
 
-  if (netif_list != 0)
-    {
-      if (netif_list->next == 0)
-       init_loopback ();
-      else
-       remove_ifs ();
-    }
+  if (netif_list == 0)
+    netif_list = calloc (1, sizeof (struct netif));
+
+  if (netif_list->next == 0)
+    init_loopback ();
+  else
+    remove_ifs ();
 
   /*
    * Go through the list backwards. For LwIP
-- 
2.40.1


Reply via email to