lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [bug #20409] Add netif callback function for link change ev


From: Jared Grubb
Subject: [lwip-devel] [bug #20409] Add netif callback function for link change event
Date: Thu, 12 Jul 2007 16:36:12 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4

Follow-up Comment #40, bug #20409 (project lwip):

> (#32) manually up/down a netif is a basic operation on lwIP. Any embedded
application can decide to down its netif if it want to "stop" any services
activity. 

> (#38) If you want to power off an netif, the right thing to do is the down
it and to remove it 

Let's just decide exactly what UP/DOWN means, because I dont think we are all
speaking the same language. There are two options:
* UP/DOWN means that the user intends the interface to do its best to make
communication happen. UP/DOWN is always user-driven, and the stack cannot
change this state. This is how Linux works.
* UP/DOWN is used to define whether communication actually can happen on this
interface. It is set/reset by the stack in response to events (like DHCP).
This is how lwIP currently works.
 
I think people who have used Linux before will expect our stack to behave the
same way, and that is the one that I would like to lwIP use. If we use
definition #1, then the stack knows it is in a good communication state is by
checking to see if the netif has a valid IP address (just like Linux does).
Thus, when DHCP or AUTOIP or my application that uses a static IP calls
netif_set_ipaddr, that is the trigger to the stack that we have a ready
netif. 

> (#38) link_status will be a better name. [ That's fine. ]
> (#38) #define NETIF_LINK_CALLBACK(n)...  [ Much better. ]

> (#38) the place to do the "gratuitous ARP", I think netif_set_up

The gratutious ARP should happen whenever the IP address changes. When DHCP
gets an IP address, it calls netif_set_ipaddr. If I want to use a static IP,
I will call netif_set_ipaddr. AUTOIP calls netif_set_ipaddr. Can you think of
a time when a call to netif_set_ipaddr should *not* cause a gratuitous ARP?

If you say that UP means definition #1 above, then netif_set_ipaddr is the
place to do it, because it will trigger every time a new IP address is
acquired; the netif is ready to use. If you say that UP means #2 above, then
netif_set_up is the place to do it, because this is the "ready to use"
function.

> (#38) the netif doesn't have to stop the dhcp client by example. It's
another reason to let the module do the job... 

Under def#2 you're right. Under def#1, that will work only as long as DHCP
checks for down interfaces.

> (#38) I prefer two functions (netif_set_link_up/down). It will also
set/rest the NETIF_FLAG_LINK_UP flag.

That is fine.

> (#38) About calling dhcp_link_change/autoip_link_change, I always thing
that do the job inside the module timer is better

That is fine too. The netif_set_link_up() can do an ARP and we wont check for
DHCP or AUTOIP.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?20409>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/





reply via email to

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