lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] [EXTERNAL] Understanding callback options for link/DHCP


From: Zayzay, Edman G
Subject: Re: [lwip-users] [EXTERNAL] Understanding callback options for link/DHCP status.
Date: Thu, 15 Apr 2021 20:55:43 +0000

In your lwipopts.h file, define the following…

 

#define LWIP_NETIF_STATUS_CALLBACK      1

#define LWIP_NETIF_LINK_CALLBACK        1

 

Then in during your setup. Call these functions

 

netif_set_status_callback(ppp->netif, status_cb);

netif_set_link_callback(ppp->netif, link_cb);

 

 

the status callback will function will get triggered when change is happening on the interface.

The link call back function will get triggered when the interface has changed. In you link callback function, you can check if the link is up/down by calling

 

netif_is_up(netif);

 

Hope it helps.

 

~Edman

 

From: lwip-users <lwip-users-bounces+edmangzayzay=eaton.com@nongnu.org> On Behalf Of Luciano Moretti
Sent: Thursday, April 15, 2021 4:20 PM
To: Mailing list for lwIP users <lwip-users@nongnu.org>
Subject: [EXTERNAL] [lwip-users] Understanding callback options for link/DHCP status.

 

Using LwIP 2.1.2 currently:

LwIP provides several optional callbacks and I'm trying to figure out when they're called and what steps I should take when I get one.

 

Currently, I'm using netif_set_status_callback and it seems like this is called when I receive a new IP address via DHCP. The documentation says that it's called when an "interface is brought up/down" but this doesn't seem to be the case: I don't get a call when I unplug my cable and my cable handling calls netif_set_link_down() like I'd expect. 

 

I'm also seeing an issue where if I unplug the cable, change DHCP server settings, then replug in the board is briefly pingable at the old DHCP address prior to the new DHCP address being set. When I detect the unplug should I use the netif_set_addr() function to set the values back to the starting defaults of 0.0.0.0 for DHCP?

 

There appears to be a NETIF_LINK_CALLBACK() and a NETIF_EXT_STATUS_CALLBACK as well, but I can't find good documentation on when those callbacks would be expected if I enable them.

 

Thank you for any clarification you can provide.


reply via email to

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