summaryrefslogtreecommitdiff
path: root/ospfd/ospfd.c
diff options
context:
space:
mode:
Diffstat (limited to 'ospfd/ospfd.c')
-rw-r--r--ospfd/ospfd.c84
1 files changed, 54 insertions, 30 deletions
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c
index 1a1861fc58..9949a78336 100644
--- a/ospfd/ospfd.c
+++ b/ospfd/ospfd.c
@@ -42,6 +42,7 @@
#include "ldp_sync.h"
#include "ospfd/ospfd.h"
+#include "ospfd/ospf_bfd.h"
#include "ospfd/ospf_network.h"
#include "ospfd/ospf_interface.h"
#include "ospfd/ospf_ism.h"
@@ -366,6 +367,9 @@ struct ospf *ospf_new_alloc(unsigned short instance, const char *name)
new->maxage_lsa = route_table_init();
new->t_maxage_walker = NULL;
+ /* Max paths initialization */
+ new->max_multipath = MULTIPATH_NUM;
+
/* Distance table init. */
new->distance_table = route_table_init();
@@ -475,41 +479,11 @@ struct ospf *ospf_lookup_by_inst_name(unsigned short instance, const char *name)
static void ospf_init(struct ospf *ospf)
{
- struct vrf *vrf;
- struct interface *ifp;
-
ospf_opaque_type11_lsa_init(ospf);
if (ospf->vrf_id != VRF_UNKNOWN)
ospf->oi_running = 1;
- /* Activate 'ip ospf area x' configured interfaces for given
- * vrf. Activate area on vrf x aware interfaces.
- * vrf_enable callback calls router_id_update which
- * internally will call ospf_if_update to trigger
- * network_run_state
- */
- vrf = vrf_lookup_by_id(ospf->vrf_id);
-
- FOR_ALL_INTERFACES (vrf, ifp) {
- struct ospf_if_params *params;
- struct route_node *rn;
- uint32_t count = 0;
-
- params = IF_DEF_PARAMS(ifp);
- if (OSPF_IF_PARAM_CONFIGURED(params, if_area))
- count++;
-
- for (rn = route_top(IF_OIFS_PARAMS(ifp)); rn; rn = route_next(rn))
- if ((params = rn->info) && OSPF_IF_PARAM_CONFIGURED(params, if_area))
- count++;
-
- if (count > 0) {
- ospf_interface_area_set(ospf, ifp);
- ospf->if_ospf_cli_count += count;
- }
- }
-
ospf_router_id_update(ospf);
}
@@ -553,6 +527,23 @@ struct ospf *ospf_lookup_by_vrf_id(vrf_id_t vrf_id)
return (vrf->info) ? (struct ospf *)vrf->info : NULL;
}
+uint32_t ospf_count_area_params(struct ospf *ospf)
+{
+ struct vrf *vrf;
+ struct interface *ifp;
+ uint32_t count = 0;
+
+ if (ospf->vrf_id != VRF_UNKNOWN) {
+ vrf = vrf_lookup_by_id(ospf->vrf_id);
+
+ FOR_ALL_INTERFACES (vrf, ifp) {
+ count += ospf_if_count_area_params(ifp);
+ }
+ }
+
+ return count;
+}
+
/* It should only be used when processing incoming info update from zebra.
* Other situations, it is not sufficient to lookup the ospf instance by
* vrf_name only without using the instance number.
@@ -899,6 +890,7 @@ static void ospf_finish_final(struct ospf *ospf)
close(ospf->fd);
stream_free(ospf->ibuf);
ospf->fd = -1;
+ ospf->max_multipath = MULTIPATH_NUM;
ospf_delete(ospf);
if (ospf->name) {
@@ -1084,6 +1076,7 @@ struct ospf_interface *add_ospf_interface(struct connected *co,
/* If network type is specified previously,
skip network type setting. */
oi->type = IF_DEF_PARAMS(co->ifp)->type;
+ oi->ptp_dmvpn = IF_DEF_PARAMS(co->ifp)->ptp_dmvpn;
/* Add pseudo neighbor. */
ospf_nbr_self_reset(oi, oi->ospf->router_id);
@@ -1671,6 +1664,7 @@ int ospf_area_nssa_set(struct ospf *ospf, struct in_addr area_id)
/* set NSSA area defaults */
area->no_summary = 0;
+ area->suppress_fa = 0;
area->NSSATranslatorRole = OSPF_NSSA_ROLE_CANDIDATE;
area->NSSATranslatorState = OSPF_NSSA_TRANSLATE_DISABLED;
area->NSSATranslatorStabilityInterval =
@@ -1692,6 +1686,7 @@ int ospf_area_nssa_unset(struct ospf *ospf, struct in_addr area_id, int argc)
ospf->anyNSSA--;
/* set NSSA area defaults */
area->no_summary = 0;
+ area->suppress_fa = 0;
area->NSSATranslatorRole = OSPF_NSSA_ROLE_CANDIDATE;
area->NSSATranslatorState = OSPF_NSSA_TRANSLATE_DISABLED;
area->NSSATranslatorStabilityInterval =
@@ -1707,6 +1702,32 @@ int ospf_area_nssa_unset(struct ospf *ospf, struct in_addr area_id, int argc)
return 1;
}
+int ospf_area_nssa_suppress_fa_set(struct ospf *ospf, struct in_addr area_id)
+{
+ struct ospf_area *area;
+
+ area = ospf_area_lookup_by_area_id(ospf, area_id);
+ if (area == NULL)
+ return 0;
+
+ area->suppress_fa = 1;
+
+ return 1;
+}
+
+int ospf_area_nssa_suppress_fa_unset(struct ospf *ospf, struct in_addr area_id)
+{
+ struct ospf_area *area;
+
+ area = ospf_area_lookup_by_area_id(ospf, area_id);
+ if (area == NULL)
+ return 0;
+
+ area->suppress_fa = 0;
+
+ return 1;
+}
+
int ospf_area_nssa_translator_role_set(struct ospf *ospf,
struct in_addr area_id, int role)
{
@@ -1931,6 +1952,9 @@ static void ospf_nbr_nbma_add(struct ospf_nbr_nbma *nbr_nbma,
nbr_nbma->nbr = nbr;
+ /* Configure BFD if interface has it. */
+ ospf_neighbor_bfd_apply(nbr);
+
OSPF_NSM_EVENT_EXECUTE(nbr, NSM_Start);
}
}