patchlwIP - A Lightweight TCP/IP stack - Patches: patch #8724, Add multicast support to loopif

 
 

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

patch #8724: Add multicast support to loopif

Submitted by:  Joel Cunningham <jcunningham>
Submitted on:  Mon 24 Aug 2015 04:35:35 PM UTC  
 
Category:  Network drivers Priority:  5 - Normal
Status:  Done Privacy:  Public
Assigned to:  Simon Goldschmidt <goldsimon> Open/Closed:  Closed
Planned Release:  None

( Jump to the original submission)

Wed 26 Aug 2015 06:57:45 PM UTC, comment #7: 

Right. I've just changed that.

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Wed 26 Aug 2015 06:36:24 PM UTC, comment #6: 

Just a nitpick, but all other multicast option are named "MULTICAST" in opt.h, this one introduce "MCAST" instead of "MULTICAST", should we rename LWIP_LOOPIF_MCAST info LWIP_LOOPIF_MULTICAST ?

Sylvain

Sylvain Rochet <gradator>
Project Member
Wed 26 Aug 2015 06:30:33 PM UTC, comment #5: 

You convinced me. Applied, thanks for the patch.

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Tue 25 Aug 2015 02:39:55 PM UTC, comment #4: 

Thanks for the clarification, I understand.

Currently my WiFi netif management code does set the netif state (and IP address assignment) according to the link state from the WIFi driver.  So if a link down event arrives from WiFi driver, my application calls netif_set_down(), netif_set_link_down() and dhcp_stop().

If I re-worked it to only manipulate the layer 2 link state, what would the appropriate action be for the IP address?  If we were to continue to use that netif for loopback communication, what would happen when the DHCP lease eventually expires?  Would we still be allowed to send with an IP address of 0.0.0.0?

For my applications, having a separate netif for loopback is nice and is not a heavyweight burden to support

Joel Cunningham <jcunningham>
Project Member
Tue 25 Aug 2015 05:19:29 AM UTC, comment #3: 

Sorry, I think I didn't make myself clear enough: I thought about sending loopback traffic over the real netif (the wifi netif, in your case). This currently fails when the real netif's link is down. I thought it might be handy if loopback traffic would still work in that case.

Loopback traffic would then only fail if the netif was set down (netif_set_down(), not netif_set_link_down()). I didn't get from your implementation which of the two functions you call when you have not wifi available...

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Mon 24 Aug 2015 07:48:57 PM UTC, comment #2: 

The link-up bug was fixed in commit 5b0d9338fd5f2c90e3cbd40970bc11f16631b17c, before that was fixed, loopif didn't even work for unicast traffic

My products use the loopback interface for same-machine communication that needs to be available all the time, regardless of the state of the real netifs (which are WiFi netifs that go up/down frequently during run-time)

This commit just enables multicast to be sent over the loopif and looped back.  Without enabling NETIF_FLAG_IGMP, looped back multicast messages will be dropped in ip4_input, where it checks if the input netif has NETIF_FLAG_IGMP set and that netif has joined the multicast group

Also calls to IP_ADD_MEMBERSHIP fail if the netif doesn't have NETIF_FLAG_IGMP set

Joel Cunningham <jcunningham>
Project Member
Mon 24 Aug 2015 06:35:07 PM UTC, comment #1: 

So are you using this feature only because loopback communication does not work without link up over normal netifs?

I've already thought about dropping the link-up check for loopback traffic... Other network stacks have a loopback interface as well, but that change would allow implementing task #13515, which could reduce code size for single-netif setups...

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Mon 24 Aug 2015 04:35:35 PM UTC, original submission:  

I've put together a patch that enables multicast support on the loopback netif (127.0.0.1) by setting the NETIF_FLAG_IGMP.

My patch also adds a configuration option LWIP_LOOPIF_MCAST which defaults to off in opt.h to control this behavior

I'm using multicast on the loopif to support mDNSResponder performing same-machine communication when no real netifs are up

Joel Cunningham <jcunningham>
Project Member

 

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-08-26 goldsimon StatusNone => Done
        Assigned toNone => goldsimon
        Open/ClosedOpen => Closed
    2015-08-24 jcunningham Attached File- => Added 0001-Add-multicast-support-to-loopif.patch, #34712

    Back to the top


    Powered by Savane 3.5