[TCPIP] Call netif_set_link_up/netif_set_link_down after link status change

- Update TCP cached information only after updating adapter information
  (so that TCPUpdateInterfaceIPInformation/TCPUpdateInterfaceLinkStatus
  gets new status)
- Call netif_set_link_up/netif_set_link_down in TCPUpdateInterfaceLinkStatus

This fixes a lwIP requirement:
  2007-07-13 Jared Grubb (integrated by Frédéric Bernon)
  * [...] Be carefull for port maintainers to add the NETIF_FLAG_LINK_UP
    flag (like in ethernetif.c) if you want to be sure to be compatible with
    future changes...
This commit is contained in:
Hervé Poussineau 2023-12-13 19:56:52 +01:00
parent 3e3d34d97b
commit 89b685007a
2 changed files with 5 additions and 6 deletions

View file

@ -750,10 +750,6 @@ BOOLEAN ReconfigureAdapter(PRECONFIGURE_CONTEXT Context)
Context->Adapter->CompletingReset = FALSE; Context->Adapter->CompletingReset = FALSE;
/* Update the IP and link status information cached in TCP */
TCPUpdateInterfaceIPInformation(Interface);
TCPUpdateInterfaceLinkStatus(Interface);
if (Context->State == LAN_STATE_STARTED) if (Context->State == LAN_STATE_STARTED)
{ {
/* Get maximum link speed */ /* Get maximum link speed */
@ -791,6 +787,10 @@ BOOLEAN ReconfigureAdapter(PRECONFIGURE_CONTEXT Context)
Adapter->State = Context->State; Adapter->State = Context->State;
/* Update the IP and link status information cached in TCP */
TCPUpdateInterfaceIPInformation(Interface);
TCPUpdateInterfaceLinkStatus(Interface);
return TRUE; return TRUE;
} }

View file

@ -6,6 +6,7 @@
#include "lwip/ip.h" #include "lwip/ip.h"
#include "lwip/api.h" #include "lwip/api.h"
#include "lwip/tcpip.h" #include "lwip/tcpip.h"
#include <ipifcons.h>
err_t err_t
TCPSendDataCallback(struct netif *netif, struct pbuf *p, struct ip_addr *dest) TCPSendDataCallback(struct netif *netif, struct pbuf *p, struct ip_addr *dest)
@ -80,7 +81,6 @@ TCPSendDataCallback(struct netif *netif, struct pbuf *p, struct ip_addr *dest)
VOID VOID
TCPUpdateInterfaceLinkStatus(PIP_INTERFACE IF) TCPUpdateInterfaceLinkStatus(PIP_INTERFACE IF)
{ {
#if 0
ULONG OperationalStatus; ULONG OperationalStatus;
GetInterfaceConnectionStatus(IF, &OperationalStatus); GetInterfaceConnectionStatus(IF, &OperationalStatus);
@ -89,7 +89,6 @@ TCPUpdateInterfaceLinkStatus(PIP_INTERFACE IF)
netif_set_link_up(IF->TCPContext); netif_set_link_up(IF->TCPContext);
else else
netif_set_link_down(IF->TCPContext); netif_set_link_down(IF->TCPContext);
#endif
} }
err_t err_t