summaryrefslogtreecommitdiffstats
path: root/ospfd
diff options
context:
space:
mode:
authorOlivier Dugeon <olivier.dugeon@orange.com>2021-03-09 11:00:32 +0100
committerOlivier Dugeon <olivier.dugeon@orange.com>2021-03-09 11:14:32 +0100
commit270e66a2ceaeca0e6e3fde0150c36e2252de641f (patch)
treec2ebe5567287791e4e2c301e107b6f98da9dad11 /ospfd
parentMerge pull request #8180 from kuldeepkash/topojson_framework (diff)
downloadfrr-270e66a2ceaeca0e6e3fde0150c36e2252de641f.tar.xz
frr-270e66a2ceaeca0e6e3fde0150c36e2252de641f.zip
ospfd: Correct Segment Routing prefix bugs
This patch solves 2 Segment Routing prefix bugs: - If Segment Routing is not enabled in the initial configuration, Extended Prefix Opaque LSA is not flood. This is due to a control flag which is set only when Segment Routing is enabled at startup and not latter. - Attempting to modify Segment Routing prefix flag e.g. adding or removing no-php or explicit-null flag, doesn't work as expected: Corresponding entry in the MPLS table is not updated, Extended Prefix Opaque LSA carry wrong flag value, and neighbor set a wrong configuration in the MPLS table for this Segment Routing prefix. The first bug is corrected in ospfd/ospf_ext.c: - Flag setting is moved from ospf_ext_ism_change() to set_ext_prefix() function The seconf one is corrected in ospfd/ospf_sr.c: - For self node, previous MPLS entry is removed if needed and flag reset before setting the new Segment Routing prefix configuration - For neighbor node, srnext field of sr_prefix structure is always set and not only for new SR Prefix. Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Diffstat (limited to 'ospfd')
-rw-r--r--ospfd/ospf_ext.c3
-rw-r--r--ospfd/ospf_sr.c26
-rw-r--r--ospfd/ospf_zebra.c2
3 files changed, 23 insertions, 8 deletions
diff --git a/ospfd/ospf_ext.c b/ospfd/ospf_ext.c
index 4fa61221a..754e2bcba 100644
--- a/ospfd/ospf_ext.c
+++ b/ospfd/ospf_ext.c
@@ -301,6 +301,8 @@ static void set_ext_prefix(struct ext_itf *exti, uint8_t route_type,
exti->prefix.af = 0;
exti->prefix.pref_length = p.prefixlen;
exti->prefix.address = p.prefix;
+
+ SET_FLAG(exti->flags, EXT_LPFLG_LSA_ACTIVE);
}
/* Extended Link TLV - RFC7684 section 3.1 */
@@ -766,7 +768,6 @@ static void ospf_ext_ism_change(struct ospf_interface *oi, int old_status)
if (OspfEXT.enabled) {
osr_debug("EXT (%s): Set Prefix SID to interface %s ",
__func__, oi->ifp->name);
- exti->flags = EXT_LPFLG_LSA_ACTIVE;
ospf_sr_update_local_prefix(oi->ifp, oi->address);
}
} else {
diff --git a/ospfd/ospf_sr.c b/ospfd/ospf_sr.c
index 7b2d79421..a7a2e0363 100644
--- a/ospfd/ospf_sr.c
+++ b/ospfd/ospf_sr.c
@@ -1202,16 +1202,22 @@ static void update_ext_prefix_sid(struct sr_node *srn, struct sr_prefix *srp)
found ? "Update" : "Add", GET_OPAQUE_ID(srp->instance),
&srn->adv_router);
+ /* Complete SR-Prefix */
+ srp->srn = srn;
+ IPV4_ADDR_COPY(&srp->adv_router, &srn->adv_router);
+
/* if not found, add new Segment Prefix and install NHLFE */
if (!found) {
- /* Complete SR-Prefix and add it to SR-Node list */
- srp->srn = srn;
- IPV4_ADDR_COPY(&srp->adv_router, &srn->adv_router);
+ /* Add it to SR-Node list ... */
listnode_add(srn->ext_prefix, srp);
- /* Try to set MPLS table */
+ /* ... and try to set MPLS table */
if (compute_prefix_nhlfe(srp) == 1)
ospf_zebra_update_prefix_sid(srp);
} else {
+ /*
+ * An old SR prefix exist. Check if something changes or if it
+ * is just a refresh.
+ */
if (sr_prefix_cmp(pref, srp)) {
if (compute_prefix_nhlfe(srp) == 1) {
ospf_zebra_delete_prefix_sid(pref);
@@ -2462,10 +2468,18 @@ DEFUN (sr_prefix_sid,
new->type = LOCAL_SID;
}
+ /* First, remove old NHLFE if installed */
+ if (srp == new && CHECK_FLAG(srp->flags, EXT_SUBTLV_PREFIX_SID_NPFLG)
+ && !CHECK_FLAG(srp->flags, EXT_SUBTLV_PREFIX_SID_EFLG))
+ ospf_zebra_delete_prefix_sid(srp);
+ /* Then, reset Flag & labels to handle flag update */
+ new->flags = 0;
+ new->label_in = 0;
+ new->nhlfe.label_out = 0;
+
/* Set NO PHP flag if present and compute NHLFE */
if (argv_find(argv, argc, "no-php-flag", &idx)) {
SET_FLAG(new->flags, EXT_SUBTLV_PREFIX_SID_NPFLG);
- UNSET_FLAG(new->flags, EXT_SUBTLV_PREFIX_SID_EFLG);
new->label_in = index2label(new->sid, OspfSR.self->srgb);
new->nhlfe.label_out = MPLS_LABEL_IMPLICIT_NULL;
}
@@ -2505,7 +2519,7 @@ DEFUN (sr_prefix_sid,
if (srp != new)
listnode_add(OspfSR.self->ext_prefix, new);
- /* Install Prefix SID if SR is UP and a valid input label set */
+ /* Update Prefix SID if SR is UP */
if (OspfSR.status == SR_UP) {
if (CHECK_FLAG(new->flags, EXT_SUBTLV_PREFIX_SID_NPFLG)
&& !CHECK_FLAG(new->flags, EXT_SUBTLV_PREFIX_SID_EFLG))
diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c
index aaab27457..a2fbd01ab 100644
--- a/ospfd/ospf_zebra.c
+++ b/ospfd/ospf_zebra.c
@@ -622,7 +622,7 @@ void ospf_zebra_update_prefix_sid(const struct sr_prefix *srp)
znh->labels[0] = path->srni.label_out;
osr_debug(" |- labels %u/%u", srp->label_in,
- srp->nhlfe.label_out);
+ path->srni.label_out);
/* Set TI-LFA backup nexthop info if present */
if (path->srni.backup_label_stack) {