I was trying to ping a multicast address on a LWIP-Stack (using the master code) with LWIP_MULTICAST_PING enabled.
I could see in Wireshark that lwip send an ICMP-echo which linux ping did not recognize. It seems to me that the problem is that LWIP responses the ICMP-echo with the multicast-address as source and NOT with the unicast address of the interface where the ICMP-Request came from.
...
/* At this point, all checks are OK. */
/* We generate an answer by switching the dest and src ip addresses,
* setting the icmp type to ECHO_RESPONSE and updating the checksum. */
iecho = (struct icmp_echo_hdr *)p->payload;
ip_addr_copy(iphdr->src, *ip_current_dest_addr());
ip_addr_copy(iphdr->dest, *ip_current_src_addr());
ICMPH_TYPE_SET(iecho, ICMP_ER);
#if CHECKSUM_GEN_ICMP
...
to:
...
/* At this point, all checks are OK. */
/* We generate an answer by switching the dest and src ip addresses,
* setting the icmp type to ECHO_RESPONSE and updating the checksum. */
iecho = (struct icmp_echo_hdr *)p->payload;
#if LWIP_MULTICAST_PING
if (ip_addr_ismulticast(ip_current_dest_addr())) {
/*Replace Multicast address with interface ip address*/
ip_addr_copy(iphdr->src, inp->ip_addr);
}
else {
ip_addr_copy(iphdr->src, *ip_current_dest_addr());
}
#else
ip_addr_copy(iphdr->src, *ip_current_dest_addr());
#endif
ip_addr_copy(iphdr->dest, *ip_current_src_addr());
ICMPH_TYPE_SET(iecho, ICMP_ER);
#if CHECKSUM_GEN_ICMP
...
Linux ping works fine.
Regards,
Thomas