Hi James, On 26/08/2026 07:29, James Hilliard wrote: > lwIP commands currently create and remove the stack's only network > interface for each operation. That model cannot support a persistent > client: starting another command replaces its interface, and either > client can stop Ethernet while the other still owns callbacks and PCBs.
Indeed. What was considered acceptable when we introduced lwIP for basic commands is becoming a burden. Thanks for looking into this. > First correct wget's existing receive-error path to return ERR_ABRT after > it aborts and frees the TCP PCB. > > Introduce a reference-counted runtime which owns one Ethernet device and > one lwIP netif. Clients retain their own protocol callbacks and PCBs, > while one non-reentrant poll entry point services timers, scheduled work > and every attached client. An address-less DHCP attachment temporarily > owns the IPv4 configuration; environment addressing is restored when it > detaches. > > Migrate the existing lwIP commands to the runtime, then add an lwIP > netconsole transport. Netconsole remains attached while a foreground > network command runs, and that command's polling services both protocols. > > The runtime permits independent lwIP clients to attach their protocol > state and share the poll loop without creating another netif or Ethernet > owner. > > Sharing the stack makes asynchronous teardown significant. Add DNS > callback cancellation, HTTP client abort and DHCP stop-without-release > operations so clients can detach without leaving callbacks or protocol > state behind. The corresponding vendored lwIP changes are kept as > separate patches for upstream submission. > > Validation included: > > - sandbox W=1 builds and DM tests for runtime ownership, multiple UDP > PCBs, address handoff, callback cancellation, immediate abort of an > established HTTP connection, nested polling and netconsole > input/output; > - no-DNS, sandbox_spl, sandbox64_lwIP, qemu_arm64_lwIP and legacy-stack > builds; and > - H616 hardware tests of bidirectional netconsole, a TFTP download while > netconsole remained active, TFTP upload and HTTP wget, with matching > payload checksums and successful network use after netconsole detached. I am OK with the approach but I do see a problem in patch 08/10 which IMO doesn't enforce proper address ownership rules. Please see my suggestion as a reply to that patch. Other than that, LGTM. Thanks, -- Jerome > > Assisted-by: Codex:gpt-5.6-sol > Signed-off-by: James Hilliard <[email protected]> > --- > checkpatch reports expected diagnostics for patches 5-7 because vendored > lwIP code follows upstream lwIP formatting. It also reports generic > MAINTAINERS prompts for files already covered by drivers/net/ and test/dm/, > and preprocessor guards required when optional APIs are not declared. > > To: Jerome Forissier <[email protected]> > To: Sughosh Ganu <[email protected]> > To: [email protected] > Cc: Tom Rini <[email protected]> > Cc: David Lechner <[email protected]> > Cc: Heinrich Schuchardt <[email protected]> > Cc: James Hilliard <[email protected]> > Cc: Julien Stephan <[email protected]> > Cc: Naveen Kumar Chaudhary <[email protected]> > Cc: Luca Jones <[email protected]> > Cc: Weijie Gao <[email protected]> > Cc: Pranav Tilak <[email protected]> > Cc: Simon Glass <[email protected]> > Cc: Vincent Jardin <[email protected]> > Cc: Quentin Schulz <[email protected]> > Cc: "Lucien.Jheng" <[email protected]> > > --- > James Hilliard (10): > net: lwip: return ERR_ABRT after aborting wget receive > net: split netconsole transport from stdio frontend > net: netconsole: use unsigned port numbers > net: netconsole: cache environment settings > net: lwip: allow DNS callbacks to be canceled > net: lwip: add an HTTP client abort operation > net: lwip: allow DHCP to stop without releasing its lease > net: lwip: share one network runtime between clients > test: dm: cover the shared lwIP runtime > net: netconsole: add an lwIP transport > > cmd/lwip/ping.c | 41 +-- > cmd/lwip/sntp.c | 19 +- > drivers/net/Makefile | 6 +- > drivers/net/netconsole-legacy.c | 156 ++++++++++ > drivers/net/netconsole-lwip.c | 200 ++++++++++++ > drivers/net/netconsole.c | 201 +++--------- > drivers/net/netconsole.h | 29 ++ > include/net-lwip.h | 42 ++- > lib/lwip/lwip/src/apps/http/http_client.c | 71 ++++- > lib/lwip/lwip/src/apps/sntp/sntp.c | 3 + > lib/lwip/lwip/src/core/dns.c | 26 ++ > lib/lwip/lwip/src/core/ipv4/dhcp.c | 39 ++- > lib/lwip/lwip/src/include/lwip/apps/http_client.h | 1 + > lib/lwip/lwip/src/include/lwip/dhcp.h | 1 + > lib/lwip/lwip/src/include/lwip/dns.h | 1 + > net/Kconfig | 13 +- > net/lwip/dhcp.c | 57 ++-- > net/lwip/dns.c | 24 +- > net/lwip/net-lwip.c | 248 ++++++++++++--- > net/lwip/nfs.c | 25 +- > net/lwip/tftp.c | 54 ++-- > net/lwip/wget.c | 72 +++-- > test/dm/Makefile | 6 + > test/dm/lwip.c | 353 > ++++++++++++++++++++++ > test/dm/netconsole.c | 343 +++++++++++++++++++++ > 25 files changed, 1646 insertions(+), 385 deletions(-) > --- > base-commit: 964ad5b5c91b7be56e443e899d7f873e6aa8c9fc > change-id: 20260825-submit-lwip-runtime-netconsole-v1-9c08ed87e0fe > > Best regards, > -- > James Hilliard <[email protected]>
