1
0
mirror of https://github.com/esphome/esphome.git synced 2025-01-18 12:05:41 +00:00

Enable udp to work (on ipv4) when ipv6 is enabled (#8060)

Co-authored-by: Clyde Stubbs <2366188+clydebarrow@users.noreply.github.com>
This commit is contained in:
Jimmy Hedman 2025-01-10 22:10:19 +01:00 committed by GitHub
parent a498fb5dcf
commit de603c7565
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -245,13 +245,9 @@ void UDPComponent::setup() {
}
struct sockaddr_in server {};
socklen_t sl = socket::set_sockaddr_any((struct sockaddr *) &server, sizeof(server), this->port_);
if (sl == 0) {
ESP_LOGE(TAG, "Socket unable to set sockaddr: errno %d", errno);
this->mark_failed();
this->status_set_error("Unable to set sockaddr");
return;
}
server.sin_family = AF_INET;
server.sin_addr.s_addr = ESPHOME_INADDR_ANY;
server.sin_port = htons(this->port_);
err = this->listen_socket_->bind((struct sockaddr *) &server, sizeof(server));
if (err != 0) {