mdns: Fix multicast destination check for IPv6

This broke when IPv6 got scopes added. Scopes/zones are checked
even if none of the compared addresses are link local.

Result of the bug was that IPv6 replies were always sent unicast to
the source instead of to the multicast address.

Add ip-generic version that ignores IP zone info, since the v6 group
address is not tied to any netif.
This commit is contained in:
Erik Ekman 2018-01-02 20:38:36 +01:00
parent 1c7a024297
commit d87740bb96
2 changed files with 5 additions and 1 deletions

View File

@ -1814,7 +1814,7 @@ mdns_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *addr,
#if LWIP_IPV6
if (IP_IS_V6(ip_current_dest_addr())) {
if (!ip_addr_cmp(ip_current_dest_addr(), &v6group)) {
if (!ip_addr_cmp_zoneless(ip_current_dest_addr(), &v6group)) {
packet.recv_unicast = 1;
}
}

View File

@ -201,6 +201,10 @@ extern const ip_addr_t ip_addr_any_type;
ip6_addr_cmp(ip_2_ip6(addr1), ip_2_ip6(addr2)) : \
ip4_addr_cmp(ip_2_ip4(addr1), ip_2_ip4(addr2))))
/** @ingroup ipaddr */
#define ip_addr_cmp_zoneless(addr1, addr2) ((IP_GET_TYPE(addr1) != IP_GET_TYPE(addr2)) ? 0 : (IP_IS_V6_VAL(*(addr1)) ? \
ip6_addr_cmp_zoneless(ip_2_ip6(addr1), ip_2_ip6(addr2)) : \
ip4_addr_cmp(ip_2_ip4(addr1), ip_2_ip4(addr2))))
/** @ingroup ipaddr */
#define ip_addr_isany(ipaddr) (((ipaddr) == NULL) ? 1 : ((IP_IS_V6(ipaddr)) ? \
ip6_addr_isany(ip_2_ip6(ipaddr)) : \
ip4_addr_isany(ip_2_ip4(ipaddr))))