lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Multicast and ICMP-Echo


From: Jens Nielsen
Subject: Re: [lwip-users] Multicast and ICMP-Echo
Date: Wed, 13 May 2015 20:05:12 +0200
User-agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0

Hi

This should (?) already be covered by http://savannah.nongnu.org/bugs/?38803

With the reservation that there was some confusion regarding multiple interfaces so maybe this solution is more correct, and broadcast ping should be solved in a similar manner?

Best Regards
/Jens

On 2015-05-13 10:23, Sylvain Rochet wrote:
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


_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users


reply via email to

[Prev in Thread] Current Thread [Next in Thread]