isisd:IS-IS hello packets not sent with configured hello timer

Signed-off-by: Z-Yivon <202100460108@mail.sdu.edn.cn>
This commit is contained in:
Z-Yivon 2025-03-05 18:18:36 +08:00
parent 93c2dc28bc
commit 8088bc39eb
3 changed files with 52 additions and 0 deletions

View file

@ -1661,6 +1661,47 @@ static int isis_ifp_destroy(struct interface *ifp)
return 0; return 0;
} }
/* Reset IS hello timer after interval change */
void isis_reset_hello_timer(struct isis_circuit *circuit)
{
/* First send an immediate hello to prevent adjacency loss
* during longer hello interval transitions
*/
if (circuit->circ_type == CIRCUIT_T_BROADCAST) {
/* For broadcast circuits - need to handle both levels */
if (circuit->is_type & IS_LEVEL_1) {
/* send hello immediately */
send_hello(circuit, IS_LEVEL_1);
/* reset level-1 hello timer */
EVENT_OFF(circuit->u.bc.t_send_lan_hello[0]);
if (circuit->area && (circuit->area->is_type & IS_LEVEL_1))
send_hello_sched(circuit, IS_LEVEL_1,
isis_jitter(circuit->hello_interval[0],
IIH_JITTER));
}
if (circuit->is_type & IS_LEVEL_2) {
/* send hello immediately */
send_hello(circuit, IS_LEVEL_2);
/* reset level-2 hello timer */
EVENT_OFF(circuit->u.bc.t_send_lan_hello[1]);
if (circuit->area && (circuit->area->is_type & IS_LEVEL_2))
send_hello_sched(circuit, IS_LEVEL_2,
isis_jitter(circuit->hello_interval[1],
IIH_JITTER));
}
} else if (circuit->circ_type == CIRCUIT_T_P2P) {
/* For point-to-point circuits */
send_hello(circuit, IS_LEVEL_1);
/* reset hello timer */
EVENT_OFF(circuit->u.p2p.t_send_p2p_hello);
send_hello_sched(circuit, 0, isis_jitter(circuit->hello_interval[0], IIH_JITTER));
}
}
void isis_circuit_init(void) void isis_circuit_init(void)
{ {
/* Initialize Zebra interface data structure */ /* Initialize Zebra interface data structure */

View file

@ -232,6 +232,9 @@ ferr_r isis_circuit_passwd_hmac_md5_set(struct isis_circuit *circuit,
int isis_circuit_mt_enabled_set(struct isis_circuit *circuit, uint16_t mtid, int isis_circuit_mt_enabled_set(struct isis_circuit *circuit, uint16_t mtid,
bool enabled); bool enabled);
/* Reset ISIS hello timer and send immediate hello */
void isis_reset_hello_timer(struct isis_circuit *circuit);
#ifdef FABRICD #ifdef FABRICD
DECLARE_HOOK(isis_circuit_config_write, DECLARE_HOOK(isis_circuit_config_write,
(struct isis_circuit *circuit, struct vty *vty), (struct isis_circuit *circuit, struct vty *vty),

View file

@ -879,9 +879,17 @@ DEFUN (isis_hello_interval,
if (!circuit) if (!circuit)
return CMD_ERR_NO_MATCH; return CMD_ERR_NO_MATCH;
uint32_t old_interval_l1 = circuit->hello_interval[0];
uint32_t old_interval_l2 = circuit->hello_interval[1];
circuit->hello_interval[0] = interval; circuit->hello_interval[0] = interval;
circuit->hello_interval[1] = interval; circuit->hello_interval[1] = interval;
/* if interval changed, reset hello timer */
if (old_interval_l1 != interval || old_interval_l2 != interval) {
isis_reset_hello_timer(circuit);
}
return CMD_SUCCESS; return CMD_SUCCESS;
} }