mirror of
https://github.com/reactos/reactos.git
synced 2025-02-25 01:39:30 +00:00
- Make ipconfig /renew work even if we haven't got an address yet
- Fix several potential crashes - Fix an infinite loop caused by us sending a discover packet without adding a protocol first (this is exposed by releasing then renewing) - Fixes bug 4630 svn path=/trunk/; revision=42217
This commit is contained in:
parent
f9f57c59fc
commit
849236d3ac
1 changed files with 19 additions and 7 deletions
|
@ -78,6 +78,7 @@ DWORD DSQueryHWInfo( PipeSendFunc Send, COMM_DHCP_REQ *Req ) {
|
||||||
DWORD DSReleaseIpAddressLease( PipeSendFunc Send, COMM_DHCP_REQ *Req ) {
|
DWORD DSReleaseIpAddressLease( PipeSendFunc Send, COMM_DHCP_REQ *Req ) {
|
||||||
COMM_DHCP_REPLY Reply;
|
COMM_DHCP_REPLY Reply;
|
||||||
PDHCP_ADAPTER Adapter;
|
PDHCP_ADAPTER Adapter;
|
||||||
|
struct protocol* proto;
|
||||||
|
|
||||||
ApiLock();
|
ApiLock();
|
||||||
|
|
||||||
|
@ -86,8 +87,12 @@ DWORD DSReleaseIpAddressLease( PipeSendFunc Send, COMM_DHCP_REQ *Req ) {
|
||||||
Reply.Reply = Adapter ? 1 : 0;
|
Reply.Reply = Adapter ? 1 : 0;
|
||||||
|
|
||||||
if( Adapter ) {
|
if( Adapter ) {
|
||||||
|
if (Adapter->NteContext)
|
||||||
DeleteIPAddress( Adapter->NteContext );
|
DeleteIPAddress( Adapter->NteContext );
|
||||||
remove_protocol( find_protocol_by_adapter( &Adapter->DhclientInfo ) );
|
|
||||||
|
proto = find_protocol_by_adapter( &Adapter->DhclientInfo );
|
||||||
|
if (proto)
|
||||||
|
remove_protocol(proto);
|
||||||
}
|
}
|
||||||
|
|
||||||
ApiUnlock();
|
ApiUnlock();
|
||||||
|
@ -103,7 +108,7 @@ DWORD DSRenewIpAddressLease( PipeSendFunc Send, COMM_DHCP_REQ *Req ) {
|
||||||
|
|
||||||
Adapter = AdapterFindIndex( Req->AdapterIndex );
|
Adapter = AdapterFindIndex( Req->AdapterIndex );
|
||||||
|
|
||||||
if( !Adapter || Adapter->DhclientState.state != S_BOUND ) {
|
if( !Adapter || Adapter->DhclientState.state == S_STATIC ) {
|
||||||
Reply.Reply = 0;
|
Reply.Reply = 0;
|
||||||
ApiUnlock();
|
ApiUnlock();
|
||||||
return Send( &Reply );
|
return Send( &Reply );
|
||||||
|
@ -111,8 +116,11 @@ DWORD DSRenewIpAddressLease( PipeSendFunc Send, COMM_DHCP_REQ *Req ) {
|
||||||
|
|
||||||
Reply.Reply = 1;
|
Reply.Reply = 1;
|
||||||
|
|
||||||
send_discover( &Adapter->DhclientInfo );
|
add_protocol( Adapter->DhclientInfo.name,
|
||||||
state_bound( &Adapter->DhclientInfo );
|
Adapter->DhclientInfo.rfdesc, got_one,
|
||||||
|
&Adapter->DhclientInfo );
|
||||||
|
Adapter->DhclientInfo.client->state = S_INIT;
|
||||||
|
state_reboot(&Adapter->DhclientInfo);
|
||||||
|
|
||||||
ApiUnlock();
|
ApiUnlock();
|
||||||
|
|
||||||
|
@ -123,6 +131,7 @@ DWORD DSStaticRefreshParams( PipeSendFunc Send, COMM_DHCP_REQ *Req ) {
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
COMM_DHCP_REPLY Reply;
|
COMM_DHCP_REPLY Reply;
|
||||||
PDHCP_ADAPTER Adapter;
|
PDHCP_ADAPTER Adapter;
|
||||||
|
struct protocol* proto;
|
||||||
|
|
||||||
ApiLock();
|
ApiLock();
|
||||||
|
|
||||||
|
@ -131,9 +140,12 @@ DWORD DSStaticRefreshParams( PipeSendFunc Send, COMM_DHCP_REQ *Req ) {
|
||||||
Reply.Reply = Adapter ? 1 : 0;
|
Reply.Reply = Adapter ? 1 : 0;
|
||||||
|
|
||||||
if( Adapter ) {
|
if( Adapter ) {
|
||||||
|
if (Adapter->NteContext)
|
||||||
DeleteIPAddress( Adapter->NteContext );
|
DeleteIPAddress( Adapter->NteContext );
|
||||||
Adapter->DhclientState.state = S_STATIC;
|
Adapter->DhclientState.state = S_STATIC;
|
||||||
remove_protocol( find_protocol_by_adapter( &Adapter->DhclientInfo ) );
|
proto = find_protocol_by_adapter( &Adapter->DhclientInfo );
|
||||||
|
if (proto)
|
||||||
|
remove_protocol(proto);
|
||||||
Status = AddIPAddress( Req->Body.StaticRefreshParams.IPAddress,
|
Status = AddIPAddress( Req->Body.StaticRefreshParams.IPAddress,
|
||||||
Req->Body.StaticRefreshParams.Netmask,
|
Req->Body.StaticRefreshParams.Netmask,
|
||||||
Req->AdapterIndex,
|
Req->AdapterIndex,
|
||||||
|
|
Loading…
Reference in a new issue