Enable IPv6 support for BK72xx (#7398)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
David Woodhouse 2024-09-10 23:02:05 +01:00 committed by GitHub
parent 7b90bfaec6
commit 39ad358b51
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 24 additions and 2 deletions

View file

@ -17,6 +17,7 @@ CONFIG_SCHEMA = cv.Schema(
esp8266=False,
esp32=False,
rp2040=False,
bk72xx=False,
): cv.All(
cv.boolean,
cv.Any(
@ -25,6 +26,7 @@ CONFIG_SCHEMA = cv.Schema(
esp32_arduino=cv.Version(0, 0, 0),
esp8266_arduino=cv.Version(0, 0, 0),
rp2040_arduino=cv.Version(0, 0, 0),
bk72xx_libretiny=cv.Version(1, 7, 0),
),
cv.boolean_false,
),
@ -52,3 +54,5 @@ async def to_code(config):
cg.add_build_flag("-DPIO_FRAMEWORK_ARDUINO_ENABLE_IPV6")
if CORE.is_esp8266:
cg.add_build_flag("-DPIO_FRAMEWORK_ARDUINO_LWIP2_IPV6_LOW_MEMORY")
if CORE.is_bk72xx:
cg.add_build_flag("-DCONFIG_IPV6")

View file

@ -85,7 +85,16 @@ bool WiFiComponent::wifi_sta_ip_config_(optional<ManualIP> manual_ip) {
network::IPAddresses WiFiComponent::wifi_sta_ip_addresses() {
if (!this->has_sta())
return {};
return {WiFi.localIP()};
network::IPAddresses addresses;
addresses[0] = WiFi.localIP();
#if USE_NETWORK_IPV6
int i = 1;
auto v6_addresses = WiFi.allLocalIPv6();
for (auto address : v6_addresses) {
addresses[i++] = network::IPAddress(address.toString().c_str());
}
#endif /* USE_NETWORK_IPV6 */
return addresses;
}
bool WiFiComponent::wifi_apply_hostname_() {
@ -321,6 +330,11 @@ void WiFiComponent::wifi_event_callback_(esphome_wifi_event_id_t event, esphome_
s_sta_connecting = false;
break;
}
case ESPHOME_EVENT_ID_WIFI_STA_GOT_IP6: {
// auto it = info.got_ip.ip_info;
ESP_LOGV(TAG, "Event: Got IPv6");
break;
}
case ESPHOME_EVENT_ID_WIFI_STA_LOST_IP: {
ESP_LOGV(TAG, "Event: Lost IP");
break;

View file

@ -1,4 +1,8 @@
substitutions:
network_enable_ipv6: "false"
network_enable_ipv6: "true"
bk72xx:
framework:
version: 1.7.0
<<: !include common.yaml