LwIP set link down - why it is required?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-05-22 3:03 PM
Hi,
Why it is required (or recommended, as I see in examples) to set the link down when the cable is plugged out from the ethernet connector? It works when I once set the link up and leave it up forever. It doesn't matter when I plug out and in the cable, it continues to work afterwards without any problem.
Solved! Go to Solution.
- Labels:
-
Ethernet
-
STM32F4 Series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-05-22 7:44 PM
> It doesn't matter when I plug out and in the cable
Link up/down handling is optional.
Change of peer or network may be important.
Restarting DHCP client or server?
IPv6 discover?
Re-subscribing or re-advertising services?
See also https://lwip.fandom.com/wiki/DHCP.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-05-22 7:44 PM
> It doesn't matter when I plug out and in the cable
Link up/down handling is optional.
Change of peer or network may be important.
Restarting DHCP client or server?
IPv6 discover?
Re-subscribing or re-advertising services?
See also https://lwip.fandom.com/wiki/DHCP.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-05-30 3:56 AM
You are a developer and you have the source code. Look at it!
http://git.savannah.nongnu.org/cgit/lwip.git/tree/src/core/netif.c#n1013
You don't even have to understand it deeply. The function names already answer your question pretty clearly!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-05-30 6:41 AM
I looked but it didn't helped. I was qurious WHY this callback exists, but the first answer was helpful like re-starting DHCP. (in case if I plug in another cable not the one that I plugged out.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-05-30 10:48 AM
Yes, discovery is one reason. Also, as you can see from function names, AutoIP needs it. And in real projects one will often want to report link status to application code for LED/GUI indication and/or logging purposes. :)
