mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-29 05:21:37 +03:00
DHCP custom option (#8582)
* works * fixup! works * back to callbacks * names * daisy chain * seconds * less inline * fix dns setter * might as well keep using initlist /to d-a-v it has automatic storage, here it's the same stack based one (just one less line for us) * shift blame * naming * fix impl * revert to ip4 dns * merge fix * restyle * masking done wrong
This commit is contained in:
@ -52,10 +52,13 @@ void setup() {
|
||||
}
|
||||
Serial.printf("\nSTA: %s (dns: %s / %s)\n", WiFi.localIP().toString().c_str(), WiFi.dnsIP(0).toString().c_str(), WiFi.dnsIP(1).toString().c_str());
|
||||
|
||||
// give DNS servers to AP side
|
||||
// By default, DNS option will point to the interface IP
|
||||
// Instead, point it to the real DNS server.
|
||||
// Notice that:
|
||||
// - DhcpServer class only supports IPv4
|
||||
// - Only a single IP can be set
|
||||
auto& server = WiFi.softAPDhcpServer();
|
||||
server.dhcps_set_dns(0, WiFi.dnsIP(0));
|
||||
server.dhcps_set_dns(1, WiFi.dnsIP(1));
|
||||
server.setDns(WiFi.dnsIP(0));
|
||||
|
||||
WiFi.softAPConfig( // enable AP, with android-compatible google domain
|
||||
IPAddress(172, 217, 28, 254), IPAddress(172, 217, 28, 254), IPAddress(255, 255, 255, 0));
|
||||
|
Reference in New Issue
Block a user