mirror of
https://github.com/esphome/esphome.git
synced 2024-12-26 17:17:46 +01:00
[network] Default ipv6 to false to always set the flags (#6937)
* [network] Default ipv6 to false to always set the flags * Separate tests for ipv6 disabled and enabled * Forgot other platforms wouldnt have the variable in config
This commit is contained in:
parent
310f850ee4
commit
8567877f07
@ -19,7 +19,12 @@ IPAddress = network_ns.class_("IPAddress")
|
||||
|
||||
CONFIG_SCHEMA = cv.Schema(
|
||||
{
|
||||
cv.SplitDefault(CONF_ENABLE_IPV6): cv.All(
|
||||
cv.SplitDefault(
|
||||
CONF_ENABLE_IPV6,
|
||||
esp8266=False,
|
||||
esp32=False,
|
||||
rp2040=False,
|
||||
): cv.All(
|
||||
cv.boolean, cv.only_on([PLATFORM_ESP32, PLATFORM_ESP8266, PLATFORM_RP2040])
|
||||
),
|
||||
cv.Optional(CONF_MIN_IPV6_ADDR_COUNT, default=0): cv.positive_int,
|
||||
@ -28,18 +33,17 @@ CONFIG_SCHEMA = cv.Schema(
|
||||
|
||||
|
||||
async def to_code(config):
|
||||
if CONF_ENABLE_IPV6 in config:
|
||||
cg.add_define("USE_NETWORK_IPV6", config[CONF_ENABLE_IPV6])
|
||||
cg.add_define(
|
||||
"USE_NETWORK_MIN_IPV6_ADDR_COUNT", config[CONF_MIN_IPV6_ADDR_COUNT]
|
||||
)
|
||||
if CORE.using_esp_idf:
|
||||
add_idf_sdkconfig_option("CONFIG_LWIP_IPV6", config[CONF_ENABLE_IPV6])
|
||||
add_idf_sdkconfig_option(
|
||||
"CONFIG_LWIP_IPV6_AUTOCONFIG", config[CONF_ENABLE_IPV6]
|
||||
if (enable_ipv6 := config.get(CONF_ENABLE_IPV6, None)) is not None:
|
||||
cg.add_define("USE_NETWORK_IPV6", enable_ipv6)
|
||||
if enable_ipv6:
|
||||
cg.add_define(
|
||||
"USE_NETWORK_MIN_IPV6_ADDR_COUNT", config[CONF_MIN_IPV6_ADDR_COUNT]
|
||||
)
|
||||
if CORE.using_esp_idf:
|
||||
add_idf_sdkconfig_option("CONFIG_LWIP_IPV6", enable_ipv6)
|
||||
add_idf_sdkconfig_option("CONFIG_LWIP_IPV6_AUTOCONFIG", enable_ipv6)
|
||||
else:
|
||||
if config[CONF_ENABLE_IPV6]:
|
||||
if enable_ipv6:
|
||||
cg.add_build_flag("-DCONFIG_LWIP_IPV6")
|
||||
cg.add_build_flag("-DCONFIG_LWIP_IPV6_AUTOCONFIG")
|
||||
if CORE.is_rp2040:
|
||||
|
@ -1,6 +1,9 @@
|
||||
substitutions:
|
||||
network_enable_ipv6: "false"
|
||||
|
||||
wifi:
|
||||
ssid: MySSID
|
||||
password: password1
|
||||
|
||||
network:
|
||||
enable_ipv6: true
|
||||
enable_ipv6: ${network_enable_ipv6}
|
||||
|
4
tests/components/network/test-ipv6.esp32-ard.yaml
Normal file
4
tests/components/network/test-ipv6.esp32-ard.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
substitutions:
|
||||
network_enable_ipv6: "true"
|
||||
|
||||
<<: !include common.yaml
|
4
tests/components/network/test-ipv6.esp32-c3-ard.yaml
Normal file
4
tests/components/network/test-ipv6.esp32-c3-ard.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
substitutions:
|
||||
network_enable_ipv6: "true"
|
||||
|
||||
<<: !include common.yaml
|
4
tests/components/network/test-ipv6.esp32-c3-idf.yaml
Normal file
4
tests/components/network/test-ipv6.esp32-c3-idf.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
substitutions:
|
||||
network_enable_ipv6: "true"
|
||||
|
||||
<<: !include common.yaml
|
4
tests/components/network/test-ipv6.esp32-idf.yaml
Normal file
4
tests/components/network/test-ipv6.esp32-idf.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
substitutions:
|
||||
network_enable_ipv6: "true"
|
||||
|
||||
<<: !include common.yaml
|
4
tests/components/network/test-ipv6.esp8266-ard.yaml
Normal file
4
tests/components/network/test-ipv6.esp8266-ard.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
substitutions:
|
||||
network_enable_ipv6: "true"
|
||||
|
||||
<<: !include common.yaml
|
4
tests/components/network/test-ipv6.rp2040-ard.yaml
Normal file
4
tests/components/network/test-ipv6.rp2040-ard.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
substitutions:
|
||||
network_enable_ipv6: "true"
|
||||
|
||||
<<: !include common.yaml
|
1
tests/components/network/test.host.yaml
Normal file
1
tests/components/network/test.host.yaml
Normal file
@ -0,0 +1 @@
|
||||
network:
|
Loading…
Reference in New Issue
Block a user