Closed reitermarkus closed 6 months ago
I've implemented the DHCP task in my project to test for something, and it works quite well.
~I'm wondering if, instead of adding this as an example, we add it as a task, and export or spawn it automagically when using dhcp_enabled: true
in demio_common::ipv4::RouterConfiguration
when spawning an AP.~
Edit: Disregard last comment; embedded-svc
isn't a hard dependency of esp-wifi
anymore.
Thanks! esp-wifi
is moved into the esp-hal
repository. If you want to continue working on this please consider re-opening the PR there
This adds a DHCP server and DNS server to the
embassy
access point example to automatically open a captive portal after connecting.Some things I am not sure about/need to be investigated further:
According to RFC 2131, section 4.1, if the broadcast bit is not set, the DHCP server should send the
DHCPOFFER
response with unicast. Sending it to the newly assigned IP (yiaddr
) doesn't work since the client doesn't yet have this IP.I had to spawn 3 HTTP server tasks, since upon connecting, at least iOS clients seem to send at least two requests to the
captive.apple.com
domain, one of which fails withConnectionReset
and blocks the other one during the timeout period.Sometimes, devices will get an IP via DHCP, the captive portal opens, and then they will (sometimes?) send another DHCP request, which closes the captive portal again until the (same) IP is obtained again and the captive portal opens again.
Tested using