diff --git a/components/lwip/Kconfig b/components/lwip/Kconfig index 6ed128a617..4842182077 100644 --- a/components/lwip/Kconfig +++ b/components/lwip/Kconfig @@ -373,7 +373,7 @@ menu "LWIP" config LWIP_IPV6_RDNSS_MAX_DNS_SERVERS int "Use IPv6 Router Advertisement Recursive DNS Server Option" - depends on LWIP_IPV6 + depends on LWIP_IPV6_AUTOCONFIG default 0 help Use IPv6 Router Advertisement Recursive DNS Server Option (as per RFC 6106) to @@ -381,6 +381,15 @@ menu "LWIP" Set this option to a number of desired DNS servers advertised in the RA protocol. This feature is disabled when set to 0. + config LWIP_IPV6_DHCP6 + bool "Enable DHCPv6 stateless address autoconfiguration" + depends on LWIP_IPV6_AUTOCONFIG + default n + help + Enable DHCPv6 for IPv6 stateless address autoconfiguration. + Note that the dhcpv6 client has to be started using dhcp6_enable_stateless(netif); + Note that the stateful address autoconfiguration is not supported. + config LWIP_NETIF_STATUS_CALLBACK bool "Enable status callback for network interfaces" default n diff --git a/components/lwip/port/esp32/include/lwipopts.h b/components/lwip/port/esp32/include/lwipopts.h index b6e526491f..4bc2ad1396 100644 --- a/components/lwip/port/esp32/include/lwipopts.h +++ b/components/lwip/port/esp32/include/lwipopts.h @@ -978,6 +978,8 @@ #define LWIP_ND6_RDNSS_MAX_DNS_SERVERS CONFIG_LWIP_IPV6_RDNSS_MAX_DNS_SERVERS +#define LWIP_IPV6_DHCP6 CONFIG_LWIP_IPV6_DHCP6 + /* Enable all Espressif-only options */ #define ESP_LWIP 1 diff --git a/docs/en/api-guides/lwip.rst b/docs/en/api-guides/lwip.rst index 93697dc9ad..b3b5df9a1b 100644 --- a/docs/en/api-guides/lwip.rst +++ b/docs/en/api-guides/lwip.rst @@ -281,6 +281,58 @@ A number of configuration items are available to modify the task and the queues - :ref:`CONFIG_LWIP_TCPIP_TASK_STACK_SIZE` - :ref:`CONFIG_LWIP_TCPIP_TASK_AFFINITY` +IPv6 Support +------------ + +Both IPv4 and IPv6 are supported as dual stack and enabled by default (IPv6 may be disabled if it's not needed, see :ref:`lwip-ram-usage`). +IPv6 support is limited to *Stateless Autoconfiguration* only, *Stateful configuration* is not supported in ESP-IDF (not in upstream lwip). +IPv6 Address configuration is defined by means of these protocols or services: + +- **SLAAC** IPv6 Stateless Address Autoconfiguration (RFC-2462) +- **DHCPv6** Dynamic Host Configuration Protocol for IPv6 (RFC-8415) + +None of these two types of address configuration is enabled by default, so the device uses only Link Local addresses or statically defined addresses. + +.. _lwip-ivp6-autoconfig: + +Stateless Autoconfiguration Process +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +To enable address autoconfiguration using Router Advertisement protocol please enable: + +- :ref:`CONFIG_LWIP_IPV6_AUTOCONFIG` + +This configuration option enables IPv6 autoconfiguration for all network interfaces +(in contrast to the upstream lwIP, where the autoconfiguration needs to be explicitly enabled for each netif with ``netif->ip6_autoconfig_enabled=1`` + +.. _lwip-ivp6-dhcp6: + +DHCPv6 +^^^^^^ + +DHCPv6 in lwIP is very simple and support only stateless configuration. It could be enabled using: + +- :ref:`CONFIG_LWIP_IPV6_DHCP6` + +Since the DHCPv6 works only in its stateless configuration, the :ref:`lwip-ivp6-autoconfig` has to be enabled, too, by means of :ref:`CONFIG_LWIP_IPV6_AUTOCONFIG`. +Moreover, the DHCPv6 needs to be explicitly enabled form the application code using + + dhcp6_enable_stateless(netif); + +DNS servers in IPv6 autoconfiguration +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +In order to autoconfigure DNS server(s), especially in IPv6 only networks, we have these two options + +- Recursive domain name system -- this belongs to the Neighbor Discovery Protocol (NDP), uses :ref:`lwip-ivp6-autoconfig`. + Number of servers must be set :ref:`CONFIG_LWIP_IPV6_RDNSS_MAX_DNS_SERVERS`, this is option is disabled (set to 0) by default. + +- DHCPv6 stateless configuration -- uses :ref:`lwip-ivp6-dhcp6` to configure DNS servers. Note that the this configuration + assumes IPv6 Router Advertisement Flags (RFC-5175) to be set to + + - Managed Address Configuration Flag = 0 + - Other Configuration Flag = 1 + esp-lwip custom modifications -----------------------------