mirror of
https://github.com/reactos/reactos.git
synced 2025-06-14 02:28:31 +00:00
- Live update of static IP address from ctl panel.
- Fix removing adapter route on IP address delete. svn path=/trunk/; revision=21899
This commit is contained in:
parent
a9680a89a6
commit
c68622792c
4 changed files with 59 additions and 3 deletions
|
@ -71,6 +71,7 @@ ManualDNS(HWND Dlg, BOOL Enabled) {
|
||||||
if (! Enabled) {
|
if (! Enabled) {
|
||||||
SendDlgItemMessage(Dlg, IDC_DNS1, IPM_CLEARADDRESS, 0, 0);
|
SendDlgItemMessage(Dlg, IDC_DNS1, IPM_CLEARADDRESS, 0, 0);
|
||||||
SendDlgItemMessage(Dlg, IDC_DNS2, IPM_CLEARADDRESS, 0, 0);
|
SendDlgItemMessage(Dlg, IDC_DNS2, IPM_CLEARADDRESS, 0, 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,10 +133,13 @@ static BOOL
|
||||||
ValidateAndStore(HWND Dlg, PTCPIP_PROPERTIES_DATA DlgData)
|
ValidateAndStore(HWND Dlg, PTCPIP_PROPERTIES_DATA DlgData)
|
||||||
{
|
{
|
||||||
DWORD IpAddress;
|
DWORD IpAddress;
|
||||||
|
MIB_IPFORWARDROW RowToAdd = { 0 }, RowToRem = { 0 };
|
||||||
|
|
||||||
DlgData->DhcpEnabled = (BST_CHECKED ==
|
DlgData->DhcpEnabled = (BST_CHECKED ==
|
||||||
IsDlgButtonChecked(Dlg, IDC_USEDHCP));
|
IsDlgButtonChecked(Dlg, IDC_USEDHCP));
|
||||||
if (! DlgData->DhcpEnabled) {
|
if (! DlgData->DhcpEnabled) {
|
||||||
|
DhcpReleaseIpAddressLease( DlgData->AdapterIndex );
|
||||||
|
|
||||||
if (4 != SendMessageW(GetDlgItem(Dlg, IDC_IPADDR), IPM_GETADDRESS,
|
if (4 != SendMessageW(GetDlgItem(Dlg, IDC_IPADDR), IPM_GETADDRESS,
|
||||||
0, (LPARAM) &IpAddress)) {
|
0, (LPARAM) &IpAddress)) {
|
||||||
ShowError(Dlg, IDS_ENTER_VALID_IPADDRESS);
|
ShowError(Dlg, IDS_ENTER_VALID_IPADDRESS);
|
||||||
|
@ -156,11 +160,26 @@ ValidateAndStore(HWND Dlg, PTCPIP_PROPERTIES_DATA DlgData)
|
||||||
} else {
|
} else {
|
||||||
DlgData->Gateway = htonl(IpAddress);
|
DlgData->Gateway = htonl(IpAddress);
|
||||||
}
|
}
|
||||||
|
DhcpStaticRefreshParams
|
||||||
|
( DlgData->AdapterIndex, DlgData->IpAddress, DlgData->SubnetMask );
|
||||||
|
|
||||||
|
RowToRem.dwForwardMask = 0;
|
||||||
|
RowToRem.dwForwardMetric1 = 1;
|
||||||
|
RowToRem.dwForwardNextHop = DlgData->OldGateway;
|
||||||
|
|
||||||
|
DeleteIpForwardEntry( &RowToRem );
|
||||||
|
|
||||||
|
RowToAdd.dwForwardMask = 0;
|
||||||
|
RowToAdd.dwForwardMetric1 = 1;
|
||||||
|
RowToAdd.dwForwardNextHop = DlgData->Gateway;
|
||||||
|
|
||||||
|
CreateIpForwardEntry( &RowToAdd );
|
||||||
ASSERT(BST_CHECKED == IsDlgButtonChecked(Dlg, IDC_FIXEDDNS));
|
ASSERT(BST_CHECKED == IsDlgButtonChecked(Dlg, IDC_FIXEDDNS));
|
||||||
} else {
|
} else {
|
||||||
DlgData->IpAddress = INADDR_NONE;
|
DlgData->IpAddress = INADDR_NONE;
|
||||||
DlgData->SubnetMask = INADDR_NONE;
|
DlgData->SubnetMask = INADDR_NONE;
|
||||||
DlgData->Gateway = INADDR_NONE;
|
DlgData->Gateway = INADDR_NONE;
|
||||||
|
DhcpLeaseIpAddress( DlgData->AdapterIndex );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BST_CHECKED == IsDlgButtonChecked(Dlg, IDC_FIXEDDNS)) {
|
if (BST_CHECKED == IsDlgButtonChecked(Dlg, IDC_FIXEDDNS)) {
|
||||||
|
@ -251,7 +270,8 @@ InternTCPIPSettings(HWND Dlg, PTCPIP_PROPERTIES_DATA DlgData) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageBox(NULL, TEXT("You need to reboot before the new parameters take effect."), TEXT("Reboot required"), MB_OK | MB_ICONWARNING);
|
// arty ... Not needed anymore ... We update the address live now
|
||||||
|
//MessageBox(NULL, TEXT("You need to reboot before the new parameters take effect."), TEXT("Reboot required"), MB_OK | MB_ICONWARNING);
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
|
|
@ -1548,6 +1548,7 @@ NTSTATUS DispTdiDeleteIPAddress( PIRP Irp, PIO_STACK_LOCATION IrpSp ) {
|
||||||
|
|
||||||
ForEachInterface(IF) {
|
ForEachInterface(IF) {
|
||||||
if( IF->Index == *NteIndex ) {
|
if( IF->Index == *NteIndex ) {
|
||||||
|
IPRemoveInterfaceRoute( IF );
|
||||||
IF->Unicast.Type = IP_ADDRESS_V4;
|
IF->Unicast.Type = IP_ADDRESS_V4;
|
||||||
IF->Unicast.Address.IPv4Address = 0;
|
IF->Unicast.Address.IPv4Address = 0;
|
||||||
IF->Netmask.Type = IP_ADDRESS_V4;
|
IF->Netmask.Type = IP_ADDRESS_V4;
|
||||||
|
|
|
@ -305,14 +305,19 @@ VOID IPRemoveInterfaceRoute( PIP_INTERFACE IF ) {
|
||||||
TCPDisposeInterfaceData( IF->TCPContext );
|
TCPDisposeInterfaceData( IF->TCPContext );
|
||||||
IF->TCPContext = NULL;
|
IF->TCPContext = NULL;
|
||||||
|
|
||||||
|
TI_DbgPrint(DEBUG_IP,("Removing interface Addr %s\n", A2S(&IF->Unicast)));
|
||||||
|
TI_DbgPrint(DEBUG_IP,(" Mask %s\n", A2S(&IF->Netmask)));
|
||||||
|
|
||||||
AddrWidenAddress(&GeneralRoute,&IF->Unicast,&IF->Netmask);
|
AddrWidenAddress(&GeneralRoute,&IF->Unicast,&IF->Netmask);
|
||||||
|
|
||||||
RouterRemoveRoute(&GeneralRoute, &IF->Unicast);
|
RouterRemoveRoute(&GeneralRoute, &IF->Unicast);
|
||||||
|
|
||||||
/* Remove permanent NCE, but first we have to find it */
|
/* Remove permanent NCE, but first we have to find it */
|
||||||
NCE = NBLocateNeighbor(&IF->Unicast);
|
NCE = NBLocateNeighbor(&IF->Unicast);
|
||||||
if (NCE)
|
if (NCE)
|
||||||
NBRemoveNeighbor(NCE);
|
NBRemoveNeighbor(NCE);
|
||||||
|
else
|
||||||
|
TI_DbgPrint(DEBUG_IP, ("Could not delete IF route (0x%X)\n", IF));
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID IPUnregisterInterface(
|
VOID IPUnregisterInterface(
|
||||||
|
|
|
@ -18,6 +18,30 @@
|
||||||
LIST_ENTRY FIBListHead;
|
LIST_ENTRY FIBListHead;
|
||||||
KSPIN_LOCK FIBLock;
|
KSPIN_LOCK FIBLock;
|
||||||
|
|
||||||
|
void RouterDumpRoutes() {
|
||||||
|
PLIST_ENTRY CurrentEntry;
|
||||||
|
PLIST_ENTRY NextEntry;
|
||||||
|
PFIB_ENTRY Current;
|
||||||
|
PNEIGHBOR_CACHE_ENTRY NCE;
|
||||||
|
|
||||||
|
TI_DbgPrint(DEBUG_ROUTER,("Dumping Routes\n"));
|
||||||
|
|
||||||
|
CurrentEntry = FIBListHead.Flink;
|
||||||
|
while (CurrentEntry != &FIBListHead) {
|
||||||
|
NextEntry = CurrentEntry->Flink;
|
||||||
|
Current = CONTAINING_RECORD(CurrentEntry, FIB_ENTRY, ListEntry);
|
||||||
|
|
||||||
|
NCE = Current->Router;
|
||||||
|
|
||||||
|
TI_DbgPrint(DEBUG_ROUTER,("Examining FIBE %x\n", Current));
|
||||||
|
TI_DbgPrint(DEBUG_ROUTER,("... NetworkAddress %s\n", A2S(&Current->NetworkAddress)));
|
||||||
|
TI_DbgPrint(DEBUG_ROUTER,("... NCE->Address . %s\n", A2S(&NCE->Address)));
|
||||||
|
|
||||||
|
CurrentEntry = NextEntry;
|
||||||
|
}
|
||||||
|
|
||||||
|
TI_DbgPrint(DEBUG_ROUTER,("Dumping Routes ... Done\n"));
|
||||||
|
}
|
||||||
|
|
||||||
VOID FreeFIB(
|
VOID FreeFIB(
|
||||||
PVOID Object)
|
PVOID Object)
|
||||||
|
@ -331,9 +355,13 @@ NTSTATUS RouterRemoveRoute(PIP_ADDRESS Target, PIP_ADDRESS Router)
|
||||||
PNEIGHBOR_CACHE_ENTRY NCE;
|
PNEIGHBOR_CACHE_ENTRY NCE;
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_ROUTER, ("Called\n"));
|
TI_DbgPrint(DEBUG_ROUTER, ("Called\n"));
|
||||||
|
TI_DbgPrint(DEBUG_ROUTER, ("Deleting Route From: %s\n", A2S(Router)));
|
||||||
|
TI_DbgPrint(DEBUG_ROUTER, (" To: %s\n", A2S(Target)));
|
||||||
|
|
||||||
TcpipAcquireSpinLock(&FIBLock, &OldIrql);
|
TcpipAcquireSpinLock(&FIBLock, &OldIrql);
|
||||||
|
|
||||||
|
RouterDumpRoutes();
|
||||||
|
|
||||||
CurrentEntry = FIBListHead.Flink;
|
CurrentEntry = FIBListHead.Flink;
|
||||||
while (CurrentEntry != &FIBListHead) {
|
while (CurrentEntry != &FIBListHead) {
|
||||||
NextEntry = CurrentEntry->Flink;
|
NextEntry = CurrentEntry->Flink;
|
||||||
|
@ -356,6 +384,8 @@ NTSTATUS RouterRemoveRoute(PIP_ADDRESS Target, PIP_ADDRESS Router)
|
||||||
DestroyFIBE( Current );
|
DestroyFIBE( Current );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RouterDumpRoutes();
|
||||||
|
|
||||||
TcpipReleaseSpinLock(&FIBLock, OldIrql);
|
TcpipReleaseSpinLock(&FIBLock, OldIrql);
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_ROUTER, ("Leaving\n"));
|
TI_DbgPrint(DEBUG_ROUTER, ("Leaving\n"));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue