Skip to content

Commit

Permalink
Merge pull request #12 from opensourcerouting/pathd-pcep-release-20.2…
Browse files Browse the repository at this point in the history
…-pc-initiate-fix

Reject unsupported PcInitate PCEP messages
  • Loading branch information
bradyallenjohnson authored May 13, 2020
2 parents 64d5608 + f893804 commit 25e635b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pathd/path_pcep_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ struct pcep_message *pcep_lib_format_request(uint32_t reqid, struct ipaddr *src,
}
}

struct pcep_message *pcep_lib_reject_message(int error_type, int error_value)
{
return pcep_msg_create_error(error_type, error_value);
}

struct path *pcep_lib_parse_path(struct pcep_message *msg)
{
struct path *path;
Expand Down
1 change: 1 addition & 0 deletions pathd/path_pcep_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ void pcep_lib_disconnect(pcep_session *sess);
struct pcep_message *pcep_lib_format_report(struct path *path);
struct pcep_message *pcep_lib_format_request(uint32_t reqid, struct ipaddr *src,
struct ipaddr *dst);
struct pcep_message *pcep_lib_reject_message(int error_type, int error_value);
struct path *pcep_lib_parse_path(struct pcep_message *msg);
void pcep_lib_parse_capabilities(struct pcep_message *msg,
struct pcep_caps *caps);
Expand Down
9 changes: 9 additions & 0 deletions pathd/path_pcep_pcc.c
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,17 @@ void handle_pcep_lsp_initiate(struct ctrl_state *ctrl_state,
struct pcc_state *pcc_state,
struct pcep_message *msg)
{
struct pcep_message *error;

PCEP_DEBUG("%s Received LSP initiate, not supported yet",
pcc_state->tag);

/* TODO when we support both PCC and PCE initiated sessions,
* we should first check the session type before
* rejecting this message. */
error = pcep_lib_reject_message(PCEP_ERRT_INVALID_OPERATION,
PCEP_ERRV_LSP_NOT_PCE_INITIATED);
send_pcep_message(ctrl_state, pcc_state, error);
}

void handle_pcep_comp_reply(struct ctrl_state *ctrl_state,
Expand Down

0 comments on commit 25e635b

Please sign in to comment.