summaryrefslogtreecommitdiffstats
path: root/ospfd
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2021-08-04 03:18:21 +0200
committerGitHub <noreply@github.com>2021-08-04 03:18:21 +0200
commit761704b3706291a0d69798cc043e203a1285d9de (patch)
treeea2925ec2f62e88bf6d4285f0a0c4c5a3cffae72 /ospfd
parentMerge pull request #9108 from opensourcerouting/ospf6d-range-fixes (diff)
parentospfd: OSPF hello packets not sent with configured hello timer (diff)
downloadfrr-761704b3706291a0d69798cc043e203a1285d9de.tar.xz
frr-761704b3706291a0d69798cc043e203a1285d9de.zip
Merge pull request #9092 from rgirada/rmap
ospfd: OSPF hello packets not sent with configured hello timer
Diffstat (limited to 'ospfd')
-rw-r--r--ospfd/ospf_interface.c52
-rw-r--r--ospfd/ospf_interface.h3
-rw-r--r--ospfd/ospf_vty.c15
3 files changed, 67 insertions, 3 deletions
diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c
index 029f929c1..e0e61a266 100644
--- a/ospfd/ospf_interface.c
+++ b/ospfd/ospf_interface.c
@@ -1447,6 +1447,58 @@ static int ospf_ifp_destroy(struct interface *ifp)
return 0;
}
+/* Resetting ospf hello timer */
+void ospf_reset_hello_timer(struct interface *ifp, struct in_addr addr,
+ bool is_addr)
+{
+ struct route_node *rn;
+
+ if (is_addr) {
+ struct prefix p;
+ struct ospf_interface *oi = NULL;
+
+ p.u.prefix4 = addr;
+ p.family = AF_INET;
+
+ oi = ospf_if_table_lookup(ifp, &p);
+
+ if (oi) {
+ /* Send hello before restart the hello timer
+ * to avoid session flaps in case of bigger
+ * hello interval configurations.
+ */
+ ospf_hello_send(oi);
+
+ /* Restart hello timer for this interface */
+ OSPF_ISM_TIMER_OFF(oi->t_hello);
+ OSPF_HELLO_TIMER_ON(oi);
+ }
+
+ return;
+ }
+
+ for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next(rn)) {
+ struct ospf_interface *oi = rn->info;
+
+ if (!oi)
+ continue;
+
+ /* If hello interval configured on this oi, don't restart. */
+ if (OSPF_IF_PARAM_CONFIGURED(oi->params, v_hello))
+ continue;
+
+ /* Send hello before restart the hello timer
+ * to avoid session flaps in case of bigger
+ * hello interval configurations.
+ */
+ ospf_hello_send(oi);
+
+ /* Restart the hello timer. */
+ OSPF_ISM_TIMER_OFF(oi->t_hello);
+ OSPF_HELLO_TIMER_ON(oi);
+ }
+}
+
void ospf_if_init(void)
{
if_zapi_callbacks(ospf_ifp_create, ospf_ifp_up,
diff --git a/ospfd/ospf_interface.h b/ospfd/ospf_interface.h
index 4a2114724..7ba6a2b6d 100644
--- a/ospfd/ospf_interface.h
+++ b/ospfd/ospf_interface.h
@@ -345,7 +345,8 @@ extern void ospf_if_set_multicast(struct ospf_interface *);
extern void ospf_if_interface(struct interface *ifp);
extern uint32_t ospf_if_count_area_params(struct interface *ifp);
-
+extern void ospf_reset_hello_timer(struct interface *ifp, struct in_addr addr,
+ bool is_addr);
DECLARE_HOOK(ospf_vl_add, (struct ospf_vl_data * vd), (vd));
DECLARE_HOOK(ospf_vl_delete, (struct ospf_vl_data * vd), (vd));
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index a7b59e791..4c248c0df 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -8312,10 +8312,12 @@ DEFUN (ip_ospf_hello_interval,
{
VTY_DECLVAR_CONTEXT(interface, ifp);
int idx = 0;
- struct in_addr addr;
+ struct in_addr addr = {.s_addr = 0L};
struct ospf_if_params *params;
params = IF_DEF_PARAMS(ifp);
uint32_t seconds = 0;
+ bool is_addr = false;
+ uint32_t old_interval = 0;
argv_find(argv, argc, "(1-65535)", &idx);
seconds = strtol(argv[idx]->arg, NULL, 10);
@@ -8329,8 +8331,15 @@ DEFUN (ip_ospf_hello_interval,
params = ospf_get_if_params(ifp, addr);
ospf_if_update_params(ifp, addr);
+ is_addr = true;
}
+ old_interval = params->v_hello;
+
+ /* Return, if same interval is configured. */
+ if (old_interval == seconds)
+ return CMD_SUCCESS;
+
SET_IF_PARAM(params, v_hello);
params->v_hello = seconds;
@@ -8345,6 +8354,8 @@ DEFUN (ip_ospf_hello_interval,
params->v_wait = 4 * seconds;
}
+ ospf_reset_hello_timer(ifp, addr, is_addr);
+
return CMD_SUCCESS;
}
@@ -8371,7 +8382,7 @@ DEFUN (no_ip_ospf_hello_interval,
{
VTY_DECLVAR_CONTEXT(interface, ifp);
int idx = 0;
- struct in_addr addr;
+ struct in_addr addr = {.s_addr = 0L};
struct ospf_if_params *params;
struct route_node *rn;