Hello Thomas,

On Wed, May 06, 2015 at 02:23:50PM -0300, Thomas Ubensee wrote:
> 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.
> When changing the code inside of icmp.c around line 190 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.

Could you post your patch on the lwIP patch tracker so it doesn't get 
forgotten ? :)

Using git format-patch format and against master head if possible.

Sylvain

Attachment: signature.asc
Description: Digital signature

_______________________________________________
lwip-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to