buglwIP - A Lightweight TCP/IP stack - Bugs: bug #43028, IP_MULTICAST_TTL affects unicast...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #43028: IP_MULTICAST_TTL affects unicast datagrams

Submitter:  Joel Cunningham <jcunningham>
Submitted:  Tue 19 Aug 2014 07:59:55 PM UTC
   
 
Category:  UDP Severity:  3 - Normal
Item Group:  Faulty Behaviour Status:  Fixed
Privacy:  Public Assigned to:  goldsimon
Open/Closed:  Closed Planned Release:  None
lwIP version:  1.4.1

Wed 25 Feb 2015 08:59:41 PM UTC, comment #4: 

Fixed, thanks for the patch.

Simon Goldschmidt <goldsimon>
Group administrator
Fri 05 Dec 2014 03:00:22 PM UTC, comment #3: 

In attached patch, I have added a multicast TTL field to the UDP PCB.  I chose this because it follows the same path of implementation as IP_MULTICAST_IF and can be conditionally compiled.

I thought of putting the multicast TTL in the IP PCB because TTL and multicast are an IP layer concepts but ran into the complication where #if LWIP_IGMP can't be used inside of the #define that declares the IP_PCB

Joel Cunningham <jcunningham>
Group Member
Tue 26 Aug 2014 06:50:49 PM UTC, comment #2: 

I'm not all that familiar with how often new members get added to the pcb, but is it out of the question to add another u8_t for mcast_ttl guarded by #if LWIP_IGMP.  Then when sending datagrams, use the appropriate TTL depending on unicast or multicast destination address

If the bug isn't addressed, then applications are just going to end up having to create a second socket, possibly with SO_REUSEADDR (_PORT) depending on use case, to have unicast and multicast senders with different TTLs.  This seems like it will consume more resources for that use case than u8_t

Joel Cunningham <jcunningham>
Group Member
Wed 20 Aug 2014 07:49:55 PM UTC, comment #1: 

The report seems correct, but do you have an idea of how to fix? We don't have more than one place to store TTL, so this is a bug I'm tempted to accept for staying lightweight...

Simon Goldschmidt <goldsimon>
Group administrator
Tue 19 Aug 2014 07:59:55 PM UTC, original submission:  

When setting the IP_MULTICAST_TTL socket option via setsockopt(), all transmitted datagrams from that socket now use the TTL value specified in the setsockopt() call regardless of whether the destination of the datagram is unicast or multicast.  My understanding of the socket option is that it should only affect datagrams sent (on that socket) to a multicast group.

Taking a look at the implementation, IP_MULTICAST_TTL sets the  sock->conn->pcb.udp->ttl which is used for every call to ip_output_if from udp.c

Further, the getsockopt() returns sock->conn->pcb.ip->ttl (as opposed to pcb.udp->ttl for the setter)

Joel Cunningham <jcunningham>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #32602:  CORRECT-Fix-IP_MULTICAST_TTL-socket-option.patch added by jcunningham (3KiB - application/octet-stream - Use this patch, other one was diffed in wrong direction)
file #32601:  mcast-ip-ttl.patch added by jcunningham (3KiB - application/octet-stream - Here is the patch that my project is using to fix the multicast TTL issue)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by goldsimon (Posted a comment)
  • -email is unavailable- added by jcunningham (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-02-25 goldsimon StatusNone Fixed
        Assigned toNone goldsimon
        Open/ClosedOpen Closed
    2014-12-05 jcunningham Attached File- Added CORRECT-Fix-IP_MULTICAST_TTL-socket-option.patch, #32602
    2014-12-05 jcunningham Attached File- Added mcast-ip-ttl.patch, #32601

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code