]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ospfd : Fix for ospf dead interval and hello due.
authorKaushik <kaushik@niralnetworks.com>
Sat, 19 Sep 2020 07:29:25 +0000 (00:29 -0700)
committerIgor Ryzhov <iryzhov@nfware.com>
Tue, 6 Oct 2020 12:54:25 +0000 (15:54 +0300)
1. Ospf dead-interval will be set as 4 times of hello-interval, incase
if it is not set by using "ip ospf dead-interval <dead-val>".
2. On resetting hello-interval using "no ip ospf hello-interval" the
dead interval and hello due will be changed accordingly.

Signed-off-by: Kaushik <kaushik@niralnetworks.com>
ospfd/ospf_interface.c
ospfd/ospf_interface.h
ospfd/ospf_vty.c

index af801da8d702590f59d58d130d1b342dd0b9d519..0a787ab600b0e12988c9e9afbd4f3e09f5c216f7 100644 (file)
@@ -531,6 +531,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;
 }
index 4b3dbcc5c27284e4fe1c051e6676f373a035874c..aa891858577cbba57906676f8cc8bdb488040d02 100644 (file)
@@ -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);
index 8be7748c8775781625a78bc8e1a279ad8875a9d5..77794c2f0575b955d54fc6d410a5ba1a8366b16a 100644 (file)
@@ -7305,6 +7305,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) {
@@ -7414,6 +7415,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;
@@ -7490,6 +7492,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;
 }
 
@@ -7518,6 +7531,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);
 
@@ -7536,6 +7550,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);