summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2020-09-19 08:18:46 -0400
committerGitHub <noreply@github.com>2020-09-19 08:18:46 -0400
commit68f383438dc0d498eaef42037b0e6f90b0fcda01 (patch)
tree970315fa90fc27b785ef320e0a4e62c6b9427523
parent428d9b5b3f41fe6788ea5581669a264176fd0a74 (diff)
parent182d6bdc160ea1cc23b790029dd64a3f138070a5 (diff)
Merge pull request #7133 from Niral-Networks/niral_fix_ospf_timer
ospfd : Fix for ospf dead interval and hello due.
-rw-r--r--ospfd/ospf_interface.c1
-rw-r--r--ospfd/ospf_interface.h1
-rw-r--r--ospfd/ospf_vty.c33
3 files changed, 35 insertions, 0 deletions
diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c
index adc3037598..6bfdb1e9e0 100644
--- a/ospfd/ospf_interface.c
+++ b/ospfd/ospf_interface.c
@@ -539,6 +539,7 @@ static struct ospf_if_params *ospf_new_if_params(void)
oip->auth_crypt = list_new();
oip->network_lsa_seqnum = htonl(OSPF_INITIAL_SEQUENCE_NUMBER);
+ oip->is_v_wait_set = false;
return oip;
}
diff --git a/ospfd/ospf_interface.h b/ospfd/ospf_interface.h
index 1d28eac6b3..bf59af16c2 100644
--- a/ospfd/ospf_interface.h
+++ b/ospfd/ospf_interface.h
@@ -84,6 +84,7 @@ struct ospf_if_params {
DECLARE_IF_PARAM(uint32_t, v_hello); /* Hello Interval */
DECLARE_IF_PARAM(uint32_t, v_wait); /* Router Dead Interval */
+ bool is_v_wait_set; /* Check for Dead Interval set */
/* MTU mismatch check (see RFC2328, chap 10.6) */
DECLARE_IF_PARAM(uint8_t, mtu_ignore);
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index 9d00ff65f9..8099b0160c 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -7310,6 +7310,7 @@ static int ospf_vty_dead_interval_set(struct vty *vty, const char *interval_str,
SET_IF_PARAM(params, v_wait);
params->v_wait = seconds;
+ params->is_v_wait_set = true;
/* Update timer values in neighbor structure. */
if (nbr_str) {
@@ -7419,6 +7420,7 @@ DEFUN (no_ip_ospf_dead_interval,
UNSET_IF_PARAM(params, v_wait);
params->v_wait = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT;
+ params->is_v_wait_set = false;
UNSET_IF_PARAM(params, fast_hello);
params->fast_hello = OSPF_FAST_HELLO_DEFAULT;
@@ -7495,6 +7497,17 @@ DEFUN (ip_ospf_hello_interval,
SET_IF_PARAM(params, v_hello);
params->v_hello = seconds;
+ if (!params->is_v_wait_set) {
+ SET_IF_PARAM(params, v_wait);
+ /* As per RFC 4062
+ * The router dead interval should
+ * be some multiple of the HelloInterval (perhaps 4 times the
+ * hello interval) and must be the same for all routers
+ * attached to a common network.
+ */
+ params->v_wait = 4 * seconds;
+ }
+
return CMD_SUCCESS;
}
@@ -7523,6 +7536,7 @@ DEFUN (no_ip_ospf_hello_interval,
int idx = 0;
struct in_addr addr;
struct ospf_if_params *params;
+ struct route_node *rn;
params = IF_DEF_PARAMS(ifp);
@@ -7541,6 +7555,25 @@ DEFUN (no_ip_ospf_hello_interval,
UNSET_IF_PARAM(params, v_hello);
params->v_hello = OSPF_HELLO_INTERVAL_DEFAULT;
+ if (!params->is_v_wait_set) {
+ UNSET_IF_PARAM(params, v_wait);
+ params->v_wait = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT;
+ }
+
+ for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next(rn)) {
+ struct ospf_interface *oi = rn->info;
+
+ if (!oi)
+ continue;
+
+ oi->type = IF_DEF_PARAMS(ifp)->type;
+
+ if (oi->state > ISM_Down) {
+ OSPF_ISM_EVENT_EXECUTE(oi, ISM_InterfaceDown);
+ OSPF_ISM_EVENT_EXECUTE(oi, ISM_InterfaceUp);
+ }
+ }
+
if (params != IF_DEF_PARAMS(ifp)) {
ospf_free_if_params(ifp, addr);
ospf_if_update_params(ifp, addr);