Hi,

This patch fixes a few bugs. The translator was assuming one interface was 
already allocated in `netif_list` when calling `init_ifs` during startup, and 
used it to configure the loopback interface [1]. That was possibly true in the 
past but after upgrading liblwip I found `netif_list` is always null at the 
first call to `init_ifs`. That breaks fsysopts, the loopback interface and DHCP.

fsysopts is broken only when the translator is started without parameters. When 
that happens, `netif_list` remains null after `init_ifs` finished. Because of 
that, a call to fsysopts tries to initialize the stack again instead of 
reconfiguring it [2].

That's linked to the second problem, the lack of loopback interface. 
`parse_opt` at [2] assumes that a correctly initialized stack will at least 
have one configured interface, the loopback one. And `init_ifs` only configures 
it when there's a single netif allocated at `netif_list`, that condition is not 
met if `netif_list` arrives null.

Finally, DHCP fails on lwip if the translator is installed without parameters, 
like pfinet is:

$ showtrans /servers/socket/2
/hurd/pfinet -6 /servers/socket/26

The DHCP client calls fsysopts on the translator [3]. So when installed without 
parameters, this call to fsysopts tries to initialize the stack again and 
crashes.

This simple patch fixes the problems.

---
[1] https://git.savannah.gnu.org/cgit/hurd/hurd.git/tree/lwip/lwip-util.c#n155
[2] https://git.savannah.gnu.org/cgit/hurd/hurd.git/tree/lwip/options.c#n266
[3] 
https://salsa.debian.org/debian/isc-dhcp/-/blob/master/debian/dhclient-script.hurd#L184


Reply via email to