Index: lib/drivers/ip/network/router.c =================================================================== --- lib/drivers/ip/network/router.c (revision 56640) +++ lib/drivers/ip/network/router.c (working copy) @@ -230,6 +230,14 @@ FIBE->Router = Router; FIBE->Metric = Metric; + /* Set the default gateway if appropriate */ + if (AddrIsUnspecified(NetworkAddress) && AddrIsUnspecified(Netmask)) + { + RtlCopyMemory(&Router->Interface->Router, &Router->Address, sizeof(Router->Address)); + + TCPUpdateInterfaceIPInformation(Router->Interface); + } + /* Add FIB to the forward information base */ TcpipInterlockedInsertTailList(&FIBListHead, &FIBE->ListEntry, &FIBLock); @@ -359,7 +367,12 @@ CurrentEntry = NextEntry; } + /* Kill the default route */ + RtlZeroMemory(&Interface->Router, sizeof(Interface->Router)); + TcpipReleaseSpinLock(&FIBLock, OldIrql); + + TCPUpdateInterfaceIPInformation(Interface); } NTSTATUS RouterRemoveRoute(PIP_ADDRESS Target, PIP_ADDRESS Router) @@ -377,7 +390,7 @@ PLIST_ENTRY NextEntry; PFIB_ENTRY Current; BOOLEAN Found = FALSE; - PNEIGHBOR_CACHE_ENTRY NCE; + PNEIGHBOR_CACHE_ENTRY NCE = NULL; TI_DbgPrint(DEBUG_ROUTER, ("Called\n")); TI_DbgPrint(DEBUG_ROUTER, ("Deleting Route From: %s\n", A2S(Router))); @@ -406,6 +419,10 @@ if( Found ) { TI_DbgPrint(DEBUG_ROUTER, ("Deleting route\n")); + + if (AddrIsEqual(Router, &NCE->Interface->Router)) + RtlZeroMemory(&NCE->Interface->Router, sizeof(NCE->Interface->Router)); + DestroyFIBE( Current ); } @@ -413,6 +430,8 @@ TcpipReleaseSpinLock(&FIBLock, OldIrql); + if (Found) TCPUpdateInterfaceIPInformation(NCE->Interface); + TI_DbgPrint(DEBUG_ROUTER, ("Leaving\n")); return Found ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL; Index: lib/drivers/ip/transport/tcp/if.c =================================================================== --- lib/drivers/ip/transport/tcp/if.c (revision 56640) +++ lib/drivers/ip/transport/tcp/if.c (working copy) @@ -137,8 +137,6 @@ struct ip_addr netmask; struct ip_addr gw; - gw.addr = 0; - GetInterfaceIPv4Address(IF, ADE_UNICAST, (PULONG)&ipaddr.addr); @@ -146,7 +144,14 @@ GetInterfaceIPv4Address(IF, ADE_ADDRMASK, (PULONG)&netmask.addr); - + + gw.addr = IF->Router.Address.IPv4Address; + + DbgPrint("LWIP - IP information dump:\n"); + DbgPrint("IP Address: %s\n", A2S(&IF->Unicast)); + DbgPrint("Subnet mask: %s\n", A2S(&IF->Netmask)); + DbgPrint("Router: %s\n", A2S(&IF->Router)); + netif_set_addr(IF->TCPContext, &ipaddr, &netmask, &gw); if (ipaddr.addr != 0) Index: drivers/network/tcpip/include/ip.h =================================================================== --- drivers/network/tcpip/include/ip.h (revision 56640) +++ drivers/network/tcpip/include/ip.h (working copy) @@ -160,6 +160,7 @@ IP_ADDRESS PointToPoint; /* Point to point address */ IP_ADDRESS Netmask; /* Netmask */ IP_ADDRESS Broadcast; /* Broadcast */ + IP_ADDRESS Router; /* Default route */ UNICODE_STRING Name; /* Adapter name (GUID) */ UNICODE_STRING Description; /* Adapter description (Human readable) */ PUCHAR Address; /* Pointer to interface address */