esp8266 / esp8266/Arduino

Use IPv6 Router Advertisement options for DNS configuration (RFC 8106)

Open
#7,798 5 comments 0 reactions 1 assignee Claimed by @d-a-v View on GitHub
component: network type: enhancement waiting for feedback
Dominant language
C++
Stars
16.7k
Forks
13.1k
PR merge metrics
No merged PRs in 30d

Description

### Basic Infos

- [x] This issue complies with the [issue POLICY doc](https://github.com/esp8266/Arduino/blob/master/POLICY.md).
- [x] I have read the documentation at [readthedocs](https://arduino-esp8266.readthedocs.io/en/latest) and the issue is not addressed there.
- [x] I have tested that the issue is present in current master branch (aka latest git).
- [x] I have searched the issue tracker for a similar issue.
- [x] If there is a stack dump, I have decoded it.
- [x] I have filled out all fields below.

#### Platform

- Hardware: ESP-12
- Core Version: 2.7.3-3-g2843a5ac
- Development Env: Platformio
- Operating System: Fedora

### Settings in IDE

- Module: Generic ESP8266 Module
- Flash Size: 4MB
- lwip Variant: IPv6+STABLE-2_1_2_RELEASE
- Reset Method: manual
- Upload Using: serial

### Problem Description

When connecting the ESP to an ipv6 enabled WiFi network with a router, that sends the RDNSS option in its router advertisements, the received DNS server is not respected and not visible when querying `WiFi.dnsIP()`. This feature is supported by `lwIP`, but seems to be disabled:
https://github.com/esp8266/Arduino/blob/5c29517d119393f3197871957ff18adbf918bac9/tools/sdk/lwip2/include/lwipopts.h#L2679

### [MCVE](https://stackoverflow.com/help/mcve) Sketch

```cpp
#include
#include

void setup()
{
Serial.begin(74880);
Serial.setDebugOutput(ENABLE_DEBUG);
Serial.println(ESP.getFullVersion());

WiFi.mode(WIFI_STA);
WiFi.hostname(SYSTEM_HOSTNAME);
WiFi.begin(WIFI_STA_SSID, WIFI_STA_PASSWORD);

// Wait for IPv4 & IPv6 addresses other than link-local
bool hasV4 = false, hasv6 = false;
while (!hasV4 || !hasv6)
{
for (auto entry : addrList)
{
IPAddress addr = entry.addr();
if (addr.isLocal())
continue;

if (!hasV4)
hasV4 = addr.isV4();
if (!hasv6)
hasv6 = addr.isV6();
}

Serial.print('.');
delay(500);
}

Serial.println();

// Print dns server list
Serial.print("DNS servers:");
for (int i = 0; i < DNS_MAX_SERVERS; i++)
{
IPAddress dns = WiFi.dnsIP(i);
if (dns.isSet())
Serial.printf(" %s", dns.toString().c_str());
}
Serial.println();
}

void loop()
{
}

```

### Debug Messages

```
SDK:2.2.2-dev(38a443e)/Core:2.7.3-3-g2843a5ac=20703003/lwIP:IPv6+STABLE-2_1_2_RELEASE/glue:1.2-30-g92add50/BearSSL:5c771be
....
DNS servers: 192.168.11.1 // <-- Here I would expect the IPv6 DNS server, too.
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.