|
|
2b9283 |
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c
|
|
|
2b9283 |
index d8be19db9..6fe94f3a4 100644
|
|
|
2b9283 |
--- a/ospfd/ospfd.c
|
|
|
2b9283 |
+++ b/ospfd/ospfd.c
|
|
|
2b9283 |
@@ -384,12 +384,50 @@ struct ospf *ospf_lookup_by_inst_name(unsigned short instance, const char *name)
|
|
|
2b9283 |
return NULL;
|
|
|
2b9283 |
}
|
|
|
2b9283 |
|
|
|
2b9283 |
-struct ospf *ospf_get(unsigned short instance, const char *name, bool *created)
|
|
|
2b9283 |
+static void ospf_init(struct ospf *ospf)
|
|
|
2b9283 |
{
|
|
|
2b9283 |
- struct ospf *ospf;
|
|
|
2b9283 |
struct vrf *vrf;
|
|
|
2b9283 |
struct interface *ifp;
|
|
|
2b9283 |
|
|
|
2b9283 |
+ ospf_opaque_type11_lsa_init(ospf);
|
|
|
2b9283 |
+
|
|
|
2b9283 |
+ if (ospf->vrf_id != VRF_UNKNOWN)
|
|
|
2b9283 |
+ ospf->oi_running = 1;
|
|
|
2b9283 |
+
|
|
|
2b9283 |
+ /* Activate 'ip ospf area x' configured interfaces for given
|
|
|
2b9283 |
+ * vrf. Activate area on vrf x aware interfaces.
|
|
|
2b9283 |
+ * vrf_enable callback calls router_id_update which
|
|
|
2b9283 |
+ * internally will call ospf_if_update to trigger
|
|
|
2b9283 |
+ * network_run_state
|
|
|
2b9283 |
+ */
|
|
|
2b9283 |
+ vrf = vrf_lookup_by_id(ospf->vrf_id);
|
|
|
2b9283 |
+
|
|
|
2b9283 |
+ FOR_ALL_INTERFACES (vrf, ifp) {
|
|
|
2b9283 |
+ struct ospf_if_params *params;
|
|
|
2b9283 |
+ struct route_node *rn;
|
|
|
2b9283 |
+ uint32_t count = 0;
|
|
|
2b9283 |
+
|
|
|
2b9283 |
+ params = IF_DEF_PARAMS(ifp);
|
|
|
2b9283 |
+ if (OSPF_IF_PARAM_CONFIGURED(params, if_area))
|
|
|
2b9283 |
+ count++;
|
|
|
2b9283 |
+
|
|
|
2b9283 |
+ for (rn = route_top(IF_OIFS_PARAMS(ifp)); rn; rn = route_next(rn))
|
|
|
2b9283 |
+ if ((params = rn->info) && OSPF_IF_PARAM_CONFIGURED(params, if_area))
|
|
|
2b9283 |
+ count++;
|
|
|
2b9283 |
+
|
|
|
2b9283 |
+ if (count > 0) {
|
|
|
2b9283 |
+ ospf_interface_area_set(ospf, ifp);
|
|
|
2b9283 |
+ ospf->if_ospf_cli_count += count;
|
|
|
2b9283 |
+ }
|
|
|
2b9283 |
+ }
|
|
|
2b9283 |
+
|
|
|
2b9283 |
+ ospf_router_id_update(ospf);
|
|
|
2b9283 |
+}
|
|
|
2b9283 |
+
|
|
|
2b9283 |
+struct ospf *ospf_get(unsigned short instance, const char *name, bool *created)
|
|
|
2b9283 |
+{
|
|
|
2b9283 |
+ struct ospf *ospf;
|
|
|
2b9283 |
+
|
|
|
2b9283 |
/* vrf name provided call inst and name based api
|
|
|
2b9283 |
* in case of no name pass default ospf instance */
|
|
|
2b9283 |
if (name)
|
|
|
2b9283 |
@@ -402,39 +440,7 @@ struct ospf *ospf_get(unsigned short instance, const char *name, bool *created)
|
|
|
2b9283 |
ospf = ospf_new(instance, name);
|
|
|
2b9283 |
ospf_add(ospf);
|
|
|
2b9283 |
|
|
|
2b9283 |
- ospf_opaque_type11_lsa_init(ospf);
|
|
|
2b9283 |
-
|
|
|
2b9283 |
- if (ospf->vrf_id != VRF_UNKNOWN)
|
|
|
2b9283 |
- ospf->oi_running = 1;
|
|
|
2b9283 |
-
|
|
|
2b9283 |
- /* Activate 'ip ospf area x' configured interfaces for given
|
|
|
2b9283 |
- * vrf. Activate area on vrf x aware interfaces.
|
|
|
2b9283 |
- * vrf_enable callback calls router_id_update which
|
|
|
2b9283 |
- * internally will call ospf_if_update to trigger
|
|
|
2b9283 |
- * network_run_state
|
|
|
2b9283 |
- */
|
|
|
2b9283 |
- vrf = vrf_lookup_by_id(ospf->vrf_id);
|
|
|
2b9283 |
-
|
|
|
2b9283 |
- FOR_ALL_INTERFACES (vrf, ifp) {
|
|
|
2b9283 |
- struct ospf_if_params *params;
|
|
|
2b9283 |
- struct route_node *rn;
|
|
|
2b9283 |
- uint32_t count = 0;
|
|
|
2b9283 |
-
|
|
|
2b9283 |
- params = IF_DEF_PARAMS(ifp);
|
|
|
2b9283 |
- if (OSPF_IF_PARAM_CONFIGURED(params, if_area))
|
|
|
2b9283 |
- count++;
|
|
|
2b9283 |
-
|
|
|
2b9283 |
- for (rn = route_top(IF_OIFS_PARAMS(ifp)); rn; rn = route_next(rn))
|
|
|
2b9283 |
- if ((params = rn->info) && OSPF_IF_PARAM_CONFIGURED(params, if_area))
|
|
|
2b9283 |
- count++;
|
|
|
2b9283 |
-
|
|
|
2b9283 |
- if (count > 0) {
|
|
|
2b9283 |
- ospf_interface_area_set(ospf, ifp);
|
|
|
2b9283 |
- ospf->if_ospf_cli_count += count;
|
|
|
2b9283 |
- }
|
|
|
2b9283 |
- }
|
|
|
2b9283 |
-
|
|
|
2b9283 |
- ospf_router_id_update(ospf);
|
|
|
2b9283 |
+ ospf_init(ospf);
|
|
|
2b9283 |
}
|
|
|
2b9283 |
|
|
|
2b9283 |
return ospf;
|
|
|
2b9283 |
@@ -450,7 +456,7 @@ struct ospf *ospf_get_instance(unsigned short instance, bool *created)
|
|
|
2b9283 |
ospf = ospf_new(instance, NULL /* VRF_DEFAULT*/);
|
|
|
2b9283 |
ospf_add(ospf);
|
|
|
2b9283 |
|
|
|
2b9283 |
- ospf_opaque_type11_lsa_init(ospf);
|
|
|
2b9283 |
+ ospf_init(ospf);
|
|
|
2b9283 |
}
|
|
|
2b9283 |
|
|
|
2b9283 |
return ospf;
|
|
|
2b9283 |
diff --git a/ospfd/ospfd.h b/ospfd/ospfd.h
|
|
|
2b9283 |
index 192e54281..3087b735a 100644
|
|
|
2b9283 |
--- a/ospfd/ospfd.h
|
|
|
2b9283 |
+++ b/ospfd/ospfd.h
|
|
|
2b9283 |
@@ -604,7 +604,6 @@ extern int ospf_nbr_nbma_poll_interval_set(struct ospf *, struct in_addr,
|
|
|
2b9283 |
unsigned int);
|
|
|
2b9283 |
extern int ospf_nbr_nbma_poll_interval_unset(struct ospf *, struct in_addr);
|
|
|
2b9283 |
extern void ospf_prefix_list_update(struct prefix_list *);
|
|
|
2b9283 |
-extern void ospf_init(void);
|
|
|
2b9283 |
extern void ospf_if_update(struct ospf *, struct interface *);
|
|
|
2b9283 |
extern void ospf_ls_upd_queue_empty(struct ospf_interface *);
|
|
|
2b9283 |
extern void ospf_terminate(void);
|