Skip to content

Commit

Permalink
Merge pull request #47 from opensourcerouting/pathd-pcep-zebra-crash
Browse files Browse the repository at this point in the history
zebra: ensure that installed srte policies have an output label
  • Loading branch information
rwestphal authored Jul 16, 2020
2 parents ee65a50 + 8b2bed9 commit 7a9efaa
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions zebra/zebra_srte.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ int zebra_sr_policy_bsid_install(struct zebra_sr_policy *policy)
frr_each_safe(nhlfe_list, &policy->lsp->nhlfe_list, nhlfe) {
uint8_t num_out_labels;
mpls_label_t *out_labels;
mpls_label_t null_label = MPLS_LABEL_IMPLICIT_NULL;

if (!CHECK_FLAG(nhlfe->flags, NHLFE_FLAG_SELECTED)
|| CHECK_FLAG(nhlfe->flags, NHLFE_FLAG_DELETED))
Expand All @@ -314,8 +315,13 @@ int zebra_sr_policy_bsid_install(struct zebra_sr_policy *policy)
*/
if (!nhlfe->nexthop->nh_label || !nhlfe->nexthop->nh_label->num_labels
|| nhlfe->nexthop->nh_label->label[0] == MPLS_LABEL_IMPLICIT_NULL) {
num_out_labels = zt->label_num - 1;
out_labels = &zt->labels[1];
if (zt->label_num > 1) {
num_out_labels = zt->label_num - 1;
out_labels = &zt->labels[1];
} else {
num_out_labels = 1;
out_labels = &null_label;
}
} else {
num_out_labels = zt->label_num;
out_labels = zt->labels;
Expand Down

0 comments on commit 7a9efaa

Please sign in to comment.