patchlwIP - A Lightweight TCP/IP stack - Patches: patch #7224, Add netif flag for AutoIP &...

 
 

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

patch #7224: Add netif flag for AutoIP & AutoIP fallback to static IP

Submitter:  Bill Auerbach <billauerbach>
Submitted:  Wed 16 Jun 2010 08:41:41 PM UTC
   
 
Category:  None Priority:  5 - Normal
Status:  Wont Do Privacy:  Public
Assigned to:  goldsimon Open/Closed:  Closed
Planned Release:  None

Jump to the original submission

Sat 29 Oct 2011 08:19:51 PM UTC, comment #6: 

Bill, what's your status on this one? It's been a while an I really can't remember, but from comment #5, it seems like I could juse close it??

Simon Goldschmidt <goldsimon>
Group administrator
Wed 07 Jul 2010 11:33:47 AM UTC, comment #5: 

Ok, that was there to review. To be like you want (and I agree too now) just leave it as-was.  In hindsight, I'm not sure why I thought we don't want the test or call to autoip_stop.

Bill Auerbach <billauerbach>
Wed 07 Jul 2010 04:34:51 AM UTC, comment #4: 


> What did I miss?


I thought the following lines in your patch would prevent to stop AutoIP:

+// Delete this if we agree that we do not want to do this on a dhcp_stop!
+//#if LWIP_DHCP_AUTOIP_COOP
+//    if(dhcp->autoip_coop_state == DHCP_AUTOIP_COOP_STATE_ON) {
+//      autoip_stop(netif);
+//      dhcp->autoip_coop_state = DHCP_AUTOIP_COOP_STATE_OFF;
+//    }
+//#endif /* LWIP_DHCP_AUTOIP_COOP */

However, I couldn't apply the patch like that anyway, since these are C++ comments. Maybe you didn't intend to include that in the patch?

Simon Goldschmidt <goldsimon>
Group administrator
Tue 06 Jul 2010 08:56:11 PM UTC, comment #3: 

What did I miss? dhcp_stop does turn off autoip.  It does so based on the coop state and if you mean it should unconditionally turn off AutoIP, I agree.  If one purposefully stops DHCP, what's would be the point of leaving AutoIP on?

Do you mean a (runtime) option to disable DHCP if AutoIP sets the IP address?  I like this too because leaving DHCP on when in most cases if there is no DHCP there won't ever be DHCP stops the DHCP overhead.  If the cable is changed, the user needs to detect this and call dhcp_start anyway (to check again).  The chance that the DHCP server actually is down and then appears is unlikely but we should allow for it somehow I guess.

AFA a compile time option for AutoIP fallback - it's a one line function (which would be optimized out by most tools if unused) and one or 2 lines in the AutoIP code.  That's your call of course but it's very little code.

Bill Auerbach <billauerbach>
Tue 06 Jul 2010 08:33:56 PM UTC, comment #2: 

Unfortunately, I do not fully agree to this one: we are using AutoIP only as fallback for the case where a device that is set to DHCP does not reach a DHCP server.

Being like that, I want AutoIP to implicitly stop when it was started from DHCP. That would have to be taken care of by the patch, too, as currently AutoIP is left on when I stop DHCP - this would mean my application would have to know about AutoIP, too, if I applied the patch as is.

The rest is fine, I think (except that I would add an option for the AutoIP fallback address as I don't know how broadly this is used).

Simon Goldschmidt <goldsimon>
Group administrator
Wed 16 Jun 2010 08:54:44 PM UTC, comment #1: 

Simon, the second LWIP_ASSERT in autoip_set_ip_addr isn't necessary.

Bill Auerbach <billauerbach>
Wed 16 Jun 2010 08:41:41 PM UTC, original submission:  

This patch adds 2 features:

1. netif flags will have NETIF_FLAG_AUTOIP set if AutoIP provided the IP address.  NETIF_FLAG_DHCP will not be set in this case.

2. Function autoip_set_ip_addr can be used before calling dhcp_start to provide the AutoIP fallback IP address.  AutoIP will use this address.  If a collision occurs it will increment and continue until trying addresses until no collision is detected.  This was done to assure no devices can come up with conflicting IP addresses.

For complete support of dynamic Ethernet cable changes, the following needs to be used in code that detects that the link has come up:

  if( you_are_in_static_ip_mode )
    dhcp_inform( netif_default );
  else // either AutoIP or AutoIP will fallback to static.
    dhcp_network_changed( netif_default );

For changing the IP address and "mode" from a configuration utility, call autoip_set_ip_addr with NULL to clear the fallback address and if the user chooses AutoIP with static fallback, call autoip_set_ip_addr with the new address.  Use dhcp_network_changed IF the old mode was not static, otherwise you need to use dhcp_start to get dhcp running.  If the user selects static IP call dhcp_stop and netif_set_addr to set the static parameters.

Bill Auerbach <billauerbach>

 

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

Attached Files
file #20764:  AutoIP_patch.txt added by billauerbach (7KiB - text/plain)

 

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 billauerbach (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 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-04-24 goldsimon StatusNone Wont Do
        Assigned toNone goldsimon
        Open/ClosedOpen Closed
    2010-06-16 billauerbach Attached File- Added AutoIP_patch.txt, #20764

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code