Some comments were not understandable.
Added a new case when to destroy interface (when Up() failes and DialOnDemand is disabled). Forgot some to remove fUpThread in Up(). Changed UpFailedEvent() so that it pretends a connection-lost event (so we can try to redial). Added ResetOptionHandlers() and DownProtocols/Encapsulators(). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4351 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
f6a64130ad
commit
103501d9d7
|
@ -75,8 +75,6 @@ class PPPStateMachine {
|
||||||
private:
|
private:
|
||||||
BLocker& Locker()
|
BLocker& Locker()
|
||||||
{ return fLock; }
|
{ return fLock; }
|
||||||
void LeaveConstructionPhase();
|
|
||||||
void EnterDestructionPhase();
|
|
||||||
|
|
||||||
// private StateMachine methods
|
// private StateMachine methods
|
||||||
void NewState(PPP_STATE next);
|
void NewState(PPP_STATE next);
|
||||||
|
@ -122,6 +120,10 @@ class PPPStateMachine {
|
||||||
void BringHandlersUp();
|
void BringHandlersUp();
|
||||||
uint32 BringPhaseUp();
|
uint32 BringPhaseUp();
|
||||||
|
|
||||||
|
void DownProtocols();
|
||||||
|
void DownEncapsulators();
|
||||||
|
void ResetOptionHandlers();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PPPInterface *fInterface;
|
PPPInterface *fInterface;
|
||||||
|
|
||||||
|
|
|
@ -450,6 +450,14 @@ PPPInterface::Up()
|
||||||
while(true) {
|
while(true) {
|
||||||
if(IsUp()) {
|
if(IsUp()) {
|
||||||
fReportManager.DisableReports(PPP_CONNECTION_REPORT, me);
|
fReportManager.DisableReports(PPP_CONNECTION_REPORT, me);
|
||||||
|
|
||||||
|
if(me == fUpThread) {
|
||||||
|
fLock.Lock();
|
||||||
|
fDialRetry = 0;
|
||||||
|
fUpThread = -1;
|
||||||
|
fLock.Unlock();
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -457,6 +465,11 @@ PPPInterface::Up()
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(IsUp()) {
|
if(IsUp()) {
|
||||||
|
if(me == fUpThread) {
|
||||||
|
fDialRetry = 0;
|
||||||
|
fUpThread = -1;
|
||||||
|
}
|
||||||
|
|
||||||
PPP_REPLY(sender, B_OK);
|
PPP_REPLY(sender, B_OK);
|
||||||
fReportManager.DisableReports(PPP_CONNECTION_REPORT, me);
|
fReportManager.DisableReports(PPP_CONNECTION_REPORT, me);
|
||||||
return true;
|
return true;
|
||||||
|
@ -464,6 +477,11 @@ PPPInterface::Up()
|
||||||
|
|
||||||
|
|
||||||
if(report.type == PPP_DESTRUCTION_REPORT) {
|
if(report.type == PPP_DESTRUCTION_REPORT) {
|
||||||
|
if(me == fUpThread) {
|
||||||
|
fDialRetry = 0;
|
||||||
|
fUpThread = -1;
|
||||||
|
}
|
||||||
|
|
||||||
PPP_REPLY(sender, B_OK);
|
PPP_REPLY(sender, B_OK);
|
||||||
fReportManager.DisableReports(PPP_CONNECTION_REPORT, me);
|
fReportManager.DisableReports(PPP_CONNECTION_REPORT, me);
|
||||||
return false;
|
return false;
|
||||||
|
@ -476,12 +494,25 @@ PPPInterface::Up()
|
||||||
PPP_REPLY(sender, B_OK);
|
PPP_REPLY(sender, B_OK);
|
||||||
continue;
|
continue;
|
||||||
} else if(report.code == PPP_REPORT_UP_SUCCESSFUL) {
|
} else if(report.code == PPP_REPORT_UP_SUCCESSFUL) {
|
||||||
|
if(me == fUpThread) {
|
||||||
|
fDialRetry = 0;
|
||||||
|
fUpThread = -1;
|
||||||
|
}
|
||||||
|
|
||||||
PPP_REPLY(sender, B_OK);
|
PPP_REPLY(sender, B_OK);
|
||||||
fReportManager.DisableReports(PPP_CONNECTION_REPORT, me);
|
fReportManager.DisableReports(PPP_CONNECTION_REPORT, me);
|
||||||
return true;
|
return true;
|
||||||
} else if(report.code == PPP_REPORT_DOWN_SUCCESSFUL
|
} else if(report.code == PPP_REPORT_DOWN_SUCCESSFUL
|
||||||
|| report.code == PPP_REPORT_UP_ABORTED
|
|| report.code == PPP_REPORT_UP_ABORTED
|
||||||
|| report.code == PPP_REPORT_AUTHENTICATION_FAILED) {
|
|| report.code == PPP_REPORT_AUTHENTICATION_FAILED) {
|
||||||
|
if(me == fUpThread) {
|
||||||
|
fDialRetry = 0;
|
||||||
|
fUpThread = -1;
|
||||||
|
|
||||||
|
if(!DoesDialOnDemand() && report.code != PPP_REPORT_DOWN_SUCCESSFUL)
|
||||||
|
fManager->delete_interface(this);
|
||||||
|
}
|
||||||
|
|
||||||
PPP_REPLY(sender, B_OK);
|
PPP_REPLY(sender, B_OK);
|
||||||
fReportManager.DisableReports(PPP_CONNECTION_REPORT, me);
|
fReportManager.DisableReports(PPP_CONNECTION_REPORT, me);
|
||||||
return false;
|
return false;
|
||||||
|
@ -514,6 +545,11 @@ PPPInterface::Up()
|
||||||
if(fDialRetry >= fDialRetriesLimit) {
|
if(fDialRetry >= fDialRetriesLimit) {
|
||||||
fDialRetry = 0;
|
fDialRetry = 0;
|
||||||
fUpThread = -1;
|
fUpThread = -1;
|
||||||
|
|
||||||
|
if(!DoesDialOnDemand()
|
||||||
|
&& report.code != PPP_REPORT_DOWN_SUCCESSFUL)
|
||||||
|
fManager->delete_interface(this);
|
||||||
|
|
||||||
PPP_REPLY(sender, B_OK);
|
PPP_REPLY(sender, B_OK);
|
||||||
fReportManager.DisableReports(PPP_CONNECTION_REPORT, me);
|
fReportManager.DisableReports(PPP_CONNECTION_REPORT, me);
|
||||||
return false;
|
return false;
|
||||||
|
@ -536,6 +572,11 @@ PPPInterface::Up()
|
||||||
fUpThread = -1;
|
fUpThread = -1;
|
||||||
PPP_REPLY(sender, B_OK);
|
PPP_REPLY(sender, B_OK);
|
||||||
fReportManager.DisableReports(PPP_CONNECTION_REPORT, me);
|
fReportManager.DisableReports(PPP_CONNECTION_REPORT, me);
|
||||||
|
|
||||||
|
if(!DoesDialOnDemand()
|
||||||
|
&& report.code != PPP_REPORT_DOWN_SUCCESSFUL)
|
||||||
|
fManager->delete_interface(this);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,9 +40,8 @@ PPPStateMachine::NextID()
|
||||||
void
|
void
|
||||||
PPPStateMachine::NewState(PPP_STATE next)
|
PPPStateMachine::NewState(PPP_STATE next)
|
||||||
{
|
{
|
||||||
// TODO:
|
if(State() == PPP_OPENED_STATE && next != State())
|
||||||
// if(State() == PPP_OPENED_STATE)
|
ResetOptionHandlers();
|
||||||
// ResetOptionHandlers();
|
|
||||||
|
|
||||||
fState = next;
|
fState = next;
|
||||||
}
|
}
|
||||||
|
@ -195,8 +194,8 @@ PPPStateMachine::DownEvent(PPPInterface *interface)
|
||||||
if(Interface()->IsMultilink() && !Interface()->Parent()) {
|
if(Interface()->IsMultilink() && !Interface()->Parent()) {
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
PPPInterface *child;
|
PPPInterface *child;
|
||||||
for(int32 i = 0; i < Interface()->CountChildren(); i++) {
|
for(int32 index = 0; index < Interface()->CountChildren(); index++) {
|
||||||
child = Interface()->ChildAt(i);
|
child = Interface()->ChildAt(index);
|
||||||
|
|
||||||
if(child && child->IsUp())
|
if(child && child->IsUp())
|
||||||
++count;
|
++count;
|
||||||
|
@ -213,8 +212,20 @@ PPPStateMachine::DownEvent(PPPInterface *interface)
|
||||||
void
|
void
|
||||||
PPPStateMachine::UpFailedEvent(PPPProtocol *protocol)
|
PPPStateMachine::UpFailedEvent(PPPProtocol *protocol)
|
||||||
{
|
{
|
||||||
if(protocol->Flags() & PPP_NOT_IMPORTANT)
|
if((protocol->Flags() & PPP_NOT_IMPORTANT) == 0) {
|
||||||
CloseEvent();
|
if(Interface()->Mode() == PPP_CLIENT_MODE) {
|
||||||
|
// pretend we lost connection:
|
||||||
|
if(Interface()->IsMultilink() && !Interface()->Parent())
|
||||||
|
for(int32 index = 0; index < Interface()->CountChildren(); index++)
|
||||||
|
Interface()->ChildAt(index)->StateMachine().CloseEvent();
|
||||||
|
else if(Interface()->Device())
|
||||||
|
Interface()->Device()->Down();
|
||||||
|
else
|
||||||
|
CloseEvent();
|
||||||
|
// just to be on the secure side ;)
|
||||||
|
} else
|
||||||
|
CloseEvent();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -237,8 +248,20 @@ PPPStateMachine::DownEvent(PPPProtocol *protocol)
|
||||||
void
|
void
|
||||||
PPPStateMachine::UpFailedEvent(PPPEncapsulator *encapsulator)
|
PPPStateMachine::UpFailedEvent(PPPEncapsulator *encapsulator)
|
||||||
{
|
{
|
||||||
if(encapsulator->Flags() & PPP_NOT_IMPORTANT)
|
if((encapsulator->Flags() & PPP_NOT_IMPORTANT) == 0) {
|
||||||
CloseEvent();
|
if(Interface()->Mode() == PPP_CLIENT_MODE) {
|
||||||
|
// pretend we lost connection:
|
||||||
|
if(Interface()->IsMultilink() && !Interface()->Parent())
|
||||||
|
for(int32 index = 0; index < Interface()->CountChildren(); index++)
|
||||||
|
Interface()->ChildAt(index)->StateMachine().CloseEvent();
|
||||||
|
else if(Interface()->Device())
|
||||||
|
Interface()->Device()->Down();
|
||||||
|
else
|
||||||
|
CloseEvent();
|
||||||
|
// just to be on the secure side ;)
|
||||||
|
} else
|
||||||
|
CloseEvent();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -288,12 +311,6 @@ PPPStateMachine::TLFNotify()
|
||||||
{
|
{
|
||||||
LockerHelper locker(fLock);
|
LockerHelper locker(fLock);
|
||||||
|
|
||||||
if(Phase() == PPP_ESTABLISHMENT_PHASE) {
|
|
||||||
// we may not go down because an OpenEvent indicates that the
|
|
||||||
// user wants to connect
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// from now on no packets may be sent to the device
|
// from now on no packets may be sent to the device
|
||||||
NewPhase(PPP_DOWN_PHASE);
|
NewPhase(PPP_DOWN_PHASE);
|
||||||
|
|
||||||
|
@ -357,7 +374,7 @@ PPPStateMachine::UpEvent()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: handle server-up!
|
// TODO: handle server-up! (maybe already done correctly)
|
||||||
NewState(PPP_REQ_SENT_STATE);
|
NewState(PPP_REQ_SENT_STATE);
|
||||||
InitializeRestartCount();
|
InitializeRestartCount();
|
||||||
locker.UnlockNow();
|
locker.UnlockNow();
|
||||||
|
@ -418,10 +435,11 @@ PPPStateMachine::DownEvent()
|
||||||
IllegalEvent(PPP_DOWN_EVENT);
|
IllegalEvent(PPP_DOWN_EVENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO:
|
DownProtocols();
|
||||||
// DownProtocols();
|
DownEncapsulators();
|
||||||
// DownEncapsulators();
|
|
||||||
// ResetOptionHandlers();
|
fAuthenticationStatus = PPP_NOT_AUTHENTICATED;
|
||||||
|
fPeerAuthenticationStatus = PPP_NOT_AUTHENTICATED;
|
||||||
|
|
||||||
NewPhase(PPP_DOWN_PHASE);
|
NewPhase(PPP_DOWN_PHASE);
|
||||||
|
|
||||||
|
@ -451,8 +469,6 @@ PPPStateMachine::DownEvent()
|
||||||
NewState(PPP_INITIAL_STATE);
|
NewState(PPP_INITIAL_STATE);
|
||||||
|
|
||||||
if(Interface()->DoesAutoRedial()) {
|
if(Interface()->DoesAutoRedial()) {
|
||||||
// TODO:
|
|
||||||
// if we are reconfiguring we should redial, too
|
|
||||||
if(needsRedial)
|
if(needsRedial)
|
||||||
Interface()->Redial();
|
Interface()->Redial();
|
||||||
} else if(!Interface()->DoesDialOnDemand())
|
} else if(!Interface()->DoesDialOnDemand())
|
||||||
|
@ -487,9 +503,9 @@ PPPStateMachine::OpenEvent()
|
||||||
|
|
||||||
if(Interface()->IsMultilink() && !Interface()->Parent()) {
|
if(Interface()->IsMultilink() && !Interface()->Parent()) {
|
||||||
NewPhase(PPP_ESTABLISHMENT_PHASE);
|
NewPhase(PPP_ESTABLISHMENT_PHASE);
|
||||||
for(int32 i = 0; i < Interface()->CountChildren(); i++)
|
for(int32 index = 0; index < Interface()->CountChildren(); index++)
|
||||||
if(Interface()->ChildAt(i)->Mode() == Interface()->Mode())
|
if(Interface()->ChildAt(index)->Mode() == Interface()->Mode())
|
||||||
Interface()->ChildAt(i)->StateMachine().OpenEvent();
|
Interface()->ChildAt(index)->StateMachine().OpenEvent();
|
||||||
} else {
|
} else {
|
||||||
locker.UnlockNow();
|
locker.UnlockNow();
|
||||||
ThisLayerStarted();
|
ThisLayerStarted();
|
||||||
|
@ -528,8 +544,8 @@ PPPStateMachine::CloseEvent()
|
||||||
|
|
||||||
ThisLayerDown();
|
ThisLayerDown();
|
||||||
|
|
||||||
for(int32 i = 0; i < Interface()->CountChildren(); i++)
|
for(int32 index = 0; index < Interface()->CountChildren(); index++)
|
||||||
Interface()->ChildAt(i)->StateMachine().CloseEvent();
|
Interface()->ChildAt(index)->StateMachine().CloseEvent();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -673,7 +689,7 @@ PPPStateMachine::RCRGoodEvent(mbuf *packet)
|
||||||
// tld,scr,sca/8
|
// tld,scr,sca/8
|
||||||
NewState(PPP_ACK_SENT_STATE);
|
NewState(PPP_ACK_SENT_STATE);
|
||||||
NewPhase(PPP_ESTABLISHMENT_PHASE);
|
NewPhase(PPP_ESTABLISHMENT_PHASE);
|
||||||
// tell handlers that we are reconfiguring
|
// indicates to handlers that we are reconfiguring
|
||||||
locker.UnlockNow();
|
locker.UnlockNow();
|
||||||
ThisLayerDown();
|
ThisLayerDown();
|
||||||
SendConfigureRequest();
|
SendConfigureRequest();
|
||||||
|
@ -708,7 +724,7 @@ PPPStateMachine::RCRBadEvent(mbuf *nak, mbuf *reject)
|
||||||
case PPP_OPENED_STATE:
|
case PPP_OPENED_STATE:
|
||||||
NewState(PPP_REQ_SENT_STATE);
|
NewState(PPP_REQ_SENT_STATE);
|
||||||
NewPhase(PPP_ESTABLISHMENT_PHASE);
|
NewPhase(PPP_ESTABLISHMENT_PHASE);
|
||||||
// tell handlers that we are reconfiguring
|
// indicates to handlers that we are reconfiguring
|
||||||
locker.UnlockNow();
|
locker.UnlockNow();
|
||||||
ThisLayerDown();
|
ThisLayerDown();
|
||||||
SendConfigureRequest();
|
SendConfigureRequest();
|
||||||
|
@ -747,8 +763,8 @@ PPPStateMachine::RCAEvent(mbuf *packet)
|
||||||
PPPOptionHandler *handler;
|
PPPOptionHandler *handler;
|
||||||
PPPConfigurePacket ack(packet);
|
PPPConfigurePacket ack(packet);
|
||||||
|
|
||||||
for(int32 i = 0; i < LCP().CountOptionHandlers(); i++) {
|
for(int32 index = 0; index < LCP().CountOptionHandlers(); index++) {
|
||||||
handler = LCP().OptionHandlerAt(i);
|
handler = LCP().OptionHandlerAt(index);
|
||||||
handler->ParseAck(ack);
|
handler->ParseAck(ack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -785,7 +801,7 @@ PPPStateMachine::RCAEvent(mbuf *packet)
|
||||||
case PPP_OPENED_STATE:
|
case PPP_OPENED_STATE:
|
||||||
NewState(PPP_REQ_SENT_STATE);
|
NewState(PPP_REQ_SENT_STATE);
|
||||||
NewPhase(PPP_ESTABLISHMENT_PHASE);
|
NewPhase(PPP_ESTABLISHMENT_PHASE);
|
||||||
// tell handlers that we are reconfiguring
|
// indicates to handlers that we are reconfiguring
|
||||||
locker.UnlockNow();
|
locker.UnlockNow();
|
||||||
ThisLayerDown();
|
ThisLayerDown();
|
||||||
SendConfigureRequest();
|
SendConfigureRequest();
|
||||||
|
@ -811,8 +827,8 @@ PPPStateMachine::RCNEvent(mbuf *packet)
|
||||||
PPPOptionHandler *handler;
|
PPPOptionHandler *handler;
|
||||||
PPPConfigurePacket nak_reject(packet);
|
PPPConfigurePacket nak_reject(packet);
|
||||||
|
|
||||||
for(int32 i = 0; i < LCP().CountOptionHandlers(); i++) {
|
for(int32 index = 0; index < LCP().CountOptionHandlers(); index++) {
|
||||||
handler = LCP().OptionHandlerAt(i);
|
handler = LCP().OptionHandlerAt(index);
|
||||||
|
|
||||||
if(nak_reject.Code() == PPP_CONFIGURE_NAK)
|
if(nak_reject.Code() == PPP_CONFIGURE_NAK)
|
||||||
handler->ParseNak(nak_reject);
|
handler->ParseNak(nak_reject);
|
||||||
|
@ -846,7 +862,7 @@ PPPStateMachine::RCNEvent(mbuf *packet)
|
||||||
case PPP_OPENED_STATE:
|
case PPP_OPENED_STATE:
|
||||||
NewState(PPP_REQ_SENT_STATE);
|
NewState(PPP_REQ_SENT_STATE);
|
||||||
NewPhase(PPP_ESTABLISHMENT_PHASE);
|
NewPhase(PPP_ESTABLISHMENT_PHASE);
|
||||||
// tell handlers that we are reconfiguring
|
// indicates to handlers that we are reconfiguring
|
||||||
locker.UnlockNow();
|
locker.UnlockNow();
|
||||||
ThisLayerDown();
|
ThisLayerDown();
|
||||||
SendConfigureRequest();
|
SendConfigureRequest();
|
||||||
|
@ -865,6 +881,9 @@ PPPStateMachine::RTREvent(mbuf *packet)
|
||||||
if(fID == mtod(packet, lcp_packet*)->id)
|
if(fID == mtod(packet, lcp_packet*)->id)
|
||||||
fID -= 128;
|
fID -= 128;
|
||||||
|
|
||||||
|
fAuthenticationStatus = PPP_NOT_AUTHENTICATED;
|
||||||
|
fPeerAuthenticationStatus = PPP_NOT_AUTHENTICATED;
|
||||||
|
|
||||||
switch(State()) {
|
switch(State()) {
|
||||||
case PPP_INITIAL_STATE:
|
case PPP_INITIAL_STATE:
|
||||||
case PPP_STARTING_STATE:
|
case PPP_STARTING_STATE:
|
||||||
|
@ -875,7 +894,7 @@ PPPStateMachine::RTREvent(mbuf *packet)
|
||||||
case PPP_ACK_SENT_STATE:
|
case PPP_ACK_SENT_STATE:
|
||||||
NewState(PPP_REQ_SENT_STATE);
|
NewState(PPP_REQ_SENT_STATE);
|
||||||
NewPhase(PPP_TERMINATION_PHASE);
|
NewPhase(PPP_TERMINATION_PHASE);
|
||||||
// tell handlers that we are terminating
|
// indicates to handlers that we are terminating
|
||||||
locker.UnlockNow();
|
locker.UnlockNow();
|
||||||
SendTerminateAck(packet);
|
SendTerminateAck(packet);
|
||||||
break;
|
break;
|
||||||
|
@ -883,7 +902,7 @@ PPPStateMachine::RTREvent(mbuf *packet)
|
||||||
case PPP_OPENED_STATE:
|
case PPP_OPENED_STATE:
|
||||||
NewState(PPP_STOPPING_STATE);
|
NewState(PPP_STOPPING_STATE);
|
||||||
NewPhase(PPP_TERMINATION_PHASE);
|
NewPhase(PPP_TERMINATION_PHASE);
|
||||||
// tell handlers that we are terminating
|
// indicates to handlers that we are terminating
|
||||||
ZeroRestartCount();
|
ZeroRestartCount();
|
||||||
locker.UnlockNow();
|
locker.UnlockNow();
|
||||||
ThisLayerDown();
|
ThisLayerDown();
|
||||||
|
@ -892,7 +911,7 @@ PPPStateMachine::RTREvent(mbuf *packet)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
NewPhase(PPP_TERMINATION_PHASE);
|
NewPhase(PPP_TERMINATION_PHASE);
|
||||||
// tell handlers that we are terminating
|
// indicates to handlers that we are terminating
|
||||||
locker.UnlockNow();
|
locker.UnlockNow();
|
||||||
SendTerminateAck(packet);
|
SendTerminateAck(packet);
|
||||||
}
|
}
|
||||||
|
@ -1104,7 +1123,7 @@ PPPStateMachine::RCREvent(mbuf *packet)
|
||||||
|
|
||||||
for(int32 index = 0; index < LCP().CountOptionHandlers();
|
for(int32 index = 0; index < LCP().CountOptionHandlers();
|
||||||
index++) {
|
index++) {
|
||||||
handler = LCP().OptionHandlerAt(i);
|
handler = LCP().OptionHandlerAt(index);
|
||||||
error = handler->ParseRequest(&request, item, &nak, &reject);
|
error = handler->ParseRequest(&request, item, &nak, &reject);
|
||||||
if(error == PPP_UNHANLED)
|
if(error == PPP_UNHANLED)
|
||||||
continue;
|
continue;
|
||||||
|
@ -1216,11 +1235,9 @@ PPPStateMachine::ThisLayerUp()
|
||||||
void
|
void
|
||||||
PPPStateMachine::ThisLayerDown()
|
PPPStateMachine::ThisLayerDown()
|
||||||
{
|
{
|
||||||
// TODO:
|
|
||||||
// DownProtocols();
|
|
||||||
// DownEncapsulators();
|
|
||||||
|
|
||||||
// PPPProtocol/Encapsulator::Down() should block if needed.
|
// PPPProtocol/Encapsulator::Down() should block if needed.
|
||||||
|
DownProtocols();
|
||||||
|
DownEncapsulators();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1273,9 +1290,9 @@ PPPStateMachine::SendConfigureRequest()
|
||||||
request.SetID(NextID());
|
request.SetID(NextID());
|
||||||
fConfigureID = request.ID();
|
fConfigureID = request.ID();
|
||||||
|
|
||||||
for(int32 i = 0; i < LCP().CountOptionHandlers(); i++) {
|
for(int32 index = 0; index < LCP().CountOptionHandlers(); index++) {
|
||||||
// add all items
|
// add all items
|
||||||
if(!LCP().OptionHandlerAt(i)->AddToRequest(&request)) {
|
if(!LCP().OptionHandlerAt(index)->AddToRequest(&request)) {
|
||||||
CloseEvent();
|
CloseEvent();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1293,8 +1310,8 @@ PPPStateMachine::SendConfigureAck(mbuf *packet)
|
||||||
mtod(packet, lcp_packet*)->code = PPP_CONFIGURE_ACK;
|
mtod(packet, lcp_packet*)->code = PPP_CONFIGURE_ACK;
|
||||||
PPPConfigurePacket ack(packet);
|
PPPConfigurePacket ack(packet);
|
||||||
|
|
||||||
for(int32 i = 0; i < LCP().CountOptionHandlers; i++)
|
for(int32 index = 0; index < LCP().CountOptionHandlers; index++)
|
||||||
LCP().OptionHandlerAt(i)->SendingAck(&ack);
|
LCP().OptionHandlerAt(index)->SendingAck(&ack);
|
||||||
|
|
||||||
LCP().Send(packet);
|
LCP().Send(packet);
|
||||||
}
|
}
|
||||||
|
@ -1434,3 +1451,30 @@ PPPStateMachine::BringPhaseUp()
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
PPPStateMachine::DownProtocols()
|
||||||
|
{
|
||||||
|
for(int32 index = 0; index < Interface()->CountProtocols(); index++)
|
||||||
|
Interface()->ProtocolAt(index)->Down();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
PPPStateMachine::DownEncapsulators()
|
||||||
|
{
|
||||||
|
PPPEncapsulator *encapsulator_handler = Interface()->FirstEncapsulator();
|
||||||
|
|
||||||
|
for(; encapsulator_handler;
|
||||||
|
encapsulator_handler = encapsulator_handler->Next())
|
||||||
|
encapsualtor_handler->Down();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
PPPStateMachine::ResetOptionHandlers()
|
||||||
|
{
|
||||||
|
for(int32 index = 0; index < LCP().CountOptionHandlers(); index++)
|
||||||
|
LCP().OptionHandlerAt(index)->Reset();
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue