summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoan Lledó <jlledom@member.fsf.org>2023-12-02 11:14:01 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-12-02 19:40:09 +0100
commit56cd317cd2fc0a131164be477c0ca0ae81e38c7d (patch)
treed09cc6fcc4b5023ffa7843d8c33d4224fc5b75f1
parentac677e298acb28453ce66bebef4eccd28ac82080 (diff)
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>
-rw-r--r--lwip/lwip-util.c14
1 files 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