Skip to contentSkip to conversation

ppp: transition phase to DEAD when lcp finishes

PATCH In review Kristen Carlson Accardi 2 participants 4 messages May 3, 2010 – May 10, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ppp: transition phase to DEAD when lcp finishes

change the state to DEAD when lcp finishes. This prevents us from calling our disconnect function again if we are already dead.

---
 gatchat/gatppp.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
gatchat/gatppp.c +4 -3
index 70669b0..dd6d84d 100644
@@ -186,9 +186,6 @@ static inline void ppp_enter_phase(GAtPPP *ppp, enum ppp_phase phase)
 {
 	g_print("Entering new phase: %d\n", phase);
 	ppp->phase = phase;
-
-	if (phase == PPP_PHASE_DEAD)
-		ppp_dead(ppp);
 }
 
 void ppp_set_auth(GAtPPP *ppp, const guint8* auth_data)
@@ -290,6 +287,10 @@ void ppp_lcp_down_notify(GAtPPP *ppp)
 
 void ppp_lcp_finished_notify(GAtPPP *ppp)
 {
+	if (ppp->phase == PPP_PHASE_DEAD)
+		return;
+
+	ppp_enter_phase(ppp, PPP_PHASE_DEAD);
 	ppp_dead(ppp);
 }
 
Signature · 1 line
1.6.6.1
#1 lore raw

Hi Kristen,

Quoted 2 lines

change the state to DEAD when lcp finishes. This prevents us from calling our disconnect function again if we are already dead.

I'm curious under what circumstances tlf gets called on LCP when we're already down?

Quoted 19 lines
---
 gatchat/gatppp.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
gatchat/gatppp.c +0 -3
index 70669b0..dd6d84d 100644
@@ -186,9 +186,6 @@ static inline void ppp_enter_phase(GAtPPP *ppp, enum
 ppp_phase phase) {
 	g_print("Entering new phase: %d\n", phase);
 	ppp->phase = phase;
-
-	if (phase == PPP_PHASE_DEAD)
-		ppp_dead(ppp);
 }
 
 void ppp_set_auth(GAtPPP *ppp, const guint8* auth_data)

gatchat/gatppp.c void ppp_lcp_down_notify(GAtPPP *ppp) · line 291

Quoted 5 lines
gatchat/gatppp.c +2 -0
@@ -290,6 +287,10 @@ void ppp_lcp_down_notify(GAtPPP *ppp)
 
 void ppp_lcp_finished_notify(GAtPPP *ppp)
 {
+	if (ppp->phase == PPP_PHASE_DEAD)
+		return;

I prefer we move this to ppp_enter_phase

gatchat/gatppp.c void ppp_lcp_down_notify(GAtPPP *ppp) · line 293

Quoted 2 lines
gatchat/gatppp.c +2 -0
+
+	ppp_enter_phase(ppp, PPP_PHASE_DEAD);

Keep this

gatchat/gatppp.c void ppp_lcp_down_notify(GAtPPP *ppp) · line 294

Quoted 1 line
gatchat/gatppp.c +0 -0
 	ppp_dead(ppp);

And remove this.

Regards,
-Denis

#2 lore raw
Quoted 7 lines · On Mon, 10 May 2010 09:21:37 -0500 Denis Kenzior <[email protected]> wrote:

Hi Kristen,

Quoted 2 lines

change the state to DEAD when lcp finishes. This prevents us from calling our disconnect function again if we are already dead.

I'm curious under what circumstances tlf gets called on LCP when we're already down?

A timeout after sending a terminate ack causes a tlf and switches us to the STOPPED state. disconnect function is called at tlf, and disconnect reason correctly set. Then, our read watcher is destroyed and we signal down (transitions us to state STARTING) and close (calls tlf and transitions us to INITIAL). Disconnect function is called with disconnect reason set to link dead.

#3 lore raw

Hi Kristen,

Quoted 11 lines

On Mon, 10 May 2010 09:21:37 -0500

Quoted 7 lines · Denis Kenzior

Hi Kristen,

Quoted 2 lines

change the state to DEAD when lcp finishes. This prevents us from calling our disconnect function again if we are already dead.

I'm curious under what circumstances tlf gets called on LCP when we're already down?

Quoted 7 lines

A timeout after sending a terminate ack causes a tlf and switches us to the STOPPED state. disconnect function is called at tlf, and disconnect reason correctly set. Then, our read watcher is destroyed and we signal down (transitions us to state STARTING) and close (calls tlf and transitions us to INITIAL). Disconnect function is called with disconnect reason set to link dead.

Ah yes, the silly Huawei hardware. Sounds like we should ignore GAtIO disconnects when we're already in PPP_DEAD phase.

Regards,
-Denis