mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-02 12:52:10 +00:00
netif_set_link_up/down: only do something if the link state actually changes
This commit is contained in:
parent
2e795d2706
commit
29eb56a2f6
@ -119,6 +119,10 @@ HISTORY
|
|||||||
|
|
||||||
++ Bugfixes:
|
++ Bugfixes:
|
||||||
|
|
||||||
|
2010-02-12: Simon Goldschmidt
|
||||||
|
* netif.c: netif_set_link_up/down: only do something if the link state
|
||||||
|
actually changes
|
||||||
|
|
||||||
2010-02-12: Simon Goldschmidt/Stephane Lesage
|
2010-02-12: Simon Goldschmidt/Stephane Lesage
|
||||||
* api_msg.c: Fixed bug #28865 (Cannot close socket/netconn in non-blocking
|
* api_msg.c: Fixed bug #28865 (Cannot close socket/netconn in non-blocking
|
||||||
connect)
|
connect)
|
||||||
|
@ -506,36 +506,38 @@ void netif_set_status_callback(struct netif *netif, netif_status_callback_fn sta
|
|||||||
*/
|
*/
|
||||||
void netif_set_link_up(struct netif *netif )
|
void netif_set_link_up(struct netif *netif )
|
||||||
{
|
{
|
||||||
netif->flags |= NETIF_FLAG_LINK_UP;
|
if (!(netif->flags & NETIF_FLAG_LINK_UP)) {
|
||||||
|
netif->flags |= NETIF_FLAG_LINK_UP;
|
||||||
|
|
||||||
#if LWIP_DHCP
|
#if LWIP_DHCP
|
||||||
if (netif->dhcp) {
|
if (netif->dhcp) {
|
||||||
dhcp_network_changed(netif);
|
dhcp_network_changed(netif);
|
||||||
}
|
}
|
||||||
#endif /* LWIP_DHCP */
|
#endif /* LWIP_DHCP */
|
||||||
|
|
||||||
#if LWIP_AUTOIP
|
#if LWIP_AUTOIP
|
||||||
if (netif->autoip) {
|
if (netif->autoip) {
|
||||||
autoip_network_changed(netif);
|
autoip_network_changed(netif);
|
||||||
}
|
}
|
||||||
#endif /* LWIP_AUTOIP */
|
#endif /* LWIP_AUTOIP */
|
||||||
|
|
||||||
if (netif->flags & NETIF_FLAG_UP) {
|
if (netif->flags & NETIF_FLAG_UP) {
|
||||||
#if LWIP_ARP
|
#if LWIP_ARP
|
||||||
/* For Ethernet network interfaces, we would like to send a "gratuitous ARP" */
|
/* For Ethernet network interfaces, we would like to send a "gratuitous ARP" */
|
||||||
if (netif->flags & NETIF_FLAG_ETHARP) {
|
if (netif->flags & NETIF_FLAG_ETHARP) {
|
||||||
etharp_gratuitous(netif);
|
etharp_gratuitous(netif);
|
||||||
}
|
}
|
||||||
#endif /* LWIP_ARP */
|
#endif /* LWIP_ARP */
|
||||||
|
|
||||||
#if LWIP_IGMP
|
#if LWIP_IGMP
|
||||||
/* resend IGMP memberships */
|
/* resend IGMP memberships */
|
||||||
if (netif->flags & NETIF_FLAG_IGMP) {
|
if (netif->flags & NETIF_FLAG_IGMP) {
|
||||||
igmp_report_groups( netif);
|
igmp_report_groups( netif);
|
||||||
}
|
}
|
||||||
#endif /* LWIP_IGMP */
|
#endif /* LWIP_IGMP */
|
||||||
|
}
|
||||||
|
NETIF_LINK_CALLBACK(netif);
|
||||||
}
|
}
|
||||||
NETIF_LINK_CALLBACK(netif);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -543,8 +545,10 @@ void netif_set_link_up(struct netif *netif )
|
|||||||
*/
|
*/
|
||||||
void netif_set_link_down(struct netif *netif )
|
void netif_set_link_down(struct netif *netif )
|
||||||
{
|
{
|
||||||
netif->flags &= ~NETIF_FLAG_LINK_UP;
|
if (netif->flags & NETIF_FLAG_LINK_UP) {
|
||||||
NETIF_LINK_CALLBACK(netif);
|
netif->flags &= ~NETIF_FLAG_LINK_UP;
|
||||||
|
NETIF_LINK_CALLBACK(netif);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user