Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions subsys/net/l2/ppp/fsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ struct net_if *ppp_fsm_iface(struct ppp_fsm *fsm)
return ctx->iface;
}

static bool ppp_fsm_is_dead(struct ppp_fsm *fsm)
{
struct ppp_context *ctx = ppp_fsm_ctx(fsm);

return ctx->phase == PPP_DEAD;
}

static void fsm_send_configure_req(struct ppp_fsm *fsm, bool retransmit)
{
struct net_pkt *pkt = NULL;
Expand Down Expand Up @@ -246,6 +253,10 @@ void ppp_fsm_close(struct ppp_fsm *fsm, const uint8_t *reason)

case PPP_STOPPING:
ppp_change_state(fsm, PPP_CLOSING);
if (ppp_fsm_is_dead(fsm)) {
fsm->retransmits = 0;
k_work_reschedule(&fsm->timer, K_NO_WAIT);
}
break;

default:
Expand Down
7 changes: 6 additions & 1 deletion subsys/net/l2/ppp/lcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,12 @@ static void lcp_open(struct ppp_context *ctx)
static void lcp_close(struct ppp_context *ctx, const uint8_t *reason)
{
if (ctx->phase != PPP_DEAD) {
ppp_change_phase(ctx, PPP_TERMINATE);
if (ctx->phase == PPP_ESTABLISH) {
/* Link is not established yet, so we can go directly to DEAD */
ppp_change_phase(ctx, PPP_DEAD);
} else {
ppp_change_phase(ctx, PPP_TERMINATE);
}
}

ppp_fsm_close(&ctx->lcp.fsm, reason);
Expand Down