Skip to content

Conversation

@cpq
Copy link
Member

@cpq cpq commented Nov 15, 2025

Main thing here is the update of c->loc when DCHP gives us the IP. It fixes this situation, when we request a web page from a device, but the response comes from IP address 0.0.0.0:

Screenshot 2025-11-15 at 09 38 53

This is how 0.0.0.0 situation happens:

  1. Firmware code does mg_mgr_init() and opens HTTP listener mg_http_listen(). The listener connection grabs the local IP address from the interface: c->loc.ip4 = ifp->ip. Since DHCP did not yet gave up the IP, it is 0.
  2. DHCP gives up the IP. ifp->ip is now non-0, but all existing connections have c->loc.ip4 as 0.
  3. Client makes a request. Listener accepts. Accepted connection inherits c->loc from the listener, which is 0.

So, this situation was there forever, but appeared in my tests with TM4C129 board. This PR fixes up the c->loc when DHCP assigns us the IP.

@cpq cpq requested a review from scaprile November 15, 2025 09:44
@scaprile scaprile changed the title Fixes for tm4c Allow listeners to start before we have an address, close outstanding TCP connections on address change Nov 17, 2025
@scaprile scaprile closed this Nov 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants