https://git.reactos.org/?p=reactos.git;a=commitdiff;h=89b685007a4265d764845e42afa5e8b20894d9be

commit 89b685007a4265d764845e42afa5e8b20894d9be
Author:     Hervé Poussineau <hpous...@reactos.org>
AuthorDate: Wed Dec 13 19:56:52 2023 +0100
Commit:     Hervé Poussineau <hpous...@reactos.org>
CommitDate: Sat Jan 13 15:23:46 2024 +0100

    [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...
---
 drivers/network/tcpip/datalink/lan.c        | 8 ++++----
 drivers/network/tcpip/ip/transport/tcp/if.c | 3 +--
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/network/tcpip/datalink/lan.c 
b/drivers/network/tcpip/datalink/lan.c
index ccd0f555ef5..1da4e2129d6 100644
--- a/drivers/network/tcpip/datalink/lan.c
+++ b/drivers/network/tcpip/datalink/lan.c
@@ -750,10 +750,6 @@ BOOLEAN ReconfigureAdapter(PRECONFIGURE_CONTEXT Context)
 
     Context->Adapter->CompletingReset = FALSE;
 
-    /* Update the IP and link status information cached in TCP */
-    TCPUpdateInterfaceIPInformation(Interface);
-    TCPUpdateInterfaceLinkStatus(Interface);
-
     if (Context->State == LAN_STATE_STARTED)
     {
         /* Get maximum link speed */
@@ -791,6 +787,10 @@ BOOLEAN ReconfigureAdapter(PRECONFIGURE_CONTEXT Context)
 
     Adapter->State = Context->State;
 
+    /* Update the IP and link status information cached in TCP */
+    TCPUpdateInterfaceIPInformation(Interface);
+    TCPUpdateInterfaceLinkStatus(Interface);
+
     return TRUE;
 }
 
diff --git a/drivers/network/tcpip/ip/transport/tcp/if.c 
b/drivers/network/tcpip/ip/transport/tcp/if.c
index aba55d23abd..e69c3667fc3 100644
--- a/drivers/network/tcpip/ip/transport/tcp/if.c
+++ b/drivers/network/tcpip/ip/transport/tcp/if.c
@@ -6,6 +6,7 @@
 #include "lwip/ip.h"
 #include "lwip/api.h"
 #include "lwip/tcpip.h"
+#include <ipifcons.h>
 
 err_t
 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
 TCPUpdateInterfaceLinkStatus(PIP_INTERFACE IF)
 {
-#if 0
     ULONG OperationalStatus;
 
     GetInterfaceConnectionStatus(IF, &OperationalStatus);
@@ -89,7 +89,6 @@ TCPUpdateInterfaceLinkStatus(PIP_INTERFACE IF)
         netif_set_link_up(IF->TCPContext);
     else
         netif_set_link_down(IF->TCPContext);
-#endif
 }
 
 err_t

Reply via email to