Skip to content

feat(net): Enable IPv6 immediately if already connected #9948

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions libraries/Network/src/NetworkInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,15 @@ bool NetworkInterface::hasGlobalIPv6() const {
bool NetworkInterface::enableIPv6(bool en) {
if (en) {
setStatusBits(ESP_NETIF_WANT_IP6_BIT);
if (_esp_netif != NULL && connected()) {
// If we are already connected, try to enable IPv6 immediately
esp_err_t err = esp_netif_create_ip6_linklocal(_esp_netif);
if (err != ESP_OK) {
log_e("Failed to enable IPv6 Link Local on %s: [%d] %s", desc(), err, esp_err_to_name(err));
} else {
log_v("Enabled IPv6 Link Local on %s", desc());
}
}
} else {
clearStatusBits(ESP_NETIF_WANT_IP6_BIT);
}
Expand Down
Loading