summaryrefslogtreecommitdiff
path: root/ospfd
diff options
context:
space:
mode:
Diffstat (limited to 'ospfd')
-rw-r--r--ospfd/ospf_abr.c3
-rw-r--r--ospfd/ospf_bfd.c474
-rw-r--r--ospfd/ospf_bfd.h31
-rw-r--r--ospfd/ospf_dump.c44
-rw-r--r--ospfd/ospf_dump.h3
-rw-r--r--ospfd/ospf_interface.c22
-rw-r--r--ospfd/ospf_interface.h25
-rw-r--r--ospfd/ospf_ism.c2
-rw-r--r--ospfd/ospf_ism.h2
-rw-r--r--ospfd/ospf_lsa.c29
-rw-r--r--ospfd/ospf_lsa.h11
-rw-r--r--ospfd/ospf_main.c7
-rw-r--r--ospfd/ospf_memory.c70
-rw-r--r--ospfd/ospf_memory.h70
-rw-r--r--ospfd/ospf_neighbor.c8
-rw-r--r--ospfd/ospf_neighbor.h2
-rw-r--r--ospfd/ospf_nsm.c5
-rw-r--r--ospfd/ospf_nsm.h2
-rw-r--r--ospfd/ospf_opaque.c6
-rw-r--r--ospfd/ospf_snmp.c3
-rw-r--r--ospfd/ospf_spf.c2
-rw-r--r--ospfd/ospf_spf.h2
-rw-r--r--ospfd/ospf_ti_lfa.c4
-rw-r--r--ospfd/ospf_vty.c233
-rw-r--r--ospfd/ospf_zebra.c6
-rw-r--r--ospfd/ospfd.c36
-rw-r--r--ospfd/ospfd.h14
-rw-r--r--ospfd/subdir.am2
28 files changed, 563 insertions, 555 deletions
diff --git a/ospfd/ospf_abr.c b/ospfd/ospf_abr.c
index f3c4798906..b5c97eda3c 100644
--- a/ospfd/ospf_abr.c
+++ b/ospfd/ospf_abr.c
@@ -675,7 +675,8 @@ static int ospf_abr_translate_nssa(struct ospf_area *area, struct ospf_lsa *lsa)
* originate translated LSA
*/
- if (ospf_translated_nssa_originate(area->ospf, lsa) == NULL) {
+ if (ospf_translated_nssa_originate(area->ospf, lsa, old)
+ == NULL) {
if (IS_DEBUG_OSPF_NSSA)
zlog_debug(
"ospf_abr_translate_nssa(): Could not translate Type-7 for %pI4 to Type-5",
diff --git a/ospfd/ospf_bfd.c b/ospfd/ospf_bfd.c
index a9bc9069d2..b202cd01f1 100644
--- a/ospfd/ospf_bfd.c
+++ b/ospfd/ospf_bfd.c
@@ -23,6 +23,7 @@
#include <zebra.h>
#include "command.h"
+#include "json.h"
#include "linklist.h"
#include "memory.h"
#include "prefix.h"
@@ -44,48 +45,7 @@
#include "ospf_dump.h"
#include "ospf_vty.h"
-extern struct zclient *zclient;
-
-/*
- * ospf_bfd_info_free - Free BFD info structure
- */
-void ospf_bfd_info_free(void **bfd_info)
-{
- bfd_info_free((struct bfd_info **)bfd_info);
-}
-
-/*
- * ospf_bfd_reg_dereg_nbr - Register/Deregister a neighbor with BFD through
- * zebra for starting/stopping the monitoring of
- * the neighbor rechahability.
- */
-static void ospf_bfd_reg_dereg_nbr(struct ospf_neighbor *nbr, int command)
-{
- struct ospf_interface *oi = nbr->oi;
- struct interface *ifp = oi->ifp;
- struct ospf_if_params *params;
- struct bfd_info *bfd_info;
- int cbit;
-
- /* Check if BFD is enabled */
- params = IF_DEF_PARAMS(ifp);
-
- /* Check if BFD is enabled */
- if (!params->bfd_info)
- return;
- bfd_info = (struct bfd_info *)params->bfd_info;
-
- if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
- zlog_debug("%s nbr (%pI4) with BFD. OSPF vrf %s",
- bfd_get_command_dbg_str(command),
- &nbr->src,
- ospf_vrf_id_to_name(oi->ospf->vrf_id));
-
- cbit = CHECK_FLAG(bfd_info->flags, BFD_FLAG_BFD_CBIT_ON);
-
- bfd_peer_sendmsg(zclient, bfd_info, AF_INET, &nbr->src, NULL, ifp->name,
- 0, 0, cbit, command, 0, oi->ospf->vrf_id);
-}
+DEFINE_MTYPE_STATIC(OSPFD, BFD_CONFIG, "BFD configuration data");
/*
* ospf_bfd_trigger_event - Neighbor is registered/deregistered with BFD when
@@ -94,293 +54,155 @@ static void ospf_bfd_reg_dereg_nbr(struct ospf_neighbor *nbr, int command)
void ospf_bfd_trigger_event(struct ospf_neighbor *nbr, int old_state, int state)
{
if ((old_state < NSM_TwoWay) && (state >= NSM_TwoWay))
- ospf_bfd_reg_dereg_nbr(nbr, ZEBRA_BFD_DEST_REGISTER);
+ bfd_sess_install(nbr->bfd_session);
else if ((old_state >= NSM_TwoWay) && (state < NSM_TwoWay))
- ospf_bfd_reg_dereg_nbr(nbr, ZEBRA_BFD_DEST_DEREGISTER);
+ bfd_sess_uninstall(nbr->bfd_session);
}
-/*
- * ospf_bfd_reg_dereg_all_nbr - Register/Deregister all neighbors associated
- * with a interface with BFD through
- * zebra for starting/stopping the monitoring of
- * the neighbor rechahability.
- */
-static int ospf_bfd_reg_dereg_all_nbr(struct interface *ifp, int command)
+static void ospf_bfd_session_change(struct bfd_session_params *bsp,
+ const struct bfd_session_status *bss,
+ void *arg)
{
- struct ospf_interface *oi;
- struct route_table *nbrs;
- struct ospf_neighbor *nbr;
- struct route_node *irn;
- struct route_node *nrn;
-
- for (irn = route_top(IF_OIFS(ifp)); irn; irn = route_next(irn)) {
- if ((oi = irn->info) == NULL)
- continue;
+ struct ospf_neighbor *nbr = arg;
- if ((nbrs = oi->nbrs) == NULL)
- continue;
-
- for (nrn = route_top(nbrs); nrn; nrn = route_next(nrn)) {
- if ((nbr = nrn->info) == NULL || nbr == oi->nbr_self)
- continue;
-
- if (command != ZEBRA_BFD_DEST_DEREGISTER)
- ospf_bfd_info_nbr_create(oi, nbr);
- else
- bfd_info_free(
- (struct bfd_info **)&nbr->bfd_info);
-
- if (nbr->state < NSM_TwoWay)
- continue;
+ /* BFD peer went down. */
+ if (bss->state == BFD_STATUS_DOWN
+ && bss->previous_state == BFD_STATUS_UP) {
+ if (IS_DEBUG_OSPF(bfd, BFD_LIB))
+ zlog_debug("%s: NSM[%s:%pI4]: BFD Down", __func__,
+ IF_NAME(nbr->oi), &nbr->address.u.prefix4);
- ospf_bfd_reg_dereg_nbr(nbr, command);
- }
+ OSPF_NSM_EVENT_SCHEDULE(nbr, NSM_InactivityTimer);
}
- return 0;
+ /* BFD peer went up. */
+ if (bss->state == BSS_UP && bss->previous_state == BSS_DOWN)
+ if (IS_DEBUG_OSPF(bfd, BFD_LIB))
+ zlog_debug("%s: NSM[%s:%pI4]: BFD Up", __func__,
+ IF_NAME(nbr->oi), &nbr->address.u.prefix4);
}
-/*
- * ospf_bfd_nbr_replay - Replay all the neighbors that have BFD enabled
- * to zebra
- */
-static int ospf_bfd_nbr_replay(ZAPI_CALLBACK_ARGS)
+void ospf_neighbor_bfd_apply(struct ospf_neighbor *nbr)
{
- struct listnode *inode, *node, *onode;
- struct ospf *ospf;
- struct ospf_interface *oi;
- struct route_table *nbrs;
- struct route_node *rn;
- struct ospf_neighbor *nbr;
- struct ospf_if_params *params;
+ struct ospf_interface *oi = nbr->oi;
+ struct ospf_if_params *oip = IF_DEF_PARAMS(oi->ifp);
- if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE)) {
- zlog_debug("Zebra: BFD Dest replay request");
+ /* BFD configuration was removed. */
+ if (oip->bfd_config == NULL) {
+ bfd_sess_free(&nbr->bfd_session);
+ return;
}
- /* Send the client registration */
- bfd_client_sendmsg(zclient, ZEBRA_BFD_CLIENT_REGISTER, vrf_id);
-
- /* Replay the neighbor, if BFD is enabled in OSPF */
- for (ALL_LIST_ELEMENTS(om->ospf, node, onode, ospf)) {
- for (ALL_LIST_ELEMENTS_RO(ospf->oiflist, inode, oi)) {
- if ((nbrs = oi->nbrs) == NULL)
- continue;
-
- params = IF_DEF_PARAMS(oi->ifp);
- if (!params->bfd_info)
- continue;
-
- for (rn = route_top(nbrs); rn; rn = route_next(rn)) {
- if ((nbr = rn->info) == NULL
- || nbr == oi->nbr_self)
- continue;
+ /* New BFD session. */
+ if (nbr->bfd_session == NULL) {
+ nbr->bfd_session = bfd_sess_new(ospf_bfd_session_change, nbr);
+ bfd_sess_set_ipv4_addrs(nbr->bfd_session, NULL, &nbr->src);
+ bfd_sess_set_interface(nbr->bfd_session, oi->ifp->name);
+ bfd_sess_set_vrf(nbr->bfd_session, oi->ospf->vrf_id);
+ bfd_sess_enable(nbr->bfd_session, true);
+ }
- if (nbr->state < NSM_TwoWay)
- continue;
+ /* Set new configuration. */
+ bfd_sess_set_timers(nbr->bfd_session,
+ oip->bfd_config->detection_multiplier,
+ oip->bfd_config->min_rx, oip->bfd_config->min_tx);
+ bfd_sess_set_profile(nbr->bfd_session, oip->bfd_config->profile);
- if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
- zlog_debug("Replaying nbr (%pI4) to BFD",
- &nbr->src);
+ /* Don't start sessions on down OSPF sessions. */
+ if (nbr->state < NSM_TwoWay)
+ return;
- ospf_bfd_reg_dereg_nbr(nbr,
- ZEBRA_BFD_DEST_UPDATE);
- }
- }
- }
- return 0;
+ bfd_sess_install(nbr->bfd_session);
}
-/*
- * ospf_bfd_interface_dest_update - Find the neighbor for which the BFD status
- * has changed and bring down the neighbor
- * connectivity if the BFD status changed to
- * down.
- */
-static int ospf_bfd_interface_dest_update(ZAPI_CALLBACK_ARGS)
+static void ospf_interface_bfd_apply(struct interface *ifp)
{
- struct interface *ifp;
struct ospf_interface *oi;
- struct ospf_if_params *params;
- struct ospf_neighbor *nbr = NULL;
- struct route_node *node;
- struct route_node *n_node;
- struct prefix p, src_p;
- int status;
- int old_status;
- struct bfd_info *bfd_info;
- struct timeval tv;
-
- ifp = bfd_get_peer_info(zclient->ibuf, &p, &src_p, &status, NULL,
- vrf_id);
-
- if ((ifp == NULL) || (p.family != AF_INET))
- return 0;
-
- if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
- zlog_debug("Zebra: interface %s bfd destination %pFX %s",
- ifp->name, &p, bfd_get_status_str(status));
-
- params = IF_DEF_PARAMS(ifp);
- if (!params->bfd_info)
- return 0;
-
- for (node = route_top(IF_OIFS(ifp)); node; node = route_next(node)) {
- if ((oi = node->info) == NULL)
- continue;
-
- /* walk the neighbor list for point-to-point network */
- if (oi->type == OSPF_IFTYPE_POINTOPOINT) {
- for (n_node = route_top(oi->nbrs); n_node;
- n_node = route_next(n_node)) {
- nbr = n_node->info;
- if (nbr) {
- /* skip myself */
- if (nbr == oi->nbr_self) {
- nbr = NULL;
- continue;
- }
-
- /* Found the matching neighbor */
- if (nbr->src.s_addr ==
- p.u.prefix4.s_addr)
- break;
- }
- }
- } else {
- nbr = ospf_nbr_lookup_by_addr(oi->nbrs, &p.u.prefix4);
- }
+ struct route_table *nbrs;
+ struct ospf_neighbor *nbr;
+ struct route_node *irn;
+ struct route_node *nrn;
- if (!nbr || !nbr->bfd_info)
+ /* Iterate over all interfaces and set neighbors BFD session. */
+ for (irn = route_top(IF_OIFS(ifp)); irn; irn = route_next(irn)) {
+ if ((oi = irn->info) == NULL)
continue;
-
- bfd_info = (struct bfd_info *)nbr->bfd_info;
- if (bfd_info->status == status)
+ if ((nbrs = oi->nbrs) == NULL)
continue;
+ for (nrn = route_top(nbrs); nrn; nrn = route_next(nrn)) {
+ if ((nbr = nrn->info) == NULL || nbr == oi->nbr_self)
+ continue;
- old_status = bfd_info->status;
- BFD_SET_CLIENT_STATUS(bfd_info->status, status);
- monotime(&tv);
- bfd_info->last_update = tv.tv_sec;
-
- if ((status == BFD_STATUS_DOWN)
- && (old_status == BFD_STATUS_UP)) {
- if (IS_DEBUG_OSPF(nsm, NSM_EVENTS))
- zlog_debug("NSM[%s:%pI4]: BFD Down",
- IF_NAME(nbr->oi),
- &nbr->address.u.prefix4);
-
- OSPF_NSM_EVENT_SCHEDULE(nbr, NSM_InactivityTimer);
- }
- if ((status == BFD_STATUS_UP)
- && (old_status == BFD_STATUS_DOWN)) {
- if (IS_DEBUG_OSPF(nsm, NSM_EVENTS))
- zlog_debug("NSM[%s:%pI4]: BFD Up",
- IF_NAME(nbr->oi),
- &nbr->address.u.prefix4);
+ ospf_neighbor_bfd_apply(nbr);
}
}
-
- return 0;
}
-/*
- * ospf_bfd_info_nbr_create - Create/update BFD information for a neighbor.
- */
-void ospf_bfd_info_nbr_create(struct ospf_interface *oi,
- struct ospf_neighbor *nbr)
+static void ospf_interface_enable_bfd(struct interface *ifp)
{
- struct bfd_info *oi_bfd_info;
- struct bfd_info *nbr_bfd_info;
- struct interface *ifp = oi->ifp;
- struct ospf_if_params *params;
-
- /* Check if BFD is enabled */
- params = IF_DEF_PARAMS(ifp);
+ struct ospf_if_params *oip = IF_DEF_PARAMS(ifp);
- /* Check if BFD is enabled */
- if (!params->bfd_info)
+ if (oip->bfd_config)
return;
- oi_bfd_info = (struct bfd_info *)params->bfd_info;
- if (!nbr->bfd_info)
- nbr->bfd_info = bfd_info_create();
+ /* Allocate memory for configurations and set defaults. */
+ oip->bfd_config = XCALLOC(MTYPE_BFD_CONFIG, sizeof(*oip->bfd_config));
+ oip->bfd_config->detection_multiplier = BFD_DEF_DETECT_MULT;
+ oip->bfd_config->min_rx = BFD_DEF_MIN_RX;
+ oip->bfd_config->min_tx = BFD_DEF_MIN_TX;
+}
- nbr_bfd_info = (struct bfd_info *)nbr->bfd_info;
- nbr_bfd_info->detect_mult = oi_bfd_info->detect_mult;
- nbr_bfd_info->desired_min_tx = oi_bfd_info->desired_min_tx;
- nbr_bfd_info->required_min_rx = oi_bfd_info->required_min_rx;
+void ospf_interface_disable_bfd(struct interface *ifp,
+ struct ospf_if_params *oip)
+{
+ XFREE(MTYPE_BFD_CONFIG, oip->bfd_config);
+ ospf_interface_bfd_apply(ifp);
}
/*
* ospf_bfd_write_config - Write the interface BFD configuration.
*/
-void ospf_bfd_write_config(struct vty *vty, struct ospf_if_params *params)
-
+void ospf_bfd_write_config(struct vty *vty, const struct ospf_if_params *params
+ __attribute__((unused)))
{
#if HAVE_BFDD == 0
- struct bfd_info *bfd_info;
-#endif /* ! HAVE_BFDD */
-
- if (!params->bfd_info)
- return;
-
-#if HAVE_BFDD == 0
- bfd_info = (struct bfd_info *)params->bfd_info;
-
if (CHECK_FLAG(bfd_info->flags, BFD_FLAG_PARAM_CFG))
- vty_out(vty, " ip ospf bfd %d %d %d\n", bfd_info->detect_mult,
- bfd_info->required_min_rx, bfd_info->desired_min_tx);
+ vty_out(vty, " ip ospf bfd %d %d %d\n",
+ params->bfd_config->detection_multiplier,
+ params->bfd_config->min_rx, params->bfd_config->min_tx);
else
#endif /* ! HAVE_BFDD */
vty_out(vty, " ip ospf bfd\n");
-}
-/*
- * ospf_bfd_show_info - Show BFD info structure
- */
-void ospf_bfd_show_info(struct vty *vty, void *bfd_info, json_object *json_obj,
- bool use_json, int param_only)
-{
- if (param_only)
- bfd_show_param(vty, (struct bfd_info *)bfd_info, 1, 0, use_json,
- json_obj);
- else
- bfd_show_info(vty, (struct bfd_info *)bfd_info, 0, 1, use_json,
- json_obj);
+ if (params->bfd_config->profile[0])
+ vty_out(vty, " ip ospf bfd profile %s\n",
+ params->bfd_config->profile);
}
-/*
- * ospf_bfd_interface_show - Show the interface BFD configuration.
- */
-void ospf_bfd_interface_show(struct vty *vty, struct interface *ifp,
- json_object *json_interface_sub, bool use_json)
+void ospf_interface_bfd_show(struct vty *vty, const struct interface *ifp,
+ struct json_object *json)
{
- struct ospf_if_params *params;
-
- params = IF_DEF_PARAMS(ifp);
+ struct ospf_if_params *params = IF_DEF_PARAMS(ifp);
+ struct bfd_configuration *bfd_config = params->bfd_config;
+ struct json_object *json_bfd;
- ospf_bfd_show_info(vty, params->bfd_info, json_interface_sub, use_json,
- 1);
-}
-
-/*
- * ospf_bfd_if_param_set - Set the configured BFD paramter values for
- * interface.
- */
-static void ospf_bfd_if_param_set(struct interface *ifp, uint32_t min_rx,
- uint32_t min_tx, uint8_t detect_mult,
- int defaults)
-{
- struct ospf_if_params *params;
- int command = 0;
-
- params = IF_DEF_PARAMS(ifp);
+ if (bfd_config == NULL)
+ return;
- bfd_set_param((struct bfd_info **)&(params->bfd_info), min_rx, min_tx,
- detect_mult, NULL, defaults, &command);
- if (command)
- ospf_bfd_reg_dereg_all_nbr(ifp, command);
+ if (json) {
+ json_bfd = json_object_new_object();
+ json_object_int_add(json_bfd, "detectionMultiplier",
+ bfd_config->detection_multiplier);
+ json_object_int_add(json_bfd, "rxMinInterval",
+ bfd_config->min_rx);
+ json_object_int_add(json_bfd, "txMinInterval",
+ bfd_config->min_tx);
+ json_object_object_add(json, "peerBfdInfo", json_bfd);
+ } else
+ vty_out(vty,
+ " BFD: Detect Multiplier: %d, Min Rx interval: %d, Min Tx interval: %d\n",
+ bfd_config->detection_multiplier, bfd_config->min_rx,
+ bfd_config->min_tx);
}
DEFUN (ip_ospf_bfd,
@@ -391,17 +213,8 @@ DEFUN (ip_ospf_bfd,
"Enables BFD support\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
- struct ospf_if_params *params;
- struct bfd_info *bfd_info;
-
- assert(ifp);
- params = IF_DEF_PARAMS(ifp);
- bfd_info = params->bfd_info;
-
- if (!bfd_info || !CHECK_FLAG(bfd_info->flags, BFD_FLAG_PARAM_CFG))
- ospf_bfd_if_param_set(ifp, BFD_DEF_MIN_RX, BFD_DEF_MIN_TX,
- BFD_DEF_DETECT_MULT, 1);
-
+ ospf_interface_enable_bfd(ifp);
+ ospf_interface_bfd_apply(ifp);
return CMD_SUCCESS;
}
@@ -421,23 +234,63 @@ DEFUN(
"Desired min transmit interval\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
+ struct ospf_if_params *params;
int idx_number = 3;
int idx_number_2 = 4;
int idx_number_3 = 5;
- uint32_t rx_val;
- uint32_t tx_val;
- uint8_t dm_val;
- int ret;
- assert(ifp);
+ ospf_interface_enable_bfd(ifp);
+
+ params = IF_DEF_PARAMS(ifp);
+ params->bfd_config->detection_multiplier =
+ strtol(argv[idx_number]->arg, NULL, 10);
+ params->bfd_config->min_rx = strtol(argv[idx_number_2]->arg, NULL, 10);
+ params->bfd_config->min_tx = strtol(argv[idx_number_3]->arg, NULL, 10);
+
+ ospf_interface_bfd_apply(ifp);
+
+ return CMD_SUCCESS;
+}
- if ((ret = bfd_validate_param(
- vty, argv[idx_number]->arg, argv[idx_number_2]->arg,
- argv[idx_number_3]->arg, &dm_val, &rx_val, &tx_val))
- != CMD_SUCCESS)
- return ret;
+DEFUN (ip_ospf_bfd_prof,
+ ip_ospf_bfd_prof_cmd,
+ "ip ospf bfd profile BFDPROF",
+ "IP Information\n"
+ "OSPF interface commands\n"
+ "Enables BFD support\n"
+ BFD_PROFILE_STR
+ BFD_PROFILE_NAME_STR)
+{
+ VTY_DECLVAR_CONTEXT(interface, ifp);
+ struct ospf_if_params *params;
+ int idx_prof = 4;
- ospf_bfd_if_param_set(ifp, rx_val, tx_val, dm_val, 0);
+ ospf_interface_enable_bfd(ifp);
+ params = IF_DEF_PARAMS(ifp);
+ strlcpy(params->bfd_config->profile, argv[idx_prof]->arg,
+ sizeof(params->bfd_config->profile));
+ ospf_interface_bfd_apply(ifp);
+
+ return CMD_SUCCESS;
+}
+
+DEFUN (no_ip_ospf_bfd_prof,
+ no_ip_ospf_bfd_prof_cmd,
+ "no ip ospf bfd profile [BFDPROF]",
+ NO_STR
+ "IP Information\n"
+ "OSPF interface commands\n"
+ "Enables BFD support\n"
+ BFD_PROFILE_STR
+ BFD_PROFILE_NAME_STR)
+{
+ VTY_DECLVAR_CONTEXT(interface, ifp);
+ struct ospf_if_params *params;
+
+ ospf_interface_enable_bfd(ifp);
+ params = IF_DEF_PARAMS(ifp);
+ params->bfd_config->profile[0] = 0;
+ ospf_interface_bfd_apply(ifp);
return CMD_SUCCESS;
}
@@ -461,29 +314,18 @@ DEFUN (no_ip_ospf_bfd,
)
{
VTY_DECLVAR_CONTEXT(interface, ifp);
- struct ospf_if_params *params;
-
- assert(ifp);
-
- params = IF_DEF_PARAMS(ifp);
- if (params->bfd_info) {
- ospf_bfd_reg_dereg_all_nbr(ifp, ZEBRA_BFD_DEST_DEREGISTER);
- bfd_info_free(&(params->bfd_info));
- }
-
+ ospf_interface_disable_bfd(ifp, IF_DEF_PARAMS(ifp));
return CMD_SUCCESS;
}
-void ospf_bfd_init(void)
+void ospf_bfd_init(struct thread_master *tm)
{
- bfd_gbl_init();
-
- /* Initialize BFD client functions */
- zclient->interface_bfd_dest_update = ospf_bfd_interface_dest_update;
- zclient->bfd_dest_replay = ospf_bfd_nbr_replay;
+ bfd_protocol_integration_init(zclient, tm);
/* Install BFD command */
install_element(INTERFACE_NODE, &ip_ospf_bfd_cmd);
install_element(INTERFACE_NODE, &ip_ospf_bfd_param_cmd);
+ install_element(INTERFACE_NODE, &ip_ospf_bfd_prof_cmd);
+ install_element(INTERFACE_NODE, &no_ip_ospf_bfd_prof_cmd);
install_element(INTERFACE_NODE, &no_ip_ospf_bfd_cmd);
}
diff --git a/ospfd/ospf_bfd.h b/ospfd/ospf_bfd.h
index 74385d3268..9393c839f5 100644
--- a/ospfd/ospf_bfd.h
+++ b/ospfd/ospf_bfd.h
@@ -23,27 +23,34 @@
#ifndef _ZEBRA_OSPF_BFD_H
#define _ZEBRA_OSPF_BFD_H
+#include "ospfd/ospf_interface.h"
#include "json.h"
-extern void ospf_bfd_init(void);
+extern void ospf_bfd_init(struct thread_master *tm);
extern void ospf_bfd_write_config(struct vty *vty,
- struct ospf_if_params *params);
+ const struct ospf_if_params *params);
extern void ospf_bfd_trigger_event(struct ospf_neighbor *nbr, int old_state,
int state);
-extern void ospf_bfd_interface_show(struct vty *vty, struct interface *ifp,
- json_object *json_interface_sub,
- bool use_json);
-
-extern void ospf_bfd_info_nbr_create(struct ospf_interface *oi,
- struct ospf_neighbor *nbr);
+/**
+ * Legacy information: it is the peers who actually have this information
+ * and the protocol should not need to know about timers.
+ */
+extern void ospf_interface_bfd_show(struct vty *vty,
+ const struct interface *ifp,
+ struct json_object *json);
-extern void ospf_bfd_show_info(struct vty *vty, void *bfd_info,
- json_object *json_obj, bool use_json,
- int param_only);
+/**
+ * Disables interface BFD configuration and remove settings from all peers.
+ */
+extern void ospf_interface_disable_bfd(struct interface *ifp,
+ struct ospf_if_params *oip);
-extern void ospf_bfd_info_free(void **bfd_info);
+/**
+ * Create/update BFD session for this OSPF neighbor.
+ */
+extern void ospf_neighbor_bfd_apply(struct ospf_neighbor *nbr);
#endif /* _ZEBRA_OSPF_BFD_H */
diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c
index 19829d4546..2442f2e781 100644
--- a/ospfd/ospf_dump.c
+++ b/ospfd/ospf_dump.c
@@ -21,6 +21,7 @@
#include <zebra.h>
+#include "lib/bfd.h"
#include "monotime.h"
#include "linklist.h"
#include "thread.h"
@@ -60,6 +61,7 @@ unsigned long conf_debug_ospf_ti_lfa = 0;
unsigned long conf_debug_ospf_defaultinfo = 0;
unsigned long conf_debug_ospf_ldp_sync = 0;
unsigned long conf_debug_ospf_gr = 0;
+unsigned long conf_debug_ospf_bfd;
/* Enable debug option variables -- valid only session. */
unsigned long term_debug_ospf_packet[5] = {0, 0, 0, 0, 0};
@@ -76,6 +78,7 @@ unsigned long term_debug_ospf_ti_lfa = 0;
unsigned long term_debug_ospf_defaultinfo;
unsigned long term_debug_ospf_ldp_sync;
unsigned long term_debug_ospf_gr = 0;
+unsigned long term_debug_ospf_bfd;
const char *ospf_redist_string(unsigned int route_type)
{
@@ -1563,6 +1566,31 @@ DEFPY (debug_ospf_gr,
return CMD_SUCCESS;
}
+DEFPY(debug_ospf_bfd, debug_ospf_bfd_cmd,
+ "[no] debug ospf bfd",
+ NO_STR
+ DEBUG_STR
+ OSPF_STR
+ "Bidirection Forwarding Detection\n")
+{
+ if (vty->node == CONFIG_NODE) {
+ if (no) {
+ bfd_protocol_integration_set_debug(false);
+ CONF_DEBUG_OFF(bfd, BFD_LIB);
+ } else {
+ bfd_protocol_integration_set_debug(true);
+ CONF_DEBUG_ON(bfd, BFD_LIB);
+ }
+ }
+
+ if (no)
+ TERM_DEBUG_OFF(bfd, BFD_LIB);
+ else
+ TERM_DEBUG_ON(bfd, BFD_LIB);
+
+ return CMD_SUCCESS;
+}
+
DEFUN (no_debug_ospf,
no_debug_ospf_cmd,
"no debug ospf",
@@ -1594,6 +1622,10 @@ DEFUN (no_debug_ospf,
DEBUG_OFF(defaultinfo, DEFAULTINFO);
DEBUG_OFF(ldp_sync, LDP_SYNC);
+ /* BFD debugging is two parts: OSPF and library. */
+ DEBUG_OFF(bfd, BFD_LIB);
+ bfd_protocol_integration_set_debug(false);
+
for (i = 0; i < 5; i++)
DEBUG_PACKET_OFF(i, flag);
}
@@ -1621,6 +1653,7 @@ DEFUN (no_debug_ospf,
TERM_DEBUG_OFF(zebra, ZEBRA_REDISTRIBUTE);
TERM_DEBUG_OFF(defaultinfo, DEFAULTINFO);
TERM_DEBUG_OFF(ldp_sync, LDP_SYNC);
+ TERM_DEBUG_OFF(bfd, BFD_LIB);
return CMD_SUCCESS;
}
@@ -1730,6 +1763,10 @@ static int show_debugging_ospf_common(struct vty *vty)
if (IS_DEBUG_OSPF(gr, GR_HELPER) == OSPF_DEBUG_GR_HELPER)
vty_out(vty, " OSPF Graceful Restart Helper debugging is on\n");
+ if (IS_DEBUG_OSPF(bfd, BFD_LIB) == OSPF_DEBUG_BFD_LIB)
+ vty_out(vty,
+ " OSPF BFD integration library debugging is on\n");
+
vty_out(vty, "\n");
return CMD_SUCCESS;
@@ -1917,6 +1954,11 @@ static int config_write_debug(struct vty *vty)
write = 1;
}
+ if (IS_CONF_DEBUG_OSPF(bfd, BFD_LIB) == OSPF_DEBUG_BFD_LIB) {
+ vty_out(vty, "debug ospf%s bfd\n", str);
+ write = 1;
+ }
+
return write;
}
@@ -1949,6 +1991,7 @@ void ospf_debug_init(void)
install_element(ENABLE_NODE, &no_debug_ospf_default_info_cmd);
install_element(ENABLE_NODE, &no_debug_ospf_ldp_sync_cmd);
install_element(ENABLE_NODE, &debug_ospf_gr_cmd);
+ install_element(ENABLE_NODE, &debug_ospf_bfd_cmd);
install_element(ENABLE_NODE, &show_debugging_ospf_instance_cmd);
install_element(ENABLE_NODE, &debug_ospf_packet_cmd);
@@ -1992,6 +2035,7 @@ void ospf_debug_init(void)
install_element(CONFIG_NODE, &no_debug_ospf_default_info_cmd);
install_element(CONFIG_NODE, &no_debug_ospf_ldp_sync_cmd);
install_element(CONFIG_NODE, &debug_ospf_gr_cmd);
+ install_element(CONFIG_NODE, &debug_ospf_bfd_cmd);
install_element(CONFIG_NODE, &debug_ospf_instance_nsm_cmd);
install_element(CONFIG_NODE, &debug_ospf_instance_lsa_cmd);
diff --git a/ospfd/ospf_dump.h b/ospfd/ospf_dump.h
index c4c5606663..b1c1d02a51 100644
--- a/ospfd/ospf_dump.h
+++ b/ospfd/ospf_dump.h
@@ -67,6 +67,8 @@
#define OSPF_DEBUG_GR_HELPER 0x01
#define OSPF_DEBUG_GR 0x03
+#define OSPF_DEBUG_BFD_LIB 0x01
+
/* Macro for setting debug option. */
#define CONF_DEBUG_PACKET_ON(a, b) conf_debug_ospf_packet[a] |= (b)
#define CONF_DEBUG_PACKET_OFF(a, b) conf_debug_ospf_packet[a] &= ~(b)
@@ -140,6 +142,7 @@ extern unsigned long term_debug_ospf_ti_lfa;
extern unsigned long term_debug_ospf_defaultinfo;
extern unsigned long term_debug_ospf_ldp_sync;
extern unsigned long term_debug_ospf_gr;
+extern unsigned long term_debug_ospf_bfd;
/* Message Strings. */
extern char *ospf_lsa_type_str[];
diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c
index 51599ccc8a..d494f0fbce 100644
--- a/ospfd/ospf_interface.c
+++ b/ospfd/ospf_interface.c
@@ -35,6 +35,7 @@
#include "ldp_sync.h"
#include "ospfd/ospfd.h"
+#include "ospfd/ospf_bfd.h"
#include "ospfd/ospf_spf.h"
#include "ospfd/ospf_interface.h"
#include "ospfd/ospf_ism.h"
@@ -49,11 +50,11 @@
#include "ospfd/ospf_dump.h"
#include "ospfd/ospf_ldp_sync.h"
-DEFINE_QOBJ_TYPE(ospf_interface)
-DEFINE_HOOK(ospf_vl_add, (struct ospf_vl_data * vd), (vd))
-DEFINE_HOOK(ospf_vl_delete, (struct ospf_vl_data * vd), (vd))
-DEFINE_HOOK(ospf_if_update, (struct interface * ifp), (ifp))
-DEFINE_HOOK(ospf_if_delete, (struct interface * ifp), (ifp))
+DEFINE_QOBJ_TYPE(ospf_interface);
+DEFINE_HOOK(ospf_vl_add, (struct ospf_vl_data * vd), (vd));
+DEFINE_HOOK(ospf_vl_delete, (struct ospf_vl_data * vd), (vd));
+DEFINE_HOOK(ospf_if_update, (struct interface * ifp), (ifp));
+DEFINE_HOOK(ospf_if_delete, (struct interface * ifp), (ifp));
int ospf_interface_neighbor_count(struct ospf_interface *oi)
{
@@ -545,10 +546,11 @@ static struct ospf_if_params *ospf_new_if_params(void)
return oip;
}
-void ospf_del_if_params(struct ospf_if_params *oip)
+static void ospf_del_if_params(struct interface *ifp,
+ struct ospf_if_params *oip)
{
list_delete(&oip->auth_crypt);
- bfd_info_free(&(oip->bfd_info));
+ ospf_interface_disable_bfd(ifp, oip);
ldp_sync_info_free(&(oip->ldp_sync_info));
XFREE(MTYPE_OSPF_IF_PARAMS, oip);
}
@@ -582,7 +584,7 @@ void ospf_free_if_params(struct interface *ifp, struct in_addr addr)
&& !OSPF_IF_PARAM_CONFIGURED(oip, auth_type)
&& !OSPF_IF_PARAM_CONFIGURED(oip, if_area)
&& listcount(oip->auth_crypt) == 0) {
- ospf_del_if_params(oip);
+ ospf_del_if_params(ifp, oip);
rn->info = NULL;
route_unlock_node(rn);
}
@@ -696,10 +698,10 @@ static int ospf_if_delete_hook(struct interface *ifp)
for (rn = route_top(IF_OIFS_PARAMS(ifp)); rn; rn = route_next(rn))
if (rn->info)
- ospf_del_if_params(rn->info);
+ ospf_del_if_params(ifp, rn->info);
route_table_finish(IF_OIFS_PARAMS(ifp));
- ospf_del_if_params((struct ospf_if_params *)IF_DEF_PARAMS(ifp));
+ ospf_del_if_params(ifp, IF_DEF_PARAMS(ifp));
XFREE(MTYPE_OSPF_IF_INFO, ifp->info);
return rc;
diff --git a/ospfd/ospf_interface.h b/ospfd/ospf_interface.h
index bf59af16c2..a9534f543d 100644
--- a/ospfd/ospf_interface.h
+++ b/ospfd/ospf_interface.h
@@ -22,6 +22,7 @@
#ifndef _ZEBRA_OSPF_INTERFACE_H
#define _ZEBRA_OSPF_INTERFACE_H
+#include "lib/bfd.h"
#include "qobj.h"
#include "hook.h"
#include "ospfd/ospf_packet.h"
@@ -104,7 +105,16 @@ struct ospf_if_params {
uint32_t network_lsa_seqnum; /* Network LSA seqnum */
/* BFD configuration */
- struct bfd_info *bfd_info;
+ struct bfd_configuration {
+ /** BFD session detection multiplier. */
+ uint8_t detection_multiplier;
+ /** BFD session minimum required receive interval. */
+ uint32_t min_rx;
+ /** BFD session minimum required transmission interval. */
+ uint32_t min_tx;
+ /** BFD profile. */
+ char profile[BFD_PROFILE_NAME_LEN];
+ } *bfd_config;
/* MPLS LDP-IGP Sync configuration */
struct ldp_sync_info *ldp_sync_info;
@@ -252,9 +262,9 @@ struct ospf_interface {
uint32_t full_nbrs;
- QOBJ_FIELDS
+ QOBJ_FIELDS;
};
-DECLARE_QOBJ_TYPE(ospf_interface)
+DECLARE_QOBJ_TYPE(ospf_interface);
/* Prototypes. */
extern char *ospf_if_name(struct ospf_interface *);
@@ -285,7 +295,6 @@ extern struct ospf_if_params *ospf_lookup_if_params(struct interface *,
struct in_addr);
extern struct ospf_if_params *ospf_get_if_params(struct interface *,
struct in_addr);
-extern void ospf_del_if_params(struct ospf_if_params *);
extern void ospf_free_if_params(struct interface *, struct in_addr);
extern void ospf_if_update_params(struct interface *, struct in_addr);
@@ -329,10 +338,10 @@ extern void ospf_if_set_multicast(struct ospf_interface *);
extern void ospf_if_interface(struct interface *ifp);
-DECLARE_HOOK(ospf_vl_add, (struct ospf_vl_data * vd), (vd))
-DECLARE_HOOK(ospf_vl_delete, (struct ospf_vl_data * vd), (vd))
+DECLARE_HOOK(ospf_vl_add, (struct ospf_vl_data * vd), (vd));
+DECLARE_HOOK(ospf_vl_delete, (struct ospf_vl_data * vd), (vd));
-DECLARE_HOOK(ospf_if_update, (struct interface * ifp), (ifp))
-DECLARE_HOOK(ospf_if_delete, (struct interface * ifp), (ifp))
+DECLARE_HOOK(ospf_if_update, (struct interface * ifp), (ifp));
+DECLARE_HOOK(ospf_if_delete, (struct interface * ifp), (ifp));
#endif /* _ZEBRA_OSPF_INTERFACE_H */
diff --git a/ospfd/ospf_ism.c b/ospfd/ospf_ism.c
index 36e97f8779..1850d946b8 100644
--- a/ospfd/ospf_ism.c
+++ b/ospfd/ospf_ism.c
@@ -45,7 +45,7 @@
DEFINE_HOOK(ospf_ism_change,
(struct ospf_interface * oi, int state, int oldstate),
- (oi, state, oldstate))
+ (oi, state, oldstate));
/* elect DR and BDR. Refer to RFC2319 section 9.4 */
static struct ospf_neighbor *ospf_dr_election_sub(struct list *routers)
diff --git a/ospfd/ospf_ism.h b/ospfd/ospf_ism.h
index c41ba6c843..5d0f95aed1 100644
--- a/ospfd/ospf_ism.h
+++ b/ospfd/ospf_ism.h
@@ -97,6 +97,6 @@ extern int ospf_dr_election(struct ospf_interface *oi);
DECLARE_HOOK(ospf_ism_change,
(struct ospf_interface * oi, int state, int oldstate),
- (oi, state, oldstate))
+ (oi, state, oldstate));
#endif /* _ZEBRA_OSPF_ISM_H */
diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c
index 6bde5467b2..cb1c565d37 100644
--- a/ospfd/ospf_lsa.c
+++ b/ospfd/ospf_lsa.c
@@ -1765,7 +1765,14 @@ static struct ospf_lsa *ospf_lsa_translated_nssa_new(struct ospf *ospf,
/* copy over Type-7 data to new */
extnew->e[0].tos = ext->e[0].tos;
extnew->e[0].route_tag = ext->e[0].route_tag;
- extnew->e[0].fwd_addr.s_addr = ext->e[0].fwd_addr.s_addr;
+ if (type7->area->suppress_fa) {
+ extnew->e[0].fwd_addr.s_addr = 0;
+ if (IS_DEBUG_OSPF_NSSA)
+ zlog_debug(
+ "ospf_lsa_translated_nssa_new(): Suppress forwarding address for %pI4",
+ &ei.p.prefix);
+ } else
+ extnew->e[0].fwd_addr.s_addr = ext->e[0].fwd_addr.s_addr;
new->data->ls_seqnum = type7->data->ls_seqnum;
/* add translated flag, checksum and lock new lsa */
@@ -1777,7 +1784,8 @@ static struct ospf_lsa *ospf_lsa_translated_nssa_new(struct ospf *ospf,
/* Originate Translated Type-5 for supplied Type-7 NSSA LSA */
struct ospf_lsa *ospf_translated_nssa_originate(struct ospf *ospf,
- struct ospf_lsa *type7)
+ struct ospf_lsa *type7,
+ struct ospf_lsa *type5)
{
struct ospf_lsa *new;
struct as_external_lsa *extnew;
@@ -1796,6 +1804,10 @@ struct ospf_lsa *ospf_translated_nssa_originate(struct ospf *ospf,
extnew = (struct as_external_lsa *)new->data;
+ /* Update LSA sequence number from translated Type-5 LSA */
+ if (type5)
+ new->data->ls_seqnum = lsa_seqnum_increment(type5);
+
if ((new = ospf_lsa_install(ospf, NULL, new)) == NULL) {
flog_warn(EC_OSPF_LSA_INSTALL_FAILURE,
"%s: Could not install LSA id %pI4", __func__,
@@ -1823,6 +1835,8 @@ struct ospf_lsa *ospf_translated_nssa_refresh(struct ospf *ospf,
struct ospf_lsa *type5)
{
struct ospf_lsa *new = NULL;
+ struct as_external_lsa *extold = NULL;
+ uint32_t ls_seqnum = 0;
/* Sanity checks. */
assert(type7 || type5);
@@ -1887,6 +1901,12 @@ struct ospf_lsa *ospf_translated_nssa_refresh(struct ospf *ospf,
return NULL;
}
+ extold = (struct as_external_lsa *)type5->data;
+ if (type7->area->suppress_fa == 1) {
+ if (extold->e[0].fwd_addr.s_addr == 0)
+ ls_seqnum = ntohl(type5->data->ls_seqnum);
+ }
+
/* Delete LSA from neighbor retransmit-list. */
ospf_ls_retransmit_delete_nbr_as(ospf, type5);
@@ -1899,6 +1919,11 @@ struct ospf_lsa *ospf_translated_nssa_refresh(struct ospf *ospf,
return NULL;
}
+ if (type7->area->suppress_fa == 1) {
+ if (extold->e[0].fwd_addr.s_addr == 0)
+ new->data->ls_seqnum = htonl(ls_seqnum + 1);
+ }
+
if (!(new = ospf_lsa_install(ospf, NULL, new))) {
flog_warn(
EC_OSPF_LSA_INSTALL_FAILURE,
diff --git a/ospfd/ospf_lsa.h b/ospfd/ospf_lsa.h
index f2a0d36e7e..3c1f94e628 100644
--- a/ospfd/ospf_lsa.h
+++ b/ospfd/ospf_lsa.h
@@ -341,11 +341,12 @@ extern char link_info_set(struct stream **s, struct in_addr id,
extern struct in_addr ospf_get_nssa_ip(struct ospf_area *);
extern int ospf_translated_nssa_compare(struct ospf_lsa *, struct ospf_lsa *);
-extern struct ospf_lsa *ospf_translated_nssa_refresh(struct ospf *,
- struct ospf_lsa *,
- struct ospf_lsa *);
-extern struct ospf_lsa *ospf_translated_nssa_originate(struct ospf *,
- struct ospf_lsa *);
+extern struct ospf_lsa *ospf_translated_nssa_refresh(struct ospf *ospf,
+ struct ospf_lsa *type7,
+ struct ospf_lsa *type5);
+extern struct ospf_lsa *ospf_translated_nssa_originate(struct ospf *ospf,
+ struct ospf_lsa *type7,
+ struct ospf_lsa *type5);
extern void ospf_flush_lsa_from_area(struct ospf *ospf, struct in_addr area_id,
int type);
#endif /* _ZEBRA_OSPF_LSA_H */
diff --git a/ospfd/ospf_main.c b/ospfd/ospf_main.c
index 6a90dbff11..d23dea0ca1 100644
--- a/ospfd/ospf_main.c
+++ b/ospfd/ospf_main.c
@@ -22,6 +22,7 @@
#include <zebra.h>
#include <lib/version.h>
+#include "bfd.h"
#include "getopt.h"
#include "thread.h"
#include "prefix.h"
@@ -98,6 +99,7 @@ static void sighup(void)
static void sigint(void)
{
zlog_notice("Terminating on signal");
+ bfd_protocol_integration_set_shutdown(true);
ospf_terminate();
exit(0);
}
@@ -141,7 +143,8 @@ FRR_DAEMON_INFO(ospfd, OSPF, .vty_port = OSPF_VTY_PORT,
.signals = ospf_signals, .n_signals = array_size(ospf_signals),
.privs = &ospfd_privs, .yang_modules = ospfd_yang_modules,
- .n_yang_modules = array_size(ospfd_yang_modules), )
+ .n_yang_modules = array_size(ospfd_yang_modules),
+);
/* OSPFd main routine. */
int main(int argc, char **argv)
@@ -213,7 +216,7 @@ int main(int argc, char **argv)
ospf_vty_clear_init();
/* OSPF BFD init */
- ospf_bfd_init();
+ ospf_bfd_init(master);
/* OSPF LDP IGP Sync init */
ospf_ldp_sync_init();
diff --git a/ospfd/ospf_memory.c b/ospfd/ospf_memory.c
index f4fb68cbdf..2838443892 100644
--- a/ospfd/ospf_memory.c
+++ b/ospfd/ospf_memory.c
@@ -25,38 +25,38 @@
#include "ospf_memory.h"
-DEFINE_MGROUP(OSPFD, "ospfd")
-DEFINE_MTYPE(OSPFD, OSPF_TOP, "OSPF top")
-DEFINE_MTYPE(OSPFD, OSPF_AREA, "OSPF area")
-DEFINE_MTYPE(OSPFD, OSPF_AREA_RANGE, "OSPF area range")
-DEFINE_MTYPE(OSPFD, OSPF_NETWORK, "OSPF network")
-DEFINE_MTYPE(OSPFD, OSPF_NEIGHBOR_STATIC, "OSPF static nbr")
-DEFINE_MTYPE(OSPFD, OSPF_IF, "OSPF interface")
-DEFINE_MTYPE(OSPFD, OSPF_NEIGHBOR, "OSPF neighbor")
-DEFINE_MTYPE(OSPFD, OSPF_ROUTE, "OSPF route")
-DEFINE_MTYPE(OSPFD, OSPF_TMP, "OSPF tmp mem")
-DEFINE_MTYPE(OSPFD, OSPF_LSA, "OSPF LSA")
-DEFINE_MTYPE(OSPFD, OSPF_LSA_DATA, "OSPF LSA data")
-DEFINE_MTYPE(OSPFD, OSPF_LSDB, "OSPF LSDB")
-DEFINE_MTYPE(OSPFD, OSPF_PACKET, "OSPF packet")
-DEFINE_MTYPE(OSPFD, OSPF_FIFO, "OSPF FIFO queue")
-DEFINE_MTYPE(OSPFD, OSPF_VERTEX, "OSPF vertex")
-DEFINE_MTYPE(OSPFD, OSPF_VERTEX_PARENT, "OSPF vertex parent")
-DEFINE_MTYPE(OSPFD, OSPF_NEXTHOP, "OSPF nexthop")
-DEFINE_MTYPE(OSPFD, OSPF_PATH, "OSPF path")
-DEFINE_MTYPE(OSPFD, OSPF_VL_DATA, "OSPF VL data")
-DEFINE_MTYPE(OSPFD, OSPF_CRYPT_KEY, "OSPF crypt key")
-DEFINE_MTYPE(OSPFD, OSPF_EXTERNAL_INFO, "OSPF ext. info")
-DEFINE_MTYPE(OSPFD, OSPF_DISTANCE, "OSPF distance")
-DEFINE_MTYPE(OSPFD, OSPF_IF_INFO, "OSPF if info")
-DEFINE_MTYPE(OSPFD, OSPF_IF_PARAMS, "OSPF if params")
-DEFINE_MTYPE(OSPFD, OSPF_MESSAGE, "OSPF message")
-DEFINE_MTYPE(OSPFD, OSPF_MPLS_TE, "OSPF MPLS parameters")
-DEFINE_MTYPE(OSPFD, OSPF_ROUTER_INFO, "OSPF Router Info parameters")
-DEFINE_MTYPE(OSPFD, OSPF_PCE_PARAMS, "OSPF PCE parameters")
-DEFINE_MTYPE(OSPFD, OSPF_EXT_PARAMS, "OSPF Extended parameters")
-DEFINE_MTYPE(OSPFD, OSPF_SR_PARAMS, "OSPF Segment Routing parameters")
-DEFINE_MTYPE(OSPFD, OSPF_GR_HELPER, "OSPF Graceful Restart Helper")
-DEFINE_MTYPE(OSPFD, OSPF_EXTERNAL_RT_AGGR, "OSPF External Route Summarisation")
-DEFINE_MTYPE(OSPFD, OSPF_P_SPACE, "OSPF TI-LFA P-Space")
-DEFINE_MTYPE(OSPFD, OSPF_Q_SPACE, "OSPF TI-LFA Q-Space")
+DEFINE_MGROUP(OSPFD, "ospfd");
+DEFINE_MTYPE(OSPFD, OSPF_TOP, "OSPF top");
+DEFINE_MTYPE(OSPFD, OSPF_AREA, "OSPF area");
+DEFINE_MTYPE(OSPFD, OSPF_AREA_RANGE, "OSPF area range");
+DEFINE_MTYPE(OSPFD, OSPF_NETWORK, "OSPF network");
+DEFINE_MTYPE(OSPFD, OSPF_NEIGHBOR_STATIC, "OSPF static nbr");
+DEFINE_MTYPE(OSPFD, OSPF_IF, "OSPF interface");
+DEFINE_MTYPE(OSPFD, OSPF_NEIGHBOR, "OSPF neighbor");
+DEFINE_MTYPE(OSPFD, OSPF_ROUTE, "OSPF route");
+DEFINE_MTYPE(OSPFD, OSPF_TMP, "OSPF tmp mem");
+DEFINE_MTYPE(OSPFD, OSPF_LSA, "OSPF LSA");
+DEFINE_MTYPE(OSPFD, OSPF_LSA_DATA, "OSPF LSA data");
+DEFINE_MTYPE(OSPFD, OSPF_LSDB, "OSPF LSDB");
+DEFINE_MTYPE(OSPFD, OSPF_PACKET, "OSPF packet");
+DEFINE_MTYPE(OSPFD, OSPF_FIFO, "OSPF FIFO queue");
+DEFINE_MTYPE(OSPFD, OSPF_VERTEX, "OSPF vertex");
+DEFINE_MTYPE(OSPFD, OSPF_VERTEX_PARENT, "OSPF vertex parent");
+DEFINE_MTYPE(OSPFD, OSPF_NEXTHOP, "OSPF nexthop");
+DEFINE_MTYPE(OSPFD, OSPF_PATH, "OSPF path");
+DEFINE_MTYPE(OSPFD, OSPF_VL_DATA, "OSPF VL data");
+DEFINE_MTYPE(OSPFD, OSPF_CRYPT_KEY, "OSPF crypt key");
+DEFINE_MTYPE(OSPFD, OSPF_EXTERNAL_INFO, "OSPF ext. info");
+DEFINE_MTYPE(OSPFD, OSPF_DISTANCE, "OSPF distance");
+DEFINE_MTYPE(OSPFD, OSPF_IF_INFO, "OSPF if info");
+DEFINE_MTYPE(OSPFD, OSPF_IF_PARAMS, "OSPF if params");
+DEFINE_MTYPE(OSPFD, OSPF_MESSAGE, "OSPF message");
+DEFINE_MTYPE(OSPFD, OSPF_MPLS_TE, "OSPF MPLS parameters");
+DEFINE_MTYPE(OSPFD, OSPF_ROUTER_INFO, "OSPF Router Info parameters");
+DEFINE_MTYPE(OSPFD, OSPF_PCE_PARAMS, "OSPF PCE parameters");
+DEFINE_MTYPE(OSPFD, OSPF_EXT_PARAMS, "OSPF Extended parameters");
+DEFINE_MTYPE(OSPFD, OSPF_SR_PARAMS, "OSPF Segment Routing parameters");
+DEFINE_MTYPE(OSPFD, OSPF_GR_HELPER, "OSPF Graceful Restart Helper");
+DEFINE_MTYPE(OSPFD, OSPF_EXTERNAL_RT_AGGR, "OSPF External Route Summarisation");
+DEFINE_MTYPE(OSPFD, OSPF_P_SPACE, "OSPF TI-LFA P-Space");
+DEFINE_MTYPE(OSPFD, OSPF_Q_SPACE, "OSPF TI-LFA Q-Space");
diff --git a/ospfd/ospf_memory.h b/ospfd/ospf_memory.h
index 42bc8d7b77..9bd0a844af 100644
--- a/ospfd/ospf_memory.h
+++ b/ospfd/ospf_memory.h
@@ -24,40 +24,40 @@
#include "memory.h"
-DECLARE_MGROUP(OSPFD)
-DECLARE_MTYPE(OSPF_TOP)
-DECLARE_MTYPE(OSPF_AREA)
-DECLARE_MTYPE(OSPF_AREA_RANGE)
-DECLARE_MTYPE(OSPF_NETWORK)
-DECLARE_MTYPE(OSPF_NEIGHBOR_STATIC)
-DECLARE_MTYPE(OSPF_IF)
-DECLARE_MTYPE(OSPF_NEIGHBOR)
-DECLARE_MTYPE(OSPF_ROUTE)
-DECLARE_MTYPE(OSPF_TMP)
-DECLARE_MTYPE(OSPF_LSA)
-DECLARE_MTYPE(OSPF_LSA_DATA)
-DECLARE_MTYPE(OSPF_LSDB)
-DECLARE_MTYPE(OSPF_PACKET)
-DECLARE_MTYPE(OSPF_FIFO)
-DECLARE_MTYPE(OSPF_VERTEX)
-DECLARE_MTYPE(OSPF_VERTEX_PARENT)
-DECLARE_MTYPE(OSPF_NEXTHOP)
-DECLARE_MTYPE(OSPF_PATH)
-DECLARE_MTYPE(OSPF_VL_DATA)
-DECLARE_MTYPE(OSPF_CRYPT_KEY)
-DECLARE_MTYPE(OSPF_EXTERNAL_INFO)
-DECLARE_MTYPE(OSPF_DISTANCE)
-DECLARE_MTYPE(OSPF_IF_INFO)
-DECLARE_MTYPE(OSPF_IF_PARAMS)
-DECLARE_MTYPE(OSPF_MESSAGE)
-DECLARE_MTYPE(OSPF_MPLS_TE)
-DECLARE_MTYPE(OSPF_ROUTER_INFO)
-DECLARE_MTYPE(OSPF_PCE_PARAMS)
-DECLARE_MTYPE(OSPF_SR_PARAMS)
-DECLARE_MTYPE(OSPF_EXT_PARAMS)
-DECLARE_MTYPE(OSPF_GR_HELPER)
-DECLARE_MTYPE(OSPF_EXTERNAL_RT_AGGR)
-DECLARE_MTYPE(OSPF_P_SPACE)
-DECLARE_MTYPE(OSPF_Q_SPACE)
+DECLARE_MGROUP(OSPFD);
+DECLARE_MTYPE(OSPF_TOP);
+DECLARE_MTYPE(OSPF_AREA);
+DECLARE_MTYPE(OSPF_AREA_RANGE);
+DECLARE_MTYPE(OSPF_NETWORK);
+DECLARE_MTYPE(OSPF_NEIGHBOR_STATIC);
+DECLARE_MTYPE(OSPF_IF);
+DECLARE_MTYPE(OSPF_NEIGHBOR);
+DECLARE_MTYPE(OSPF_ROUTE);
+DECLARE_MTYPE(OSPF_TMP);
+DECLARE_MTYPE(OSPF_LSA);
+DECLARE_MTYPE(OSPF_LSA_DATA);
+DECLARE_MTYPE(OSPF_LSDB);
+DECLARE_MTYPE(OSPF_PACKET);
+DECLARE_MTYPE(OSPF_FIFO);
+DECLARE_MTYPE(OSPF_VERTEX);
+DECLARE_MTYPE(OSPF_VERTEX_PARENT);
+DECLARE_MTYPE(OSPF_NEXTHOP);
+DECLARE_MTYPE(OSPF_PATH);
+DECLARE_MTYPE(OSPF_VL_DATA);
+DECLARE_MTYPE(OSPF_CRYPT_KEY);
+DECLARE_MTYPE(OSPF_EXTERNAL_INFO);
+DECLARE_MTYPE(OSPF_DISTANCE);
+DECLARE_MTYPE(OSPF_IF_INFO);
+DECLARE_MTYPE(OSPF_IF_PARAMS);
+DECLARE_MTYPE(OSPF_MESSAGE);
+DECLARE_MTYPE(OSPF_MPLS_TE);
+DECLARE_MTYPE(OSPF_ROUTER_INFO);
+DECLARE_MTYPE(OSPF_PCE_PARAMS);
+DECLARE_MTYPE(OSPF_SR_PARAMS);
+DECLARE_MTYPE(OSPF_EXT_PARAMS);
+DECLARE_MTYPE(OSPF_GR_HELPER);
+DECLARE_MTYPE(OSPF_EXTERNAL_RT_AGGR);
+DECLARE_MTYPE(OSPF_P_SPACE);
+DECLARE_MTYPE(OSPF_Q_SPACE);
#endif /* _QUAGGA_OSPF_MEMORY_H */
diff --git a/ospfd/ospf_neighbor.c b/ospfd/ospf_neighbor.c
index 2fa43923ab..a1b35b2fcd 100644
--- a/ospfd/ospf_neighbor.c
+++ b/ospfd/ospf_neighbor.c
@@ -21,6 +21,7 @@
#include <zebra.h>
+#include "lib/bfd.h"
#include "linklist.h"
#include "prefix.h"
#include "memory.h"
@@ -99,8 +100,6 @@ struct ospf_neighbor *ospf_nbr_new(struct ospf_interface *oi)
nbr->crypt_seqnum = 0;
- ospf_bfd_info_nbr_create(oi, nbr);
-
/* Initialize GR Helper info*/
nbr->gr_helper_info.recvd_grace_period = 0;
nbr->gr_helper_info.actual_grace_period = 0;
@@ -149,7 +148,7 @@ void ospf_nbr_free(struct ospf_neighbor *nbr)
/* Cancel all events. */ /* Thread lookup cost would be negligible. */
thread_cancel_event(master, nbr);
- ospf_bfd_info_free(&nbr->bfd_info);
+ bfd_sess_free(&nbr->bfd_session);
OSPF_NSM_TIMER_OFF(nbr->gr_helper_info.t_grace_timer);
@@ -458,6 +457,9 @@ static struct ospf_neighbor *ospf_nbr_add(struct ospf_interface *oi,
if (ntohs(ospfh->auth_type) == OSPF_AUTH_CRYPTOGRAPHIC)
nbr->crypt_seqnum = ospfh->u.crypt.crypt_seqnum;
+ /* Configure BFD if interface has it. */
+ ospf_neighbor_bfd_apply(nbr);
+
if (IS_DEBUG_OSPF_EVENT)
zlog_debug("NSM[%s:%pI4]: start", IF_NAME(oi),
&nbr->router_id);
diff --git a/ospfd/ospf_neighbor.h b/ospfd/ospf_neighbor.h
index 758693e289..2ce6d6755c 100644
--- a/ospfd/ospf_neighbor.h
+++ b/ospfd/ospf_neighbor.h
@@ -88,7 +88,7 @@ struct ospf_neighbor {
uint32_t state_change; /* NSM state change counter */
/* BFD information */
- void *bfd_info;
+ struct bfd_session_params *bfd_session;
/* ospf graceful restart HELPER info */
struct ospf_helper_info gr_helper_info;
diff --git a/ospfd/ospf_nsm.c b/ospfd/ospf_nsm.c
index 26e7855e8c..006c4888ae 100644
--- a/ospfd/ospf_nsm.c
+++ b/ospfd/ospf_nsm.c
@@ -53,7 +53,7 @@
DEFINE_HOOK(ospf_nsm_change,
(struct ospf_neighbor * on, int state, int oldstate),
- (on, state, oldstate))
+ (on, state, oldstate));
static void nsm_clear_adj(struct ospf_neighbor *);
@@ -761,7 +761,8 @@ static void nsm_change_state(struct ospf_neighbor *nbr, int state)
if (state == NSM_Down)
nbr->crypt_seqnum = 0;
- ospf_bfd_trigger_event(nbr, old_state, state);
+ if (nbr->bfd_session)
+ ospf_bfd_trigger_event(nbr, old_state, state);
/* Preserve old status? */
}
diff --git a/ospfd/ospf_nsm.h b/ospfd/ospf_nsm.h
index 24cf05009c..e8573c6301 100644
--- a/ospfd/ospf_nsm.h
+++ b/ospfd/ospf_nsm.h
@@ -78,6 +78,6 @@ extern void ospf_db_summary_clear(struct ospf_neighbor *);
extern int nsm_should_adj(struct ospf_neighbor *nbr);
DECLARE_HOOK(ospf_nsm_change,
(struct ospf_neighbor * on, int state, int oldstate),
- (on, state, oldstate))
+ (on, state, oldstate));
#endif /* _ZEBRA_OSPF_NSM_H */
diff --git a/ospfd/ospf_opaque.c b/ospfd/ospf_opaque.c
index 3939b5479f..ae9ab48d4a 100644
--- a/ospfd/ospf_opaque.c
+++ b/ospfd/ospf_opaque.c
@@ -56,9 +56,9 @@
#include "ospfd/ospf_ext.h"
#include "ospfd/ospf_errors.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")
-DEFINE_MTYPE_STATIC(OSPFD, OPAQUE_INFO_PER_ID, "OSPF opaque per-ID info")
+DEFINE_MTYPE_STATIC(OSPFD, OSPF_OPAQUE_FUNCTAB, "OSPF opaque function table");
+DEFINE_MTYPE_STATIC(OSPFD, OPAQUE_INFO_PER_TYPE, "OSPF opaque per-type info");
+DEFINE_MTYPE_STATIC(OSPFD, OPAQUE_INFO_PER_ID, "OSPF opaque per-ID info");
/*------------------------------------------------------------------------*
* Followings are initialize/terminate functions for Opaque-LSAs handling.
diff --git a/ospfd/ospf_snmp.c b/ospfd/ospf_snmp.c
index 3f4ca44b05..8418bbf2b9 100644
--- a/ospfd/ospf_snmp.c
+++ b/ospfd/ospf_snmp.c
@@ -2565,4 +2565,5 @@ static int ospf_snmp_module_init(void)
FRR_MODULE_SETUP(.name = "ospfd_snmp", .version = FRR_VERSION,
.description = "ospfd AgentX SNMP module",
- .init = ospf_snmp_module_init, )
+ .init = ospf_snmp_module_init,
+);
diff --git a/ospfd/ospf_spf.c b/ospfd/ospf_spf.c
index 6cd6a47098..1e0814764b 100644
--- a/ospfd/ospf_spf.c
+++ b/ospfd/ospf_spf.c
@@ -89,7 +89,7 @@ static int vertex_cmp(const struct vertex *v1, const struct vertex *v2)
}
return 0;
}
-DECLARE_SKIPLIST_NONUNIQ(vertex_pqueue, struct vertex, pqi, vertex_cmp)
+DECLARE_SKIPLIST_NONUNIQ(vertex_pqueue, struct vertex, pqi, vertex_cmp);
static void lsdb_clean_stat(struct ospf_lsdb *lsdb)
{
diff --git a/ospfd/ospf_spf.h b/ospfd/ospf_spf.h
index 66555be4b7..835caab288 100644
--- a/ospfd/ospf_spf.h
+++ b/ospfd/ospf_spf.h
@@ -33,7 +33,7 @@
/* The "root" is the node running the SPF calculation */
-PREDECL_SKIPLIST_NONUNIQ(vertex_pqueue)
+PREDECL_SKIPLIST_NONUNIQ(vertex_pqueue);
/* A router or network in an area */
struct vertex {
struct vertex_pqueue_item pqi;
diff --git a/ospfd/ospf_ti_lfa.c b/ospfd/ospf_ti_lfa.c
index 4a0186bfb9..59b3b624e3 100644
--- a/ospfd/ospf_ti_lfa.c
+++ b/ospfd/ospf_ti_lfa.c
@@ -37,9 +37,9 @@
DECLARE_RBTREE_UNIQ(p_spaces, struct p_space, p_spaces_item,
- p_spaces_compare_func)
+ p_spaces_compare_func);
DECLARE_RBTREE_UNIQ(q_spaces, struct q_space, q_spaces_item,
- q_spaces_compare_func)
+ q_spaces_compare_func);
static void
ospf_ti_lfa_generate_p_space(struct ospf_area *area, struct vertex *child,
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index 2ff59ccf49..d634853b3e 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -60,7 +60,7 @@
FRR_CFG_DEFAULT_BOOL(OSPF_LOG_ADJACENCY_CHANGES,
{ .val_bool = true, .match_profile = "datacenter", },
{ .val_bool = false },
-)
+);
static const char *const ospf_network_type_str[] = {
"Null", "POINTOPOINT", "BROADCAST", "NBMA", "POINTOMULTIPOINT",
@@ -1574,6 +1574,58 @@ DEFUN (ospf_area_nssa,
return ospf_area_nssa_cmd_handler(vty, argc, argv, 0, 0);
}
+DEFUN(ospf_area_nssa_suppress_fa, ospf_area_nssa_suppress_fa_cmd,
+ "area <A.B.C.D|(0-4294967295)> nssa suppress-fa",
+ "OSPF area parameters\n"
+ "OSPF area ID in IP address format\n"
+ "OSPF area ID as a decimal value\n"
+ "Configure OSPF area as nssa\n"
+ "Suppress forwarding address\n")
+{
+ int idx_ipv4_number = 1;
+ struct in_addr area_id;
+ int format;
+
+ VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf);
+ VTY_GET_OSPF_AREA_ID_NO_BB("NSSA", area_id, format,
+ argv[idx_ipv4_number]->arg);
+
+ ospf_area_display_format_set(ospf, ospf_area_get(ospf, area_id),
+ format);
+ ospf_area_nssa_suppress_fa_set(ospf, area_id);
+
+ ospf_schedule_abr_task(ospf);
+
+ return CMD_SUCCESS;
+}
+
+DEFUN(no_ospf_area_nssa_suppress_fa, no_ospf_area_nssa_suppress_fa_cmd,
+ "no area <A.B.C.D|(0-4294967295)> nssa suppress-fa",
+ NO_STR
+ "OSPF area parameters\n"
+ "OSPF area ID in IP address format\n"
+ "OSPF area ID as a decimal value\n"
+ "Configure OSPF area as nssa\n"
+ "Suppress forwarding address\n")
+{
+ int idx_ipv4_number = 2;
+ struct in_addr area_id;
+ int format;
+
+ VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf);
+
+ VTY_GET_OSPF_AREA_ID_NO_BB("nssa", area_id, format,
+ argv[idx_ipv4_number]->arg);
+
+ ospf_area_display_format_set(ospf, ospf_area_get(ospf, area_id),
+ format);
+ ospf_area_nssa_suppress_fa_unset(ospf, area_id);
+
+ ospf_schedule_abr_task(ospf);
+
+ return CMD_SUCCESS;
+}
+
DEFUN (ospf_area_nssa_no_summary,
ospf_area_nssa_no_summary_cmd,
"area <A.B.C.D|(0-4294967295)> nssa no-summary",
@@ -3776,7 +3828,8 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf,
" Neighbor Count is %d, Adjacent neighbor count is %d\n",
ospf_nbr_count(oi, 0),
ospf_nbr_count(oi, NSM_Full));
- ospf_bfd_interface_show(vty, ifp, json_interface_sub, use_json);
+
+ ospf_interface_bfd_show(vty, ifp, json_interface_sub);
/* OSPF Authentication information */
ospf_interface_auth_show(vty, oi, json_interface_sub, use_json);
@@ -5282,7 +5335,7 @@ static void show_ip_ospf_neighbor_detail_sub(struct vty *vty,
.helper_exit_reason));
}
- ospf_bfd_show_info(vty, nbr->bfd_info, json_neigh, use_json, 0);
+ bfd_sess_show(vty, json_neigh, nbr->bfd_session);
if (use_json)
json_object_array_add(json_neigh_array, json_neigh);
@@ -7109,14 +7162,14 @@ DEFUN (show_ip_ospf_database_max,
return ret;
}
-DEFUN (show_ip_ospf_instance_database,
- show_ip_ospf_instance_database_cmd,
- "show ip ospf [{(1-65535)|vrf NAME}] database [<asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as> [A.B.C.D [<self-originate|adv-router A.B.C.D>]]] [json]",
+ALIAS (show_ip_ospf_database_max,
+ show_ip_ospf_database_cmd,
+ "show ip ospf [vrf <NAME|all>] database [<asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as> [A.B.C.D [<self-originate|adv-router A.B.C.D>]]] [json]",
SHOW_STR
IP_STR
"OSPF information\n"
- "Instance ID\n"
VRF_CMD_HELP_STR
+ "All VRFs\n"
"Database summary\n"
OSPF_LSA_TYPES_DESC
"Link State ID (as an IP address)\n"
@@ -7124,78 +7177,6 @@ DEFUN (show_ip_ospf_instance_database,
"Advertising Router link states\n"
"Advertising Router (as an IP address)\n"
JSON_STR)
-{
- struct ospf *ospf;
- unsigned short instance = 0;
- struct listnode *node = NULL;
- char *vrf_name = NULL;
- bool all_vrf = false;
- int ret = CMD_SUCCESS;
- int inst = 0;
- int idx = 0;
- uint8_t use_vrf = 0;
- bool uj = use_json(argc, argv);
- json_object *json = NULL;
-
- if (uj)
- json = json_object_new_object();
-
- if (argv_find(argv, argc, "(1-65535)", &idx)) {
- instance = strtoul(argv[idx]->arg, NULL, 10);
- if (instance != ospf_instance)
- return CMD_NOT_MY_INSTANCE;
-
- ospf = ospf_lookup_instance(instance);
- if (!ospf || !ospf->oi_running)
- return CMD_SUCCESS;
-
- return (show_ip_ospf_database_common(
- vty, ospf, idx ? 1 : 0, argc, argv, use_vrf, json, uj));
- } else if (argv_find(argv, argc, "vrf", &idx)) {
- vrf_name = argv[++idx]->arg;
- all_vrf = strmatch(vrf_name, "all");
- }
-
- if (vrf_name) {
- use_vrf = 1;
- if (all_vrf) {
- for (ALL_LIST_ELEMENTS_RO(om->ospf, node, ospf)) {
- if (!ospf->oi_running)
- continue;
- ret = (show_ip_ospf_database_common(
- vty, ospf, idx ? 2 : 0, argc, argv,
- use_vrf, json, uj));
- }
- } else {
- ospf = ospf_lookup_by_inst_name(inst, vrf_name);
- if ((ospf == NULL) || !ospf->oi_running) {
- vty_out(vty, "%% OSPF instance not found\n");
- return CMD_SUCCESS;
- }
-
- ret = (show_ip_ospf_database_common(
- vty, ospf, idx ? 2 : 0, argc, argv, use_vrf,
- json, uj));
- }
- } else {
- /* Display default ospf (instance 0) info */
- ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT);
- if (ospf == NULL || !ospf->oi_running) {
- vty_out(vty, "%% OSPF instance not found\n");
- return CMD_SUCCESS;
- }
-
- ret = (show_ip_ospf_database_common(vty, ospf, 0, argc, argv,
- use_vrf, json, uj));
- }
-
- if (uj) {
- vty_out(vty, "%s\n", json_object_to_json_string(json));
- json_object_free(json);
- }
-
- return ret;
-}
DEFUN (show_ip_ospf_instance_database_max,
show_ip_ospf_instance_database_max_cmd,
@@ -7238,6 +7219,20 @@ DEFUN (show_ip_ospf_instance_database_max,
return CMD_SUCCESS;
}
+ALIAS (show_ip_ospf_instance_database_max,
+ show_ip_ospf_instance_database_cmd,
+ "show ip ospf (1-65535) database [<asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as> [A.B.C.D [<self-originate|adv-router A.B.C.D>]]] [json]",
+ SHOW_STR
+ IP_STR
+ "OSPF information\n"
+ "Instance ID\n"
+ "Database summary\n"
+ OSPF_LSA_TYPES_DESC
+ "Link State ID (as an IP address)\n"
+ "Self-originated link states\n"
+ "Advertising Router link states\n"
+ "Advertising Router (as an IP address)\n"
+ JSON_STR)
static int show_ip_ospf_database_type_adv_router_common(struct vty *vty,
struct ospf *ospf,
@@ -7327,14 +7322,14 @@ static int show_ip_ospf_database_type_adv_router_common(struct vty *vty,
return CMD_SUCCESS;
}
-DEFUN (show_ip_ospf_instance_database_type_adv_router,
- show_ip_ospf_instance_database_type_adv_router_cmd,
- "show ip ospf [{(1-65535)|vrf NAME}] database <asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as> <adv-router A.B.C.D|self-originate> [json]",
+DEFUN (show_ip_ospf_database_type_adv_router,
+ show_ip_ospf_database_type_adv_router_cmd,
+ "show ip ospf [vrf <NAME|all>] database <asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as> <adv-router A.B.C.D|self-originate> [json]",
SHOW_STR
IP_STR
"OSPF information\n"
- "Instance ID\n"
VRF_CMD_HELP_STR
+ "All VRFs\n"
"Database summary\n"
OSPF_LSA_TYPES_DESC
"Advertising Router link states\n"
@@ -7343,7 +7338,6 @@ DEFUN (show_ip_ospf_instance_database_type_adv_router,
JSON_STR)
{
struct ospf *ospf = NULL;
- unsigned short instance = 0;
struct listnode *node = NULL;
char *vrf_name = NULL;
bool all_vrf = false;
@@ -7357,19 +7351,6 @@ DEFUN (show_ip_ospf_instance_database_type_adv_router,
if (uj)
json = json_object_new_object();
- if (argv_find(argv, argc, "(1-65535)", &idx)) {
- instance = strtoul(argv[idx]->arg, NULL, 10);
- if (instance != ospf_instance)
- return CMD_NOT_MY_INSTANCE;
-
- ospf = ospf_lookup_instance(instance);
- if (!ospf || !ospf->oi_running)
- return CMD_SUCCESS;
-
- return (show_ip_ospf_database_type_adv_router_common(
- vty, ospf, idx ? 1 : 0, argc, argv, use_vrf, json, uj));
- }
-
OSPF_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
if (vrf_name) {
@@ -7416,8 +7397,50 @@ DEFUN (show_ip_ospf_instance_database_type_adv_router,
}
return ret;
- /*return (show_ip_ospf_database_type_adv_router_common(
- vty, ospf, idx ? 1 : 0, argc, argv));*/
+}
+
+DEFUN (show_ip_ospf_instance_database_type_adv_router,
+ show_ip_ospf_instance_database_type_adv_router_cmd,
+ "show ip ospf (1-65535) database <asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as> <adv-router A.B.C.D|self-originate> [json]",
+ SHOW_STR
+ IP_STR
+ "OSPF information\n"
+ "Instance ID\n"
+ "Database summary\n"
+ OSPF_LSA_TYPES_DESC
+ "Advertising Router link states\n"
+ "Advertising Router (as an IP address)\n"
+ "Self-originated link states\n"
+ JSON_STR)
+{
+ int idx_number = 3;
+ struct ospf *ospf;
+ unsigned short instance = 0;
+ bool uj = use_json(argc, argv);
+ json_object *json = NULL;
+
+ if (uj)
+ json = json_object_new_object();
+
+ instance = strtoul(argv[idx_number]->arg, NULL, 10);
+ if (instance != ospf_instance)
+ return CMD_NOT_MY_INSTANCE;
+
+ ospf = ospf_lookup_instance(instance);
+ if (!ospf || !ospf->oi_running)
+ return CMD_SUCCESS;
+
+ show_ip_ospf_database_type_adv_router_common(vty, ospf, 1, argc, argv,
+ 0, json, uj);
+
+ if (uj) {
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
+ json_object_free(json);
+ }
+
+ return CMD_SUCCESS;
}
DEFUN (ip_ospf_authentication_args,
@@ -11716,7 +11739,7 @@ static int config_write_interface_one(struct vty *vty, struct vrf *vrf)
}
/* bfd print. */
- if (params && params->bfd_info)
+ if (params && params->bfd_config)
ospf_bfd_write_config(vty, params);
/* MTU ignore print. */
@@ -11852,6 +11875,10 @@ static int config_write_ospf_area(struct vty *vty, struct ospf *ospf)
vty_out(vty,
" area %s nssa no-summary\n",
buf);
+ if (area->suppress_fa)
+ vty_out(vty,
+ " area %s nssa suppress-fa\n",
+ buf);
}
if (area->default_cost != 1)
@@ -12375,8 +12402,10 @@ void ospf_vty_show_init(void)
install_element(VIEW_NODE, &show_ip_ospf_instance_cmd);
/* "show ip ospf database" commands. */
+ install_element(VIEW_NODE, &show_ip_ospf_database_cmd);
install_element(VIEW_NODE, &show_ip_ospf_database_max_cmd);
-
+ install_element(VIEW_NODE,
+ &show_ip_ospf_database_type_adv_router_cmd);
install_element(VIEW_NODE,
&show_ip_ospf_instance_database_type_adv_router_cmd);
install_element(VIEW_NODE, &show_ip_ospf_instance_database_cmd);
@@ -12711,6 +12740,8 @@ void ospf_vty_init(void)
install_element(OSPF_NODE, &ospf_area_nssa_translate_cmd);
install_element(OSPF_NODE, &ospf_area_nssa_no_summary_cmd);
install_element(OSPF_NODE, &no_ospf_area_nssa_no_summary_cmd);
+ install_element(OSPF_NODE, &ospf_area_nssa_suppress_fa_cmd);
+ install_element(OSPF_NODE, &no_ospf_area_nssa_suppress_fa_cmd);
install_element(OSPF_NODE, &no_ospf_area_nssa_cmd);
install_element(OSPF_NODE, &ospf_area_default_cost_cmd);
diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c
index a2fbd01ab8..56b2f8d660 100644
--- a/ospfd/ospf_zebra.c
+++ b/ospfd/ospf_zebra.c
@@ -53,9 +53,9 @@
#include "ospfd/ospf_sr.h"
#include "ospfd/ospf_ldp_sync.h"
-DEFINE_MTYPE_STATIC(OSPFD, OSPF_EXTERNAL, "OSPF External route table")
-DEFINE_MTYPE_STATIC(OSPFD, OSPF_REDISTRIBUTE, "OSPF Redistriute")
-DEFINE_MTYPE_STATIC(OSPFD, OSPF_DIST_ARGS, "OSPF Distribute arguments")
+DEFINE_MTYPE_STATIC(OSPFD, OSPF_EXTERNAL, "OSPF External route table");
+DEFINE_MTYPE_STATIC(OSPFD, OSPF_REDISTRIBUTE, "OSPF Redistriute");
+DEFINE_MTYPE_STATIC(OSPFD, OSPF_DIST_ARGS, "OSPF Distribute arguments");
/* Zebra structure to hold current status. */
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c
index 9590a9c73b..f126577aeb 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"
@@ -62,7 +63,7 @@
#include "ospfd/ospf_gr_helper.h"
-DEFINE_QOBJ_TYPE(ospf)
+DEFINE_QOBJ_TYPE(ospf);
/* OSPF process wide configuration. */
static struct ospf_master ospf_master;
@@ -111,7 +112,7 @@ int q_spaces_compare_func(const struct q_space *a, const struct q_space *b)
}
DECLARE_RBTREE_UNIQ(p_spaces, struct p_space, p_spaces_item,
- p_spaces_compare_func)
+ p_spaces_compare_func);
void ospf_process_refresh_data(struct ospf *ospf, bool reset)
{
@@ -1671,6 +1672,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 +1694,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 +1710,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 +1960,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);
}
}
diff --git a/ospfd/ospfd.h b/ospfd/ospfd.h
index 5148bf555c..a3f78b074e 100644
--- a/ospfd/ospfd.h
+++ b/ospfd/ospfd.h
@@ -386,9 +386,9 @@ struct ospf {
bool ti_lfa_enabled;
enum protection_type ti_lfa_protection_type;
- QOBJ_FIELDS
+ QOBJ_FIELDS;
};
-DECLARE_QOBJ_TYPE(ospf)
+DECLARE_QOBJ_TYPE(ospf);
enum ospf_ti_lfa_p_q_space_adjacency {
OSPF_TI_LFA_P_Q_SPACE_ADJACENT,
@@ -424,7 +424,7 @@ struct protected_resource {
struct in_addr router_id;
};
-PREDECL_RBTREE_UNIQ(q_spaces)
+PREDECL_RBTREE_UNIQ(q_spaces);
struct q_space {
struct vertex *root;
struct list *vertex_list;
@@ -436,7 +436,7 @@ struct q_space {
struct q_spaces_item q_spaces_item;
};
-PREDECL_RBTREE_UNIQ(p_spaces)
+PREDECL_RBTREE_UNIQ(p_spaces);
struct p_space {
struct vertex *root;
struct protected_resource *protected_resource;
@@ -476,7 +476,7 @@ struct ospf_area {
int shortcut_capability; /* Other ABRs agree on S-bit */
uint32_t default_cost; /* StubDefaultCost. */
int auth_type; /* Authentication type. */
-
+ int suppress_fa; /* Suppress forwarding address in NSSA ABR */
uint8_t NSSATranslatorRole; /* NSSA configured role */
#define OSPF_NSSA_ROLE_NEVER 0
@@ -668,6 +668,10 @@ extern int ospf_area_no_summary_set(struct ospf *, struct in_addr);
extern int ospf_area_no_summary_unset(struct ospf *, struct in_addr);
extern int ospf_area_nssa_set(struct ospf *, struct in_addr);
extern int ospf_area_nssa_unset(struct ospf *, struct in_addr, int);
+extern int ospf_area_nssa_suppress_fa_set(struct ospf *ospf,
+ struct in_addr area_id);
+extern int ospf_area_nssa_suppress_fa_unset(struct ospf *ospf,
+ struct in_addr area_id);
extern int ospf_area_nssa_translator_role_set(struct ospf *, struct in_addr,
int);
extern int ospf_area_export_list_set(struct ospf *, struct ospf_area *,
diff --git a/ospfd/subdir.am b/ospfd/subdir.am
index 28d58452df..25ddef358f 100644
--- a/ospfd/subdir.am
+++ b/ospfd/subdir.am
@@ -113,7 +113,7 @@ ospfd_ospfd_LDADD = ospfd/libfrrospf.a lib/libfrr.la $(LIBCAP) $(LIBM)
ospfd_ospfd_SOURCES = ospfd/ospf_main.c
ospfd_ospfd_snmp_la_SOURCES = ospfd/ospf_snmp.c
-ospfd_ospfd_snmp_la_CFLAGS = $(WERROR) $(SNMP_CFLAGS) -std=gnu99
+ospfd_ospfd_snmp_la_CFLAGS = $(WERROR) $(SNMP_CFLAGS) -std=gnu11
ospfd_ospfd_snmp_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
ospfd_ospfd_snmp_la_LIBADD = lib/libfrrsnmp.la