diff options
author | Olivier Dugeon <olivier.dugeon@orange.com> | 2021-02-12 18:47:36 +0100 |
---|---|---|
committer | Olivier Dugeon <olivier.dugeon@orange.com> | 2021-03-23 15:39:29 +0100 |
commit | 50ec09db3951d04359d7a447d683ed6808da4c65 (patch) | |
tree | 4398e1a9c534a923db0d72258fd6af84504ba976 /ospfd | |
parent | lib: Update Link State Database (diff) | |
download | frr-50ec09db3951d04359d7a447d683ed6808da4c65.tar.xz frr-50ec09db3951d04359d7a447d683ed6808da4c65.zip |
opsfd: Correct MPLS-TE bug with LSA Flush
When an interface goes down, if it is MPLS-TE enabled, the corresponding
TE Opaque LSA is not flushed and continue to be advertised.
The problem is due to bugs in ISM and NSM handler functions of ospf_te.c file:
- ospf_mpls_te_ism_change():
- flag associated with Link Parameters is reset
- ISM_Down state is not correctly handle
- ospf_mpls_te_nsm_change():
- flag associated with Link Parameters is reset
- NSM_Down and NSM_Delete states are not handle
This patch correct this problem.
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Diffstat (limited to 'ospfd')
-rw-r--r-- | ospfd/ospf_te.c | 46 |
1 files changed, 33 insertions, 13 deletions
diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c index f4e7cda60..6901771d9 100644 --- a/ospfd/ospf_te.c +++ b/ospfd/ospf_te.c @@ -939,9 +939,6 @@ static void ospf_mpls_te_ism_change(struct ospf_interface *oi, int old_state) /* Keep Area information in combination with linkparams. */ lp->area = oi->area; - /* Keep interface MPLS-TE status */ - lp->flags = HAS_LINK_PARAMS(oi->ifp); - switch (oi->state) { case ISM_PointToPoint: case ISM_DROther: @@ -952,10 +949,17 @@ static void ospf_mpls_te_ism_change(struct ospf_interface *oi, int old_state) set_linkparams_lclif_ipaddr(lp, oi->address->u.prefix4); break; - default: - /* State is undefined: Flush LSA if engaged */ - if (CHECK_FLAG(lp->flags, LPFLG_LSA_ENGAGED)) + case ISM_Down: + /* Interface goes Down: Flush LSA if engaged */ + if (CHECK_FLAG(lp->flags, LPFLG_LSA_ENGAGED)) { + ote_debug( + "MPLS-TE (%s): Interface %s goes down: flush LSA", + __func__, IF_NAME(oi)); ospf_mpls_te_lsa_schedule(lp, FLUSH_THIS_LSA); + return; + } + break; + default: break; } @@ -997,12 +1001,21 @@ static void ospf_mpls_te_nsm_change(struct ospf_neighbor *nbr, int old_state) return; } + /* Flush TE Opaque LSA if Neighbor State goes Down or Deleted */ + if (OspfMplsTE.enabled + && (nbr->state == NSM_Down || nbr->state == NSM_Deleted)) { + if (CHECK_FLAG(lp->flags, EXT_LPFLG_LSA_ENGAGED)) { + ote_debug( + "MPLS-TE (%s): Interface %s goes down: flush LSA", + __func__, IF_NAME(oi)); + ospf_mpls_te_lsa_schedule(lp, FLUSH_THIS_LSA); + } + return; + } + /* Keep Area information in combination with SR info. */ lp->area = oi->area; - /* Keep interface MPLS-TE status */ - lp->flags = HAS_LINK_PARAMS(oi->ifp); - /* * The Link ID is identical to the contents of the Link ID field * in the Router LSA for these link types. @@ -1022,12 +1035,19 @@ static void ospf_mpls_te_nsm_change(struct ospf_neighbor *nbr, int old_state) set_linkparams_link_id(lp, DR(oi)); break; - default: - /* State is undefined: Flush LSA if engaged */ + case ISM_Down: + /* State goes Down: Flush LSA if engaged */ if (OspfMplsTE.enabled && - CHECK_FLAG(lp->flags, LPFLG_LSA_ENGAGED)) + CHECK_FLAG(lp->flags, LPFLG_LSA_ENGAGED)) { + ote_debug( + "MPLS-TE (%s): Interface %s goes down: flush LSA", + __func__, IF_NAME(oi)); ospf_mpls_te_lsa_schedule(lp, FLUSH_THIS_LSA); + } return; + break; + default: + break; } ote_debug("MPLS-TE (%s): Add Link-ID %pI4 for interface %s ", __func__, @@ -1173,7 +1193,7 @@ static struct ospf_lsa *ospf_mpls_te_lsa_new(struct ospf *ospf, } ote_debug( - "MPLS-TE (%s): LSA[Type%d:%pI4]: Create an Opaque-LSA/MPLS-TE instance", + "MPLS-TE (%s): LSA[Type%d:%pI4]: Create an Opaque-LSA/MPLS-TE instance", __func__, lsa_type, &lsa_id); /* Set opaque-LSA body fields. */ |