Skip to content

Commit

Permalink
pathd: pcep module: prevent any possible disconnection race leading t…
Browse files Browse the repository at this point in the history
…o NULL sessions
  • Loading branch information
sylane authored and Brady Johnson committed Jul 6, 2020
1 parent 45e5197 commit 20d5851
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions pathd/path_pcep_pcc.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,11 +387,9 @@ int pcep_pcc_disable(struct ctrl_state *ctrl_state, struct pcc_state *pcc_state)
void pcep_pcc_sync_path(struct ctrl_state *ctrl_state,
struct pcc_state *pcc_state, struct path *path)
{
if (pcc_state->status == PCEP_PCC_DISCONNECTED)
if (pcc_state->status != PCEP_PCC_SYNCHRONIZING)
return;

assert(pcc_state->status == PCEP_PCC_SYNCHRONIZING);

path->is_synching = true;
path->go_active = true;

Expand Down Expand Up @@ -428,7 +426,7 @@ void pcep_pcc_sync_done(struct ctrl_state *ctrl_state,
{
struct req_entry *req;

if (pcc_state->status == PCEP_PCC_DISCONNECTED)
if (pcc_state->status != PCEP_PCC_SYNCHRONIZING)
return;

if (pcc_state->caps.is_stateful) {
Expand Down Expand Up @@ -464,6 +462,9 @@ void pcep_pcc_send_report(struct ctrl_state *ctrl_state,
struct pcc_state *pcc_state,
struct path *path)
{
if (pcc_state->status != PCEP_PCC_OPERATING)
return;

if (pcc_state->caps.is_stateful) {
PCEP_DEBUG("%s Send report for candidate path %s",
pcc_state->tag, path->name);
Expand All @@ -480,7 +481,7 @@ void pcep_pcc_pathd_event_handler(struct ctrl_state *ctrl_state,
{
struct req_entry* req;

if (!pcc_state->synchronized)
if (pcc_state->status != PCEP_PCC_OPERATING)
return;

/* Skipping candidate path with endpoint that do not match the
Expand Down Expand Up @@ -586,6 +587,9 @@ void handle_pcep_open(struct ctrl_state *ctrl_state,
void handle_pcep_message(struct ctrl_state *ctrl_state,
struct pcc_state *pcc_state, struct pcep_message *msg)
{
if (pcc_state->status != PCEP_PCC_OPERATING)
return;

switch (msg->msg_header->type) {
case PCEP_TYPE_INITIATE:
handle_pcep_lsp_initiate(ctrl_state, pcc_state, msg);
Expand Down

0 comments on commit 20d5851

Please sign in to comment.