diff options
author | Olivier Dugeon <olivier.dugeon@orange.com> | 2020-08-26 17:27:16 +0200 |
---|---|---|
committer | Olivier Dugeon <olivier.dugeon@orange.com> | 2020-08-26 17:27:16 +0200 |
commit | 83df36e845070aa18fa31344c0240c6552ffbc2a (patch) | |
tree | 3df6e8a4729d366641c6898560c9cc8e9364020a /ospfd/ospf_sr.c | |
parent | OSPFd: Correct Extended Prefix flooding for SR (diff) | |
download | frr-83df36e845070aa18fa31344c0240c6552ffbc2a.tar.xz frr-83df36e845070aa18fa31344c0240c6552ffbc2a.zip |
ospfd: Coverity corrections
Following PR #6726, Coverity Scan detected some new errors in the OSPF Segment
Routing code. This patch corrects them.
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Diffstat (limited to 'ospfd/ospf_sr.c')
-rw-r--r-- | ospfd/ospf_sr.c | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/ospfd/ospf_sr.c b/ospfd/ospf_sr.c index f6a190db8..eb882c5d0 100644 --- a/ospfd/ospf_sr.c +++ b/ospfd/ospf_sr.c @@ -2074,13 +2074,17 @@ static int update_srgb(uint32_t lower, uint32_t size) osr_debug("SR(%s): Got new SRGB [%u/%u]", __func__, OspfSR.srgb.start, OspfSR.srgb.start + OspfSR.srgb.size - 1); - /* SRGB is reserved, set Router Information parameters */ - ospf_router_info_update_sr(true, OspfSR.self); + /* Update Self SR-Node */ + if (OspfSR.self != NULL) { + /* SRGB is reserved, set Router Information parameters */ + ospf_router_info_update_sr(true, OspfSR.self); - /* and update NHLFE entries */ - hash_iterate(OspfSR.neighbors, - (void (*)(struct hash_bucket *, void *))update_in_nhlfe, - NULL); + /* and update NHLFE entries */ + hash_iterate( + OspfSR.neighbors, + (void (*)(struct hash_bucket *, void *))update_in_nhlfe, + NULL); + } return 0; } @@ -2198,9 +2202,11 @@ DEFUN (sr_local_label_range, } /* SRLB is reserved, Update Self SR-Node and Router Information LSA */ - OspfSR.self->srlb.lower_bound = lower; - OspfSR.self->srlb.range_size = upper - lower + 1; - ospf_router_info_update_sr(true, OspfSR.self); + if (OspfSR.self != NULL) { + OspfSR.self->srlb.lower_bound = lower; + OspfSR.self->srlb.range_size = upper - lower + 1; + ospf_router_info_update_sr(true, OspfSR.self); + } /* and update (LAN)-Adjacency SID */ ospf_ext_link_srlb_update(); @@ -2250,8 +2256,8 @@ DEFUN (no_sr_local_label_range, if (OspfSR.self != NULL) { OspfSR.self->srlb.lower_bound = DEFAULT_SRLB_LABEL; OspfSR.self->srlb.range_size = DEFAULT_SRLB_SIZE; + ospf_router_info_update_sr(true, OspfSR.self); } - ospf_router_info_update_sr(true, OspfSR.self); /* and update (LAN)-Adjacency SID */ ospf_ext_link_srlb_update(); @@ -2287,12 +2293,13 @@ DEFUN (sr_node_msd, /* Set this router MSD */ OspfSR.msd = msd; - if (OspfSR.self != NULL) + if (OspfSR.self != NULL) { OspfSR.self->msd = msd; - /* Set Router Information parameters if SR is UP */ - if (OspfSR.status == SR_UP) - ospf_router_info_update_sr(true, OspfSR.self); + /* Set Router Information parameters if SR is UP */ + if (OspfSR.status == SR_UP) + ospf_router_info_update_sr(true, OspfSR.self); + } return CMD_SUCCESS; } @@ -2311,12 +2318,13 @@ DEFUN (no_sr_node_msd, /* unset this router MSD */ OspfSR.msd = 0; - if (OspfSR.self != NULL) + if (OspfSR.self != NULL) { OspfSR.self->msd = 0; - /* Set Router Information parameters if SR is UP */ - if (OspfSR.status == SR_UP) - ospf_router_info_update_sr(true, OspfSR.self); + /* Set Router Information parameters if SR is UP */ + if (OspfSR.status == SR_UP) + ospf_router_info_update_sr(true, OspfSR.self); + } return CMD_SUCCESS; } |