From 56cd317cd2fc0a131164be477c0ca0ae81e38c7d Mon Sep 17 00:00:00 2001 From: Joan Lledó Date: Sat, 2 Dec 2023 11:14:01 +0100 Subject: lwip: Allocate the loopback netif by default 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. Message-ID: <20231202101401.11542-2-jlledom@mailfence.com> --- lwip/lwip-util.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lwip/lwip-util.c') 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 -- cgit v1.2.3