Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ospfd:reset wait timer when reading ip ospf dead-interval #16954

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ospfd/ospf_ism.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ void ospf_hello_timer(struct event *thread)
OSPF_HELLO_TIMER_ON(oi);
}

static void ospf_wait_timer(struct event *thread)
void ospf_wait_timer(struct event *thread)
{
struct ospf_interface *oi;

Expand Down
1 change: 1 addition & 0 deletions ospfd/ospf_ism.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ extern void ospf_ism_event(struct event *thread);
extern void ism_change_status(struct ospf_interface *, int);
extern void ospf_hello_timer(struct event *thread);
extern int ospf_dr_election(struct ospf_interface *oi);
extern void ospf_wait_timer(struct event *thread);

DECLARE_HOOK(ospf_ism_change,
(struct ospf_interface * oi, int state, int oldstate),
Expand Down
34 changes: 34 additions & 0 deletions ospfd/ospf_vty.c
aceelindem marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -8038,6 +8038,7 @@ static int ospf_vty_dead_interval_set(struct vty *vty, const char *interval_str,
struct ospf_if_params *params;
struct ospf_interface *oi;
struct route_node *rn;
int time_remaining;

params = IF_DEF_PARAMS(ifp);

Expand Down Expand Up @@ -8091,6 +8092,38 @@ static int ospf_vty_dead_interval_set(struct vty *vty, const char *interval_str,
ospf_nbr_timer_update(oi);
}

/*Update wait timer.*/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better comment here with proper formatting.

if (nbr_str) {
struct ospf *ospf = NULL;
ospf = ifp->vrf->info;
if (ospf) {
oi = ospf_if_lookup_by_local_addr(ospf, ifp, addr);
if (oi) {
time_remaining = seconds - event_timer_remain_second(oi->t_wait);
EVENT_OFF(oi->t_wait);
if (time_remaining > 0)
OSPF_ISM_TIMER_ON(oi->t_wait, ospf_wait_timer,
time_remaining);
else
ospf_wait_timer(oi->t_wait);
}
}
} else {
for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next(rn)) {
oi = rn->info;
if (oi) {
time_remaining = seconds - event_timer_remain_second(oi->t_wait);
EVENT_OFF(oi->t_wait);
if (time_remaining > 0)
OSPF_ISM_TIMER_ON(oi->t_wait, ospf_wait_timer,
time_remaining);
else
ospf_wait_timer(oi->t_wait);
}
}
}


if (params->fast_hello != OSPF_FAST_HELLO_DEFAULT)
ospf_reset_hello_timer(ifp, addr, false);
return CMD_SUCCESS;
Expand Down Expand Up @@ -8139,6 +8172,7 @@ DEFUN (ip_ospf_dead_interval_minimal,
{
int idx_number = 5;
int idx_ipv4 = 6;

if (argc == 7)
return ospf_vty_dead_interval_set(
vty, NULL, argv[idx_ipv4]->arg, argv[idx_number]->arg);
Expand Down
Loading