diff options
Diffstat (limited to 'pathd/path_pcep_config.c')
| -rw-r--r-- | pathd/path_pcep_config.c | 87 |
1 files changed, 55 insertions, 32 deletions
diff --git a/pathd/path_pcep_config.c b/pathd/path_pcep_config.c index aacbca4ae9..609f091559 100644 --- a/pathd/path_pcep_config.c +++ b/pathd/path_pcep_config.c @@ -246,6 +246,10 @@ path_pcep_config_list_path_hops(struct srte_segment_list *segment_list) switch (segment->nai_type) { case SRTE_SEGMENT_NAI_TYPE_IPV4_NODE: case SRTE_SEGMENT_NAI_TYPE_IPV6_NODE: + case SRTE_SEGMENT_NAI_TYPE_IPV4_LOCAL_IFACE: + case SRTE_SEGMENT_NAI_TYPE_IPV6_LOCAL_IFACE: + case SRTE_SEGMENT_NAI_TYPE_IPV4_ALGORITHM: + case SRTE_SEGMENT_NAI_TYPE_IPV6_ALGORITHM: memcpy(&hop->nai.local_addr, &segment->nai_local_addr, sizeof(struct ipaddr)); break; @@ -278,6 +282,7 @@ int path_pcep_config_update_path(struct path *path) assert(path->nbkey.preference != 0); assert(path->nbkey.endpoint.ipa_type == IPADDR_V4); + int number_of_sid_clashed = 0; struct path_hop *hop; struct path_metric *metric; int index; @@ -297,40 +302,44 @@ int path_pcep_config_update_path(struct path *path) if (candidate->lsp->segment_list) { SET_FLAG(candidate->lsp->segment_list->flags, F_SEGMENT_LIST_DELETED); + srte_segment_list_del(candidate->lsp->segment_list); candidate->lsp->segment_list = NULL; } - if (path->first_hop != NULL) { - snprintf(segment_list_name_buff, sizeof(segment_list_name_buff), - "%s-%u", path->name, path->plsp_id); - segment_list_name = segment_list_name_buff; - - segment_list = srte_segment_list_add(segment_list_name); - segment_list->protocol_origin = path->update_origin; - strlcpy(segment_list->originator, path->originator, - sizeof(segment_list->originator)); - SET_FLAG(segment_list->flags, F_SEGMENT_LIST_NEW); - SET_FLAG(segment_list->flags, F_SEGMENT_LIST_MODIFIED); - - for (hop = path->first_hop, index = 10; hop != NULL; - hop = hop->next, index += 10) { - assert(hop->has_sid); - assert(hop->is_mpls); - - segment = srte_segment_entry_add(segment_list, index); - - segment->sid_value = (mpls_label_t)hop->sid.mpls.label; - SET_FLAG(segment->segment_list->flags, - F_SEGMENT_LIST_MODIFIED); - - if (hop->has_nai) - srte_segment_entry_set_nai( - segment, srte_nai_type(hop->nai.type), - &hop->nai.local_addr, - hop->nai.local_iface, - &hop->nai.remote_addr, - hop->nai.remote_iface); - } + if (path->first_hop == NULL) + return PATH_NB_ERR; + + snprintf(segment_list_name_buff, sizeof(segment_list_name_buff), + "%s-%u", path->name, path->plsp_id); + segment_list_name = segment_list_name_buff; + + segment_list = srte_segment_list_add(segment_list_name); + segment_list->protocol_origin = path->update_origin; + strlcpy(segment_list->originator, path->originator, + sizeof(segment_list->originator)); + SET_FLAG(segment_list->flags, F_SEGMENT_LIST_NEW); + SET_FLAG(segment_list->flags, F_SEGMENT_LIST_MODIFIED); + + for (hop = path->first_hop, index = 10; hop != NULL; + hop = hop->next, index += 10) { + assert(hop->has_sid); + assert(hop->is_mpls); + + segment = srte_segment_entry_add(segment_list, index); + + segment->sid_value = (mpls_label_t)hop->sid.mpls.label; + SET_FLAG(segment->segment_list->flags, F_SEGMENT_LIST_MODIFIED); + + if (!hop->has_nai) + continue; + if (srte_segment_entry_set_nai( + segment, srte_nai_type(hop->nai.type), + &hop->nai.local_addr, hop->nai.local_iface, + &hop->nai.remote_addr, hop->nai.remote_iface, 0, 0) + == PATH_SID_ERROR) + /* TED queries don't match PCE */ + /* Don't apply srte,zebra changes */ + number_of_sid_clashed++; } candidate->lsp->segment_list = segment_list; @@ -352,7 +361,11 @@ int path_pcep_config_update_path(struct path *path) candidate->lsp->objfun = path->pce_objfun; } - srte_apply_changes(); + if (number_of_sid_clashed) + SET_FLAG(segment->segment_list->flags, + F_SEGMENT_LIST_SID_CONFLICT); + else + srte_apply_changes(); return 0; } @@ -402,6 +415,16 @@ enum pcep_sr_subobj_nai pcep_nai_type(enum srte_segment_nai_type type) return PCEP_SR_SUBOBJ_NAI_IPV6_ADJACENCY; case SRTE_SEGMENT_NAI_TYPE_IPV4_UNNUMBERED_ADJACENCY: return PCEP_SR_SUBOBJ_NAI_UNNUMBERED_IPV4_ADJACENCY; + case SRTE_SEGMENT_NAI_TYPE_IPV6_ADJACENCY_LINK_LOCAL_ADDRESSES: + return PCEP_SR_SUBOBJ_NAI_LINK_LOCAL_IPV6_ADJACENCY; + case SRTE_SEGMENT_NAI_TYPE_IPV4_LOCAL_IFACE: + return PCEP_SR_SUBOBJ_NAI_IPV4_NODE; + case SRTE_SEGMENT_NAI_TYPE_IPV6_LOCAL_IFACE: + return PCEP_SR_SUBOBJ_NAI_IPV6_NODE; + case SRTE_SEGMENT_NAI_TYPE_IPV4_ALGORITHM: + return PCEP_SR_SUBOBJ_NAI_IPV4_NODE; + case SRTE_SEGMENT_NAI_TYPE_IPV6_ALGORITHM: + return PCEP_SR_SUBOBJ_NAI_IPV6_NODE; default: return PCEP_SR_SUBOBJ_NAI_UNKNOWN; } |
