Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reject unsupported PcInitate PCEP messages #12

Merged
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
5 changes: 5 additions & 0 deletions pathd/path_pcep_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,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