summaryrefslogtreecommitdiffstats
path: root/ospfd/ospf_ri.c
diff options
context:
space:
mode:
authorOlivier Dugeon <olivier.dugeon@orange.com>2018-01-29 17:58:53 +0100
committerOlivier Dugeon <olivier.dugeon@orange.com>2018-01-29 17:58:53 +0100
commit7743f2f8c00ed2541454a806c1dc55257e06c7a5 (patch)
tree535706c0cba106a9579ed990156be19934c97f3d /ospfd/ospf_ri.c
parentOSPFD: Set Segment Routing patch conform to C99 (diff)
downloadfrr-7743f2f8c00ed2541454a806c1dc55257e06c7a5.tar.xz
frr-7743f2f8c00ed2541454a806c1dc55257e06c7a5.zip
OSPFd: Update Segment Routing PR following review
Following various review, following files have been modfied: - All: Change u_intXX_t typedef to standard uintXX_t types - doc/OSPF-SR.rst: Update doc in particular the Linux Kernel configuration section - doc/ospfd.texi: Update CLI - ospfd/ospf_dump.[c,h]: Add new 'debug ospf sr' when performing 'sh run' - ospfd/ospf_ext.[c, h]: Various bug corrections notably to handle flooding of Extended Prefix at startup. iFix TLVs size for LAN Adjacency. Update Licence as per Community.md - ospfd/ospf_opaque.c: Add proper termination function call to remove MPLS entries - ospfd/ospf_ri.[c,h]: Bug corrections - ospfd/ospf_sr.[c,h]: Various bug corrections, notably to determine the nexthop SR Node. Add support to 'no-php-flag'. Update Licence as per Community.md - ospfd/ospfd.c: Add call to 'ospf_opaque_term()' Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Diffstat (limited to 'ospfd/ospf_ri.c')
-rw-r--r--ospfd/ospf_ri.c42
1 files changed, 11 insertions, 31 deletions
diff --git a/ospfd/ospf_ri.c b/ospfd/ospf_ri.c
index db68ec9de..d8fa4c72f 100644
--- a/ospfd/ospf_ri.c
+++ b/ospfd/ospf_ri.c
@@ -69,7 +69,10 @@ struct ospf_pce_info {
struct ri_pce_subtlv_cap_flag pce_cap_flag;
};
-/* Store Router Information Segment Routing TLV and SubTLV in network byte order. */
+/*
+ * Store Router Information Segment Routing TLV and SubTLV
+ * in network byte order
+ */
struct ospf_ri_sr_info {
bool enabled;
/* Algorithms supported by the node */
@@ -195,23 +198,6 @@ static int ospf_router_info_register(u_int8_t scope)
return rc;
}
-static int ospf_router_info_unregister()
-{
-
- if ((OspfRI.scope != OSPF_OPAQUE_AS_LSA)
- && (OspfRI.scope != OSPF_OPAQUE_AREA_LSA)) {
- zlog_warn(
- "Unable to unregister Router Info functions: Wrong scope!");
- return -1;
- }
-
- ospf_delete_opaque_functab(OspfRI.scope,
- OPAQUE_TYPE_ROUTER_INFORMATION_LSA);
-
- OspfRI.registered = 0;
- return 0;
-}
-
void ospf_router_info_term(void)
{
@@ -220,8 +206,6 @@ void ospf_router_info_term(void)
OspfRI.enabled = false;
- ospf_router_info_unregister();
-
return;
}
@@ -235,6 +219,7 @@ static void del_pce_info(void *val)
struct scope_info ospf_router_info_get_flooding_scope(void)
{
struct scope_info flooding_scope;
+
if (OspfRI.scope == OSPF_OPAQUE_AS_LSA) {
flooding_scope.scope = OSPF_OPAQUE_AS_LSA;
flooding_scope.area_id.s_addr = 0;
@@ -454,7 +439,6 @@ static void set_sr_algorithm(uint8_t algo)
TLV_TYPE(OspfRI.sr_info.algo) = htons(RI_SR_TLV_SR_ALGORITHM);
TLV_LEN(OspfRI.sr_info.algo) = htons(sizeof(uint8_t));
- return;
}
/* unset Aglogithm SubTLV */
@@ -468,7 +452,6 @@ static void unset_sr_algorithm(uint8_t algo)
TLV_TYPE(OspfRI.sr_info.algo) = htons(0);
TLV_LEN(OspfRI.sr_info.algo) = htons(0);
- return;
}
/* Segment Routing Global Block SubTLV - section 3.2 */
@@ -485,11 +468,10 @@ static void set_sr_sid_label_range(struct sr_srgb srgb)
TLV_LEN(OspfRI.sr_info.range.lower) = htons(SID_RANGE_LABEL_LENGTH);
OspfRI.sr_info.range.lower.value = htonl(SET_LABEL(srgb.lower_bound));
- return;
}
/* Unset this SRGB SubTLV */
-static void unset_sr_sid_label_range()
+static void unset_sr_sid_label_range(void)
{
TLV_TYPE(OspfRI.sr_info.range) = htons(0);
@@ -497,7 +479,6 @@ static void unset_sr_sid_label_range()
TLV_TYPE(OspfRI.sr_info.range.lower) = htons(0);
TLV_LEN(OspfRI.sr_info.range.lower) = htons(0);
- return;
}
/* Set Maximum Stack Depth for this router */
@@ -507,16 +488,14 @@ static void set_sr_node_msd(uint8_t msd)
TLV_LEN(OspfRI.sr_info.msd) = htons(sizeof(uint32_t));
OspfRI.sr_info.msd.value = msd;
- return;
}
/* Unset this router MSD */
-static void unset_sr_node_msd()
+static void unset_sr_node_msd(void)
{
TLV_TYPE(OspfRI.sr_info.msd) = htons(0);
TLV_LEN(OspfRI.sr_info.msd) = htons(0);
- return;
}
static void unset_param(struct tlv_header *tlv)
@@ -1041,7 +1020,7 @@ static int ospf_router_info_lsa_update(struct ospf_lsa *lsa)
/* Sanity Check */
if (lsa == NULL) {
- zlog_warn("OSPF-RI (ospf_router_info_lsa_update): Abort! LSA is NULL");
+ zlog_warn("OSPF-RI (%s): Abort! LSA is NULL", __func__);
return -1;
}
@@ -1050,8 +1029,8 @@ static int ospf_router_info_lsa_update(struct ospf_lsa *lsa)
return 0;
/* Process only Router Information LSA */
- if (GET_OPAQUE_TYPE(
- ntohl(lsa->data->id.s_addr)) != OPAQUE_TYPE_ROUTER_INFORMATION_LSA)
+ if (GET_OPAQUE_TYPE(ntohl(lsa->data->id.s_addr)) !=
+ OPAQUE_TYPE_ROUTER_INFORMATION_LSA)
return 0;
/* Check if Router Info & Segment Routing are enable */
@@ -1239,6 +1218,7 @@ static uint16_t show_vty_sr_algorithm(struct vty *vty, struct tlv_header *tlvh)
struct ri_sr_tlv_sr_algorithm *algo =
(struct ri_sr_tlv_sr_algorithm *)tlvh;
int i;
+
if (vty != NULL) {
vty_out(vty, " Segment Routing Algorithm TLV:\n");
for (i = 0; i < ntohs(algo->header.length); i++) {