X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ospfd%2Fospf_sr.c;h=43842e414e007e9fe5bd4d659d9c8ab8da94ca75;hb=91d227b7e3cb53ad8fdbcd9d4cff7f0a666918e3;hp=17aa10ba061ceeba05c32a89e50d86dc9b85965c;hpb=fc6eb7d827d7373a89dd04c1d809059e9ef79f9e;p=mirror_frr.git diff --git a/ospfd/ospf_sr.c b/ospfd/ospf_sr.c index 17aa10ba0..43842e414 100644 --- a/ospfd/ospf_sr.c +++ b/ospfd/ospf_sr.c @@ -94,7 +94,7 @@ static unsigned int sr_hash(void *p) } /* Compare 2 Router ID hash entries based on SR Node */ -static int sr_cmp(const void *p1, const void *p2) +static bool sr_cmp(const void *p1, const void *p2) { const struct sr_node *srn = p1; const struct in_addr *rid = p2; @@ -165,10 +165,10 @@ static void sr_node_del(struct sr_node *srn) return; /* Clean Extended Link */ - list_delete_and_null(&srn->ext_link); + list_delete(&srn->ext_link); /* Clean Prefix List */ - list_delete_and_null(&srn->ext_prefix); + list_delete(&srn->ext_prefix); XFREE(MTYPE_OSPF_SR_PARAMS, srn); } @@ -283,7 +283,7 @@ static void ospf_sr_stop(void) /* * Remove all SR Nodes from the Hash table. Prefix and Link SID will - * be remove though list_delete_and_null() call. See sr_node_del() + * be remove though list_delete() call. See sr_node_del() */ hash_clean(OspfSR.neighbors, (void *)sr_node_del); } @@ -821,7 +821,7 @@ static struct sr_prefix *get_ext_prefix_sid(struct tlv_header *tlvh) case EXT_SUBTLV_PREFIX_SID: psid = (struct ext_subtlv_prefix_sid *)sub_tlvh; if (psid->algorithm != SR_ALGORITHM_SPF) { - flog_err(OSPF_ERR_INVALID_ALGORITHM, + flog_err(EC_OSPF_INVALID_ALGORITHM, "SR (%s): Unsupported Algorithm", __func__); XFREE(MTYPE_OSPF_SR_PARAMS, srp); @@ -1102,7 +1102,7 @@ void ospf_sr_ri_lsa_update(struct ospf_lsa *lsa) return; if (OspfSR.neighbors == NULL) { - flog_err(OSPF_ERR_SR_INVALID_DB, + flog_err(EC_OSPF_SR_INVALID_DB, "SR (%s): Abort! no valid SR DataBase", __func__); return; } @@ -1113,18 +1113,18 @@ void ospf_sr_ri_lsa_update(struct ospf_lsa *lsa) /* Sanity check */ if (srn == NULL) { - flog_err(OSPF_ERR_SR_NODE_CREATE, - "SR (%s): Abort! can't create SR node in hash table", - __func__); + flog_err(EC_OSPF_SR_NODE_CREATE, + "SR (%s): Abort! can't create SR node in hash table", + __func__); return; } if ((srn->instance != 0) && (srn->instance != ntohl(lsah->id.s_addr))) { - flog_err(OSPF_ERR_SR_INVALID_LSA_ID, - "SR (%s): Abort! Wrong " - "LSA ID 4.0.0.%u for SR node %s/%u", - __func__, GET_OPAQUE_ID(ntohl(lsah->id.s_addr)), - inet_ntoa(lsah->adv_router), srn->instance); + flog_err(EC_OSPF_SR_INVALID_LSA_ID, + "SR (%s): Abort! Wrong " + "LSA ID 4.0.0.%u for SR node %s/%u", + __func__, GET_OPAQUE_ID(ntohl(lsah->id.s_addr)), + inet_ntoa(lsah->adv_router), srn->instance); return; } @@ -1167,7 +1167,7 @@ void ospf_sr_ri_lsa_update(struct ospf_lsa *lsa) /* Check that we collect mandatory parameters */ if (srn->algo[0] == SR_ALGORITHM_UNSET || srgb.range_size == 0 || srgb.lower_bound == 0) { - flog_err(OSPF_ERR_SR_NODE_CREATE, + flog_err(EC_OSPF_SR_NODE_CREATE, "SR (%s): Missing mandatory parameters. Abort!", __func__); hash_release(OspfSR.neighbors, &(srn->adv_router)); @@ -1214,7 +1214,7 @@ void ospf_sr_ri_lsa_delete(struct ospf_lsa *lsa) /* Sanity check */ if (OspfSR.neighbors == NULL) { - flog_err(OSPF_ERR_SR_INVALID_DB, + flog_err(EC_OSPF_SR_INVALID_DB, "SR (%s): Abort! no valid SR Data Base", __func__); return; } @@ -1224,18 +1224,17 @@ void ospf_sr_ri_lsa_delete(struct ospf_lsa *lsa) /* Sanity check */ if (srn == NULL) { - flog_err(OSPF_ERR_SR_NODE_CREATE, - "SR (%s): Abort! no entry in SRDB for SR Node %s", - __func__, inet_ntoa(lsah->adv_router)); + flog_err(EC_OSPF_SR_NODE_CREATE, + "SR (%s): Abort! no entry in SRDB for SR Node %s", + __func__, inet_ntoa(lsah->adv_router)); return; } if ((srn->instance != 0) && (srn->instance != ntohl(lsah->id.s_addr))) { - flog_err( - OSPF_ERR_SR_INVALID_LSA_ID, - "SR (%s): Abort! Wrong LSA ID 4.0.0.%u for SR node %s", - __func__, GET_OPAQUE_ID(ntohl(lsah->id.s_addr)), - inet_ntoa(lsah->adv_router)); + flog_err(EC_OSPF_SR_INVALID_LSA_ID, + "SR (%s): Abort! Wrong LSA ID 4.0.0.%u for SR node %s", + __func__, GET_OPAQUE_ID(ntohl(lsah->id.s_addr)), + inet_ntoa(lsah->adv_router)); return; } @@ -1261,7 +1260,7 @@ void ospf_sr_ext_link_lsa_update(struct ospf_lsa *lsa) /* Sanity check */ if (OspfSR.neighbors == NULL) { - flog_err(OSPF_ERR_SR_INVALID_DB, + flog_err(EC_OSPF_SR_INVALID_DB, "SR (%s): Abort! no valid SR DataBase", __func__); return; } @@ -1273,9 +1272,9 @@ void ospf_sr_ext_link_lsa_update(struct ospf_lsa *lsa) /* Sanity check */ if (srn == NULL) { - flog_err(OSPF_ERR_SR_NODE_CREATE, - "SR (%s): Abort! can't create SR node in hash table", - __func__); + flog_err(EC_OSPF_SR_NODE_CREATE, + "SR (%s): Abort! can't create SR node in hash table", + __func__); return; } @@ -1313,7 +1312,7 @@ void ospf_sr_ext_link_lsa_delete(struct ospf_lsa *lsa) /* Sanity check */ if (OspfSR.neighbors == NULL) { - flog_err(OSPF_ERR_SR_INVALID_DB, + flog_err(EC_OSPF_SR_INVALID_DB, "SR (%s): Abort! no valid SR DataBase", __func__); return; } @@ -1327,7 +1326,7 @@ void ospf_sr_ext_link_lsa_delete(struct ospf_lsa *lsa) * processing Router Information LSA deletion */ if (srn == NULL) { - flog_err(OSPF_ERR_SR_INVALID_DB, + flog_err(EC_OSPF_SR_INVALID_DB, "SR (%s): Stop! no entry in SRDB for SR Node %s", __func__, inet_ntoa(lsah->adv_router)); return; @@ -1345,7 +1344,7 @@ void ospf_sr_ext_link_lsa_delete(struct ospf_lsa *lsa) listnode_delete(srn->ext_link, srl); XFREE(MTYPE_OSPF_SR_PARAMS, srl); } else { - flog_err(OSPF_ERR_SR_INVALID_DB, + flog_err(EC_OSPF_SR_INVALID_DB, "SR (%s): Didn't found corresponding SR Link 8.0.0.%u " "for SR Node %s", __func__, GET_OPAQUE_ID(ntohl(lsah->id.s_addr)), @@ -1372,7 +1371,7 @@ void ospf_sr_ext_prefix_lsa_update(struct ospf_lsa *lsa) /* Sanity check */ if (OspfSR.neighbors == NULL) { - flog_err(OSPF_ERR_SR_INVALID_DB, + flog_err(EC_OSPF_SR_INVALID_DB, "SR (%s): Abort! no valid SR DataBase", __func__); return; } @@ -1384,7 +1383,7 @@ void ospf_sr_ext_prefix_lsa_update(struct ospf_lsa *lsa) /* Sanity check */ if (srn == NULL) { - flog_err(OSPF_ERR_SR_NODE_CREATE, + flog_err(EC_OSPF_SR_NODE_CREATE, "SR (%s): Abort! can't create SR node in hash table", __func__); return; @@ -1425,7 +1424,7 @@ void ospf_sr_ext_prefix_lsa_delete(struct ospf_lsa *lsa) /* Sanity check */ if (OspfSR.neighbors == NULL) { - flog_err(OSPF_ERR_SR_INVALID_DB, + flog_err(EC_OSPF_SR_INVALID_DB, "SR (%s): Abort! no valid SR DataBase", __func__); return; } @@ -1439,7 +1438,7 @@ void ospf_sr_ext_prefix_lsa_delete(struct ospf_lsa *lsa) * processing Router Information LSA deletion */ if (srn == NULL) { - flog_err(OSPF_ERR_SR_INVALID_DB, + flog_err(EC_OSPF_SR_INVALID_DB, "SR (%s): Stop! no entry in SRDB for SR Node %s", __func__, inet_ntoa(lsah->adv_router)); return; @@ -1457,7 +1456,7 @@ void ospf_sr_ext_prefix_lsa_delete(struct ospf_lsa *lsa) XFREE(MTYPE_OSPF_SR_PARAMS, srp); } else { flog_err( - OSPF_ERR_SR_INVALID_DB, + EC_OSPF_SR_INVALID_DB, "SR (%s): Didn't found corresponding SR Prefix 7.0.0.%u for SR Node %s", __func__, GET_OPAQUE_ID(ntohl(lsah->id.s_addr)), inet_ntoa(lsah->adv_router)); @@ -2054,6 +2053,9 @@ DEFUN (no_sr_prefix_sid, bool found = false; int rc; + if (!ospf_sr_enabled(vty)) + return CMD_WARNING_CONFIG_FAILED; + /* Get network prefix */ argv_find(argv, argc, "A.B.C.D/M", &idx); rc = str2prefix(argv[idx]->arg, &p);