mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-06 18:04:03 +00:00
Merge pull request #8938 from volta-networks/fix_no_path_retries
pathd : Better RFC complain for two cases, no_path answer and srp_id handle
This commit is contained in:
commit
40eb7a27c1
@ -332,6 +332,7 @@ int path_pcep_config_initiate_path(struct path *path)
|
|||||||
candidate = srte_candidate_add(
|
candidate = srte_candidate_add(
|
||||||
policy, path->nbkey.preference,
|
policy, path->nbkey.preference,
|
||||||
SRTE_ORIGIN_PCEP, path->originator);
|
SRTE_ORIGIN_PCEP, path->originator);
|
||||||
|
candidate->policy->srp_id = path->srp_id;
|
||||||
strlcpy(candidate->name, path->name,
|
strlcpy(candidate->name, path->name,
|
||||||
sizeof(candidate->name));
|
sizeof(candidate->name));
|
||||||
SET_FLAG(candidate->flags, F_CANDIDATE_NEW);
|
SET_FLAG(candidate->flags, F_CANDIDATE_NEW);
|
||||||
@ -387,6 +388,7 @@ int path_pcep_config_update_path(struct path *path)
|
|||||||
if (!candidate)
|
if (!candidate)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
candidate->policy->srp_id = path->srp_id;
|
||||||
// first clean up old segment list if present
|
// first clean up old segment list if present
|
||||||
if (candidate->lsp->segment_list) {
|
if (candidate->lsp->segment_list) {
|
||||||
SET_FLAG(candidate->lsp->segment_list->flags,
|
SET_FLAG(candidate->lsp->segment_list->flags,
|
||||||
|
@ -128,6 +128,8 @@ static struct req_entry *push_new_req(struct pcc_state *pcc_state,
|
|||||||
struct path *path);
|
struct path *path);
|
||||||
static void repush_req(struct pcc_state *pcc_state, struct req_entry *req);
|
static void repush_req(struct pcc_state *pcc_state, struct req_entry *req);
|
||||||
static struct req_entry *pop_req(struct pcc_state *pcc_state, uint32_t reqid);
|
static struct req_entry *pop_req(struct pcc_state *pcc_state, uint32_t reqid);
|
||||||
|
static struct req_entry *pop_req_no_reqid(struct pcc_state *pcc_state,
|
||||||
|
uint32_t reqid);
|
||||||
static bool add_reqid_mapping(struct pcc_state *pcc_state, struct path *path);
|
static bool add_reqid_mapping(struct pcc_state *pcc_state, struct path *path);
|
||||||
static void remove_reqid_mapping(struct pcc_state *pcc_state,
|
static void remove_reqid_mapping(struct pcc_state *pcc_state,
|
||||||
struct path *path);
|
struct path *path);
|
||||||
@ -558,7 +560,6 @@ void pcep_pcc_send_report(struct ctrl_state *ctrl_state,
|
|||||||
if (is_stable && (real_status != PCEP_LSP_OPERATIONAL_DOWN)) {
|
if (is_stable && (real_status != PCEP_LSP_OPERATIONAL_DOWN)) {
|
||||||
PCEP_DEBUG("(%s)%s Send report for candidate path (!DOWN) %s",
|
PCEP_DEBUG("(%s)%s Send report for candidate path (!DOWN) %s",
|
||||||
__func__, pcc_state->tag, path->name);
|
__func__, pcc_state->tag, path->name);
|
||||||
path->srp_id = 0;
|
|
||||||
path->status = real_status;
|
path->status = real_status;
|
||||||
send_report(pcc_state, path);
|
send_report(pcc_state, path);
|
||||||
}
|
}
|
||||||
@ -1340,7 +1341,11 @@ void handle_pcep_comp_reply(struct ctrl_state *ctrl_state,
|
|||||||
struct path *path;
|
struct path *path;
|
||||||
|
|
||||||
path = pcep_lib_parse_path(msg);
|
path = pcep_lib_parse_path(msg);
|
||||||
req = pop_req(pcc_state, path->req_id);
|
if (path->no_path) {
|
||||||
|
req = pop_req_no_reqid(pcc_state, path->req_id);
|
||||||
|
} else {
|
||||||
|
req = pop_req(pcc_state, path->req_id);
|
||||||
|
}
|
||||||
if (req == NULL) {
|
if (req == NULL) {
|
||||||
/* TODO: check the rate of bad computation reply and close
|
/* TODO: check the rate of bad computation reply and close
|
||||||
* the connection if more that a given rate.
|
* the connection if more that a given rate.
|
||||||
@ -1372,6 +1377,9 @@ void handle_pcep_comp_reply(struct ctrl_state *ctrl_state,
|
|||||||
if (path->no_path) {
|
if (path->no_path) {
|
||||||
PCEP_DEBUG("%s Computation for path %s did not find any result",
|
PCEP_DEBUG("%s Computation for path %s did not find any result",
|
||||||
pcc_state->tag, path->name);
|
pcc_state->tag, path->name);
|
||||||
|
free_req_entry(req);
|
||||||
|
pcep_free_path(path);
|
||||||
|
return;
|
||||||
} else if (validate_incoming_path(pcc_state, path, err, sizeof(err))) {
|
} else if (validate_incoming_path(pcc_state, path, err, sizeof(err))) {
|
||||||
/* Updating a dynamic path will automatically delegate it */
|
/* Updating a dynamic path will automatically delegate it */
|
||||||
pcep_thread_update_path(ctrl_state, pcc_state->id, path);
|
pcep_thread_update_path(ctrl_state, pcc_state->id, path);
|
||||||
@ -1847,6 +1855,20 @@ struct req_entry *pop_req(struct pcc_state *pcc_state, uint32_t reqid)
|
|||||||
return req;
|
return req;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct req_entry *pop_req_no_reqid(struct pcc_state *pcc_state, uint32_t reqid)
|
||||||
|
{
|
||||||
|
struct path path = {.req_id = reqid};
|
||||||
|
struct req_entry key = {.path = &path};
|
||||||
|
struct req_entry *req;
|
||||||
|
|
||||||
|
req = RB_FIND(req_entry_head, &pcc_state->requests, &key);
|
||||||
|
if (req == NULL)
|
||||||
|
return NULL;
|
||||||
|
RB_REMOVE(req_entry_head, &pcc_state->requests, req);
|
||||||
|
|
||||||
|
return req;
|
||||||
|
}
|
||||||
|
|
||||||
bool add_reqid_mapping(struct pcc_state *pcc_state, struct path *path)
|
bool add_reqid_mapping(struct pcc_state *pcc_state, struct path *path)
|
||||||
{
|
{
|
||||||
struct req_map_data *mapping;
|
struct req_map_data *mapping;
|
||||||
@ -1883,6 +1905,33 @@ uint32_t lookup_reqid(struct pcc_state *pcc_state, struct path *path)
|
|||||||
|
|
||||||
bool has_pending_req_for(struct pcc_state *pcc_state, struct path *path)
|
bool has_pending_req_for(struct pcc_state *pcc_state, struct path *path)
|
||||||
{
|
{
|
||||||
|
struct req_entry key = {.path = path};
|
||||||
|
struct req_entry *req;
|
||||||
|
|
||||||
|
|
||||||
|
PCEP_DEBUG_PATH("(%s) %s", format_path(path), __func__);
|
||||||
|
/* Looking for request without result */
|
||||||
|
if (path->no_path || !path->first_hop) {
|
||||||
|
PCEP_DEBUG_PATH("%s Path : no_path|!first_hop", __func__);
|
||||||
|
/* ...and already was handle */
|
||||||
|
req = RB_FIND(req_entry_head, &pcc_state->requests, &key);
|
||||||
|
if (!req) {
|
||||||
|
/* we must purge remaining reqid */
|
||||||
|
PCEP_DEBUG_PATH("%s Purge pending reqid: no_path(%s)",
|
||||||
|
__func__,
|
||||||
|
path->no_path ? "TRUE" : "FALSE");
|
||||||
|
if (lookup_reqid(pcc_state, path) != 0) {
|
||||||
|
PCEP_DEBUG_PATH("%s Purge pending reqid: DONE ",
|
||||||
|
__func__);
|
||||||
|
remove_reqid_mapping(pcc_state, path);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return lookup_reqid(pcc_state, path) != 0;
|
return lookup_reqid(pcc_state, path) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user