#include "ospfd/ospf_route.h"
#include "ospfd/ospf_ase.h"
#include "ospfd/ospf_zebra.h"
+#include "ospfd/ospf_te.h"
+#include "ospfd/ospf_sr.h"
+#include "ospfd/ospf_ri.h"
+#include "ospfd/ospf_ext.h"
DEFINE_MTYPE_STATIC(OSPFD, OSPF_OPAQUE_FUNCTAB, "OSPF opaque function table")
DEFINE_MTYPE_STATIC(OSPFD, OPAQUE_INFO_PER_TYPE, "OSPF opaque per-type info")
* Followings are initialize/terminate functions for Opaque-LSAs handling.
*------------------------------------------------------------------------*/
-#include "ospfd/ospf_te.h"
-#include "ospfd/ospf_ri.h"
-
#ifdef SUPPORT_OSPF_API
int ospf_apiserver_init(void);
void ospf_apiserver_term(void);
static void ospf_opaque_funclist_term(void);
static void free_opaque_info_per_type(void *val);
static void free_opaque_info_per_id(void *val);
+static void free_opaque_info_owner(void *val);
static int ospf_opaque_lsa_install_hook(struct ospf_lsa *lsa);
static int ospf_opaque_lsa_delete_hook(struct ospf_lsa *lsa);
if (ospf_mpls_te_init() != 0)
exit(1);
+ /* Segment Routing init */
+ if (ospf_sr_init() != 0)
+ exit(1);
+
if (ospf_router_info_init() != 0)
exit(1);
+ if (ospf_ext_init() != 0)
+ exit(1);
+
#ifdef SUPPORT_OSPF_API
if ((ospf_apiserver_enable) && (ospf_apiserver_init() != 0))
exit(1);
ospf_router_info_term();
+ ospf_ext_term();
+
+ ospf_sr_term();
+
#ifdef SUPPORT_OSPF_API
ospf_apiserver_term();
#endif /* SUPPORT_OSPF_API */
return;
}
+void ospf_opaque_finish(void)
+{
+ ospf_router_info_finish();
+
+ ospf_ext_finish();
+
+ ospf_sr_finish();
+}
+
int ospf_opaque_type9_lsa_init(struct ospf_interface *oi)
{
if (oi->opaque_lsa_self != NULL)
case OPAQUE_TYPE_ROUTER_INFORMATION_LSA:
name = "Router Information LSA";
break;
+ case OPAQUE_TYPE_EXTENDED_PREFIX_LSA:
+ name = "Extended Prefix Opaque LSA";
+ break;
+ case OPAQUE_TYPE_EXTENDED_LINK_LSA:
+ name = "Extended Link Opaque LSA";
+ break;
default:
if (OPAQUE_TYPE_RANGE_UNASSIGNED(opaque_type))
name = "Unassigned";
if (functab->opaque_type == opaque_type) {
/* Cleanup internal control information, if it
* still remains. */
- if (functab->oipt != NULL)
+ if (functab->oipt != NULL) {
free_opaque_info_per_type(
functab->oipt);
+ free_opaque_info_owner(functab->oipt);
+ }
/* Dequeue listnode entry from the list. */
listnode_delete(funclist, functab);
top = ospf_lookup_by_vrf_id(new->vrf_id);
if (new->area != NULL && (top = new->area->ospf) == NULL) {
free_opaque_info_per_type((void *)oipt);
+ free_opaque_info_owner(oipt);
oipt = NULL;
goto out; /* This case may not exist. */
}
"register_opaque_info_per_type: Unexpected LSA-type(%u)",
new->data->type);
free_opaque_info_per_type((void *)oipt);
+ free_opaque_info_owner(oipt);
oipt = NULL;
goto out; /* This case may not exist. */
}
return oipt;
}
-static void free_opaque_info_per_type(void *val)
+/* Remove "oipt" from its owner's self-originated LSA list. */
+static void free_opaque_info_owner(void *val)
{
struct opaque_info_per_type *oipt = (struct opaque_info_per_type *)val;
- struct opaque_info_per_id *oipi;
- struct ospf_lsa *lsa;
- struct listnode *node, *nnode;
- /* Control information per opaque-id may still exist. */
- for (ALL_LIST_ELEMENTS(oipt->id_list, node, nnode, oipi)) {
- if ((lsa = oipi->lsa) == NULL)
- continue;
- if (IS_LSA_MAXAGE(lsa))
- continue;
- ospf_opaque_lsa_flush_schedule(lsa);
- }
-
- /* Remove "oipt" from its owner's self-originated LSA list. */
switch (oipt->lsa_type) {
case OSPF_OPAQUE_LINK_LSA: {
struct ospf_interface *oi =
(struct ospf_interface *)(oipt->owner);
+
listnode_delete(oi->opaque_lsa_self, oipt);
break;
}
case OSPF_OPAQUE_AREA_LSA: {
struct ospf_area *area = (struct ospf_area *)(oipt->owner);
+
listnode_delete(area->opaque_lsa_self, oipt);
break;
}
case OSPF_OPAQUE_AS_LSA: {
struct ospf *top = (struct ospf *)(oipt->owner);
+
listnode_delete(top->opaque_lsa_self, oipt);
break;
}
default:
- zlog_warn("free_opaque_info_per_type: Unexpected LSA-type(%u)",
- oipt->lsa_type);
+ zlog_warn("%s: Unexpected LSA-type(%u)", __func__,
+ oipt->lsa_type);
break; /* This case may not exist. */
}
+}
+
+static void free_opaque_info_per_type(void *val)
+{
+ struct opaque_info_per_type *oipt = (struct opaque_info_per_type *)val;
+ struct opaque_info_per_id *oipi;
+ struct ospf_lsa *lsa;
+ struct listnode *node, *nnode;
+
+ /* Control information per opaque-id may still exist. */
+ for (ALL_LIST_ELEMENTS(oipt->id_list, node, nnode, oipi)) {
+ if ((lsa = oipi->lsa) == NULL)
+ continue;
+ if (IS_LSA_MAXAGE(lsa))
+ continue;
+ ospf_opaque_lsa_flush_schedule(lsa);
+ }
OSPF_TIMER_OFF(oipt->t_opaque_lsa_self);
list_delete_and_null(&oipt->id_list);
{
struct ospf_lsa lsa;
- lsa.data = (struct lsa_header *)STREAM_PNT(s);
+ lsa.data = (struct lsa_header *)stream_pnt(s);
show_opaque_info_detail(NULL, &lsa);
return;
}
lsa_type, delay,
GET_OPAQUE_TYPE(ntohl(lsa->data->id.s_addr)));
- OSPF_OPAQUE_TIMER_ON(oipt->t_opaque_lsa_self, func, oipt, delay * 1000);
+ OSPF_OPAQUE_TIMER_ON(oipt->t_opaque_lsa_self, func, oipt, delay);
out:
return;