From eec09340811ec76c594a4fd9d20aaa6a878e566e Mon Sep 17 00:00:00 2001 From: David Cermak Date: Fri, 6 Nov 2020 10:32:00 +0100 Subject: [PATCH] mdns: Fix wrong mdns source address if lwIP IPv6 zones disabled The struct definition of ip6_addr_t in lwip and esp_ip6_addr_t differs since zone could be possibly disabled in lwip. Using memcpy to copy the address will cause wrong source address. Copy the entries manually instead. Merges https://github.com/espressif/esp-idf/pull/6055 --- components/mdns/mdns_networking.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/mdns/mdns_networking.c b/components/mdns/mdns_networking.c index 5f900cf4d1..b7ca2816ee 100644 --- a/components/mdns/mdns_networking.c +++ b/components/mdns/mdns_networking.c @@ -127,7 +127,8 @@ static void _udp_recv(void *arg, struct udp_pcb *upcb, struct pbuf *pb, const ip packet->tcpip_if = MDNS_IF_MAX; packet->pb = this_pb; packet->src_port = rport; - memcpy(&packet->src, raddr, sizeof(ip_addr_t)); + packet->src.type = raddr->type; + memcpy(&packet->src.u_addr, &raddr->u_addr, sizeof(raddr->u_addr)); packet->dest.type = packet->src.type; if (packet->src.type == IPADDR_TYPE_V4) {