summaryrefslogtreecommitdiffstats
path: root/ospf6d
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2022-05-16 21:20:12 +0200
committerDonald Sharp <sharpd@nvidia.com>2022-05-16 23:52:10 +0200
commit578e092a046cf4cae6dcd7f7fb593e79d03addf9 (patch)
treeac68291bc97ab05e16d15035e9682332d346fbb2 /ospf6d
parentospf6d: Give time left in hello timer for `show ipv6 ospf6 int` (diff)
downloadfrr-578e092a046cf4cae6dcd7f7fb593e79d03addf9.tar.xz
frr-578e092a046cf4cae6dcd7f7fb593e79d03addf9.zip
ospf6d: Ensure the ospf6 interface hello timer pops in all cases
If a end users does something like this: int enp39s0 ipv6 ospf6 hello-interval 65535 And then the timer pops and we send the hello and immediately if the end user does this: ipv6 ospf6 hello-interval 5 The timer is not being reset and FRR waits the full 65k seconds before sending the hello again, which then immediately sets the next hello to go out in 5 seconds. When FRR receives the new timer value, look at how much time is left on the timer in seconds. If this value is greater than the new hello timer, stop the timer and set it too that value. This should fix a CI system test failure found, where the system is testing setting timer from things like 12 seconds to 65k seconds then back down to 12 and that the ospf6 neighbor relationship stays up. The code was also changed from thread_add_event to thread_add_timer in all cases. I am not sure what would happen if a show command comes in for a thread timer remaining with an event instead of a timer just make it consistent. This was chased down because the support bundle showed this: r0# show ipv6 ospf6 vrf all interface r0-r1-eth0 is up, type BROADCAST Interface ID: 6 Internet Address: inet6: fe80::a4ea:d3ff:fe35:cef1/64 inet6: fd00::1/64 Instance ID 0, Interface MTU 1500 (autodetect: 1500) MTU mismatch detection: enabled Area ID 0.0.0.0, Cost 10 State DR, Transmit Delay 1 sec, Priority 1 Timer intervals configured: Hello 12(65480.960), Dead 48, Retransmit 5 And looking at the test code is doing stuff like this: 2022/05/16 17:08:15 OSPF6: [M7Q4P-46WDR] vty[5]@(config)# interface r1-r0-eth0 2022/05/16 17:08:15 OSPF6: [M7Q4P-46WDR] vty[5]@(config-if)# ipv6 ospf6 hello-interval 65535 2022/05/16 17:08:15 OSPF6: [M7Q4P-46WDR] vty[5]@(config-if)# no ipv6 ospf6 hello-interval 2022/05/16 17:08:16 OSPF6: [M7Q4P-46WDR] vty[5]@(config-if)# ipv6 ospf6 hello-interval 1 2022/05/16 17:08:16 OSPF6: [M7Q4P-46WDR] vty[5]@(config-if)# ipv6 ospf6 hello-interval 12 If the old timer value pops, the hello interval is set to 65k and never reset again. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'ospf6d')
-rw-r--r--ospf6d/ospf6_interface.c14
-rw-r--r--ospf6d/ospf6_message.c1
2 files changed, 12 insertions, 3 deletions
diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c
index e259befc6..c58bb3a0f 100644
--- a/ospf6d/ospf6_interface.c
+++ b/ospf6d/ospf6_interface.c
@@ -827,7 +827,7 @@ void interface_up(struct thread *thread)
/* Schedule Hello */
if (!CHECK_FLAG(oi->flag, OSPF6_INTERFACE_PASSIVE)
&& !if_is_loopback(oi->interface)) {
- thread_add_event(master, ospf6_hello_send, oi, 0,
+ thread_add_timer(master, ospf6_hello_send, oi, 0,
&oi->thread_send_hello);
}
@@ -2102,6 +2102,16 @@ DEFUN (ipv6_ospf6_hellointerval,
oi->hello_interval = strmatch(argv[0]->text, "no")
? OSPF_HELLO_INTERVAL_DEFAULT
: strtoul(argv[idx_number]->arg, NULL, 10);
+
+ /*
+ * If the thread is scheduled, send the new hello now.
+ */
+ if (thread_is_scheduled(oi->thread_send_hello)) {
+ THREAD_OFF(oi->thread_send_hello);
+
+ thread_add_timer(master, ospf6_hello_send, oi, 0,
+ &oi->thread_send_hello);
+ }
return CMD_SUCCESS;
}
@@ -2348,7 +2358,7 @@ DEFUN (no_ipv6_ospf6_passive,
/* don't send hellos over loopback interface */
if (!if_is_loopback(oi->interface))
- thread_add_event(master, ospf6_hello_send, oi, 0,
+ thread_add_timer(master, ospf6_hello_send, oi, 0,
&oi->thread_send_hello);
return CMD_SUCCESS;
diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c
index 6645f83b0..1eede5723 100644
--- a/ospf6d/ospf6_message.c
+++ b/ospf6d/ospf6_message.c
@@ -2242,7 +2242,6 @@ void ospf6_hello_send(struct thread *thread)
uint16_t length = OSPF6_HEADER_SIZE;
oi = (struct ospf6_interface *)THREAD_ARG(thread);
- oi->thread_send_hello = (struct thread *)NULL;
if (oi->state <= OSPF6_INTERFACE_DOWN) {
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_HELLO, SEND_HDR))