Merge pull request #11223 from donaldsharp/ospf_shenanigans

This commit is contained in:
David Lamparter 2022-05-20 18:32:07 +02:00 committed by GitHub
commit 9807de3be3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 71 additions and 70 deletions

View File

@ -2143,14 +2143,6 @@ void debug_signals(const sigset_t *sigs)
zlog_debug("%s: %s", __func__, buf); zlog_debug("%s: %s", __func__, buf);
} }
bool thread_is_scheduled(struct thread *thread)
{
if (thread == NULL)
return false;
return true;
}
static ssize_t printfrr_thread_dbg(struct fbuf *buf, struct printfrr_eargs *ea, static ssize_t printfrr_thread_dbg(struct fbuf *buf, struct printfrr_eargs *ea,
const struct thread *thread) const struct thread *thread)
{ {

View File

@ -283,7 +283,14 @@ extern pthread_key_t thread_current;
extern char *thread_timer_to_hhmmss(char *buf, int buf_size, extern char *thread_timer_to_hhmmss(char *buf, int buf_size,
struct thread *t_timer); struct thread *t_timer);
extern bool thread_is_scheduled(struct thread *thread); static inline bool thread_is_scheduled(struct thread *thread)
{
if (thread)
return true;
return false;
}
/* Debug signal mask */ /* Debug signal mask */
void debug_signals(const sigset_t *sigs); void debug_signals(const sigset_t *sigs);

View File

@ -1121,7 +1121,7 @@ void ospf6_asbr_distribute_list_update(struct ospf6 *ospf6,
{ {
SET_FLAG(red->flag, OSPF6_IS_RMAP_CHANGED); SET_FLAG(red->flag, OSPF6_IS_RMAP_CHANGED);
if (ospf6->t_distribute_update) if (thread_is_scheduled(ospf6->t_distribute_update))
return; return;
if (IS_OSPF6_DEBUG_ASBR) if (IS_OSPF6_DEBUG_ASBR)
@ -3360,7 +3360,7 @@ ospf6_start_asbr_summary_delay_timer(struct ospf6 *ospf6,
{ {
aggr->action = operation; aggr->action = operation;
if (ospf6->t_external_aggr) { if (thread_is_scheduled(ospf6->t_external_aggr)) {
if (ospf6->aggr_action == OSPF6_ROUTE_AGGR_ADD) { if (ospf6->aggr_action == OSPF6_ROUTE_AGGR_ADD) {
if (IS_OSPF6_DEBUG_AGGR) if (IS_OSPF6_DEBUG_AGGR)

View File

@ -459,7 +459,6 @@ static void ospf6_gr_grace_period_expired(struct thread *thread)
{ {
struct ospf6 *ospf6 = THREAD_ARG(thread); struct ospf6 *ospf6 = THREAD_ARG(thread);
ospf6->gr_info.t_grace_period = NULL;
ospf6_gr_restart_exit(ospf6, "grace period has expired"); ospf6_gr_restart_exit(ospf6, "grace period has expired");
} }

View File

@ -400,8 +400,7 @@ int ospf6_process_grace_lsa(struct ospf6 *ospf6, struct ospf6_lsa *lsa,
} }
if (OSPF6_GR_IS_ACTIVE_HELPER(restarter)) { if (OSPF6_GR_IS_ACTIVE_HELPER(restarter)) {
if (restarter->gr_helper_info.t_grace_timer) THREAD_OFF(restarter->gr_helper_info.t_grace_timer);
THREAD_OFF(restarter->gr_helper_info.t_grace_timer);
if (ospf6->ospf6_helper_cfg.active_restarter_cnt > 0) if (ospf6->ospf6_helper_cfg.active_restarter_cnt > 0)
ospf6->ospf6_helper_cfg.active_restarter_cnt--; ospf6->ospf6_helper_cfg.active_restarter_cnt--;

View File

@ -1152,7 +1152,7 @@ static int ospf6_interface_show(struct vty *vty, struct interface *ifp,
if (use_json) { if (use_json) {
timerclear(&res); timerclear(&res);
if (oi->thread_send_lsupdate) if (thread_is_scheduled(oi->thread_send_lsupdate))
timersub(&oi->thread_send_lsupdate->u.sands, &now, timersub(&oi->thread_send_lsupdate->u.sands, &now,
&res); &res);
timerstring(&res, duration, sizeof(duration)); timerstring(&res, duration, sizeof(duration));
@ -1162,7 +1162,9 @@ static int ospf6_interface_show(struct vty *vty, struct interface *ifp,
duration); duration);
json_object_string_add( json_object_string_add(
json_obj, "lsUpdateSendThread", json_obj, "lsUpdateSendThread",
(oi->thread_send_lsupdate ? "on" : "off")); (thread_is_scheduled(oi->thread_send_lsupdate)
? "on"
: "off"));
json_arr = json_object_new_array(); json_arr = json_object_new_array();
for (ALL_LSDB(oi->lsupdate_list, lsa, lsanext)) for (ALL_LSDB(oi->lsupdate_list, lsa, lsanext))
@ -1172,7 +1174,7 @@ static int ospf6_interface_show(struct vty *vty, struct interface *ifp,
json_arr); json_arr);
timerclear(&res); timerclear(&res);
if (oi->thread_send_lsack) if (thread_is_scheduled(oi->thread_send_lsack))
timersub(&oi->thread_send_lsack->u.sands, &now, &res); timersub(&oi->thread_send_lsack->u.sands, &now, &res);
timerstring(&res, duration, sizeof(duration)); timerstring(&res, duration, sizeof(duration));
@ -1180,8 +1182,10 @@ static int ospf6_interface_show(struct vty *vty, struct interface *ifp,
oi->lsack_list->count); oi->lsack_list->count);
json_object_string_add(json_obj, "pendingLsaLsAckTime", json_object_string_add(json_obj, "pendingLsaLsAckTime",
duration); duration);
json_object_string_add(json_obj, "lsAckSendThread", json_object_string_add(
(oi->thread_send_lsack ? "on" : "off")); json_obj, "lsAckSendThread",
(thread_is_scheduled(oi->thread_send_lsack) ? "on"
: "off"));
json_arr = json_object_new_array(); json_arr = json_object_new_array();
for (ALL_LSDB(oi->lsack_list, lsa, lsanext)) for (ALL_LSDB(oi->lsack_list, lsa, lsanext))
@ -1191,25 +1195,28 @@ static int ospf6_interface_show(struct vty *vty, struct interface *ifp,
} else { } else {
timerclear(&res); timerclear(&res);
if (oi->thread_send_lsupdate) if (thread_is_scheduled(oi->thread_send_lsupdate))
timersub(&oi->thread_send_lsupdate->u.sands, &now, timersub(&oi->thread_send_lsupdate->u.sands, &now,
&res); &res);
timerstring(&res, duration, sizeof(duration)); timerstring(&res, duration, sizeof(duration));
vty_out(vty, vty_out(vty,
" %d Pending LSAs for LSUpdate in Time %s [thread %s]\n", " %d Pending LSAs for LSUpdate in Time %s [thread %s]\n",
oi->lsupdate_list->count, duration, oi->lsupdate_list->count, duration,
(oi->thread_send_lsupdate ? "on" : "off")); (thread_is_scheduled(oi->thread_send_lsupdate)
? "on"
: "off"));
for (ALL_LSDB(oi->lsupdate_list, lsa, lsanext)) for (ALL_LSDB(oi->lsupdate_list, lsa, lsanext))
vty_out(vty, " %s\n", lsa->name); vty_out(vty, " %s\n", lsa->name);
timerclear(&res); timerclear(&res);
if (oi->thread_send_lsack) if (thread_is_scheduled(oi->thread_send_lsack))
timersub(&oi->thread_send_lsack->u.sands, &now, &res); timersub(&oi->thread_send_lsack->u.sands, &now, &res);
timerstring(&res, duration, sizeof(duration)); timerstring(&res, duration, sizeof(duration));
vty_out(vty, vty_out(vty,
" %d Pending LSAs for LSAck in Time %s [thread %s]\n", " %d Pending LSAs for LSAck in Time %s [thread %s]\n",
oi->lsack_list->count, duration, oi->lsack_list->count, duration,
(oi->thread_send_lsack ? "on" : "off")); (thread_is_scheduled(oi->thread_send_lsack) ? "on"
: "off"));
for (ALL_LSDB(oi->lsack_list, lsa, lsanext)) for (ALL_LSDB(oi->lsack_list, lsa, lsanext))
vty_out(vty, " %s\n", lsa->name); vty_out(vty, " %s\n", lsa->name);
} }

View File

@ -2339,7 +2339,6 @@ void ospf6_dbdesc_send(struct thread *thread)
struct ospf6_packet *op; struct ospf6_packet *op;
on = (struct ospf6_neighbor *)THREAD_ARG(thread); on = (struct ospf6_neighbor *)THREAD_ARG(thread);
on->thread_send_dbdesc = (struct thread *)NULL;
if (on->state < OSPF6_NEIGHBOR_EXSTART) { if (on->state < OSPF6_NEIGHBOR_EXSTART) {
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_DBDESC, SEND)) if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_DBDESC, SEND))
@ -2505,7 +2504,6 @@ void ospf6_lsreq_send(struct thread *thread)
uint16_t length = OSPF6_HEADER_SIZE; uint16_t length = OSPF6_HEADER_SIZE;
on = (struct ospf6_neighbor *)THREAD_ARG(thread); on = (struct ospf6_neighbor *)THREAD_ARG(thread);
on->thread_send_lsreq = (struct thread *)NULL;
/* LSReq will be sent only in ExStart or Loading */ /* LSReq will be sent only in ExStart or Loading */
if (on->state != OSPF6_NEIGHBOR_EXCHANGE if (on->state != OSPF6_NEIGHBOR_EXCHANGE
@ -2685,7 +2683,6 @@ void ospf6_lsupdate_send_neighbor(struct thread *thread)
int lsa_cnt = 0; int lsa_cnt = 0;
on = (struct ospf6_neighbor *)THREAD_ARG(thread); on = (struct ospf6_neighbor *)THREAD_ARG(thread);
on->thread_send_lsupdate = (struct thread *)NULL;
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_LSUPDATE, SEND_HDR)) if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_LSUPDATE, SEND_HDR))
zlog_debug("LSUpdate to neighbor %s", on->name); zlog_debug("LSUpdate to neighbor %s", on->name);
@ -2821,7 +2818,6 @@ void ospf6_lsupdate_send_interface(struct thread *thread)
int lsa_cnt = 0; int lsa_cnt = 0;
oi = (struct ospf6_interface *)THREAD_ARG(thread); oi = (struct ospf6_interface *)THREAD_ARG(thread);
oi->thread_send_lsupdate = (struct thread *)NULL;
if (oi->state <= OSPF6_INTERFACE_WAITING) { if (oi->state <= OSPF6_INTERFACE_WAITING) {
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_LSUPDATE, if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_LSUPDATE,
@ -2862,7 +2858,6 @@ void ospf6_lsack_send_neighbor(struct thread *thread)
uint16_t length = OSPF6_HEADER_SIZE; uint16_t length = OSPF6_HEADER_SIZE;
on = (struct ospf6_neighbor *)THREAD_ARG(thread); on = (struct ospf6_neighbor *)THREAD_ARG(thread);
on->thread_send_lsack = (struct thread *)NULL;
if (on->state < OSPF6_NEIGHBOR_EXCHANGE) { if (on->state < OSPF6_NEIGHBOR_EXCHANGE) {
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_LSACK, SEND_HDR)) if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_LSACK, SEND_HDR))
@ -2939,7 +2934,6 @@ void ospf6_lsack_send_interface(struct thread *thread)
uint16_t length = OSPF6_HEADER_SIZE; uint16_t length = OSPF6_HEADER_SIZE;
oi = (struct ospf6_interface *)THREAD_ARG(thread); oi = (struct ospf6_interface *)THREAD_ARG(thread);
oi->thread_send_lsack = (struct thread *)NULL;
if (oi->state <= OSPF6_INTERFACE_WAITING) { if (oi->state <= OSPF6_INTERFACE_WAITING) {
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_LSACK, SEND_HDR)) if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_LSACK, SEND_HDR))

View File

@ -435,8 +435,7 @@ void ospf6_check_nbr_loading(struct ospf6_neighbor *on)
if (on->request_list->count == 0) if (on->request_list->count == 0)
thread_add_event(master, loading_done, on, 0, NULL); thread_add_event(master, loading_done, on, 0, NULL);
else if (on->last_ls_req == NULL) { else if (on->last_ls_req == NULL) {
if (on->thread_send_lsreq != NULL) THREAD_OFF(on->thread_send_lsreq);
THREAD_OFF(on->thread_send_lsreq);
thread_add_event(master, ospf6_lsreq_send, on, 0, thread_add_event(master, ospf6_lsreq_send, on, 0,
&on->thread_send_lsreq); &on->thread_send_lsreq);
} }
@ -481,7 +480,6 @@ void adj_ok(struct thread *thread)
SET_FLAG(on->dbdesc_bits, OSPF6_DBDESC_IBIT); SET_FLAG(on->dbdesc_bits, OSPF6_DBDESC_IBIT);
THREAD_OFF(on->thread_send_dbdesc); THREAD_OFF(on->thread_send_dbdesc);
on->thread_send_dbdesc = NULL;
thread_add_event(master, ospf6_dbdesc_send, on, 0, thread_add_event(master, ospf6_dbdesc_send, on, 0,
&on->thread_send_dbdesc); &on->thread_send_dbdesc);
@ -527,7 +525,6 @@ void seqnumber_mismatch(struct thread *thread)
THREAD_OFF(on->thread_send_dbdesc); THREAD_OFF(on->thread_send_dbdesc);
on->dbdesc_seqnum++; /* Incr seqnum as per RFC2328, sec 10.3 */ on->dbdesc_seqnum++; /* Incr seqnum as per RFC2328, sec 10.3 */
on->thread_send_dbdesc = NULL;
thread_add_event(master, ospf6_dbdesc_send, on, 0, thread_add_event(master, ospf6_dbdesc_send, on, 0,
&on->thread_send_dbdesc); &on->thread_send_dbdesc);
} }
@ -562,7 +559,6 @@ void bad_lsreq(struct thread *thread)
THREAD_OFF(on->thread_send_dbdesc); THREAD_OFF(on->thread_send_dbdesc);
on->dbdesc_seqnum++; /* Incr seqnum as per RFC2328, sec 10.3 */ on->dbdesc_seqnum++; /* Incr seqnum as per RFC2328, sec 10.3 */
on->thread_send_dbdesc = NULL;
thread_add_event(master, ospf6_dbdesc_send, on, 0, thread_add_event(master, ospf6_dbdesc_send, on, 0,
&on->thread_send_dbdesc); &on->thread_send_dbdesc);
@ -850,15 +846,17 @@ static void ospf6_neighbor_show_detail(struct vty *vty,
timerclear(&res); timerclear(&res);
if (on->thread_send_dbdesc) if (thread_is_scheduled(on->thread_send_dbdesc))
timersub(&on->thread_send_dbdesc->u.sands, &now, &res); timersub(&on->thread_send_dbdesc->u.sands, &now, &res);
timerstring(&res, duration, sizeof(duration)); timerstring(&res, duration, sizeof(duration));
json_object_int_add(json_neighbor, "pendingLsaDbDescCount", json_object_int_add(json_neighbor, "pendingLsaDbDescCount",
on->dbdesc_list->count); on->dbdesc_list->count);
json_object_string_add(json_neighbor, "pendingLsaDbDescTime", json_object_string_add(json_neighbor, "pendingLsaDbDescTime",
duration); duration);
json_object_string_add(json_neighbor, "dbDescSendThread", json_object_string_add(
(on->thread_send_dbdesc ? "on" : "off")); json_neighbor, "dbDescSendThread",
(thread_is_scheduled(on->thread_send_dbdesc) ? "on"
: "off"));
json_array = json_object_new_array(); json_array = json_object_new_array();
for (ALL_LSDB(on->dbdesc_list, lsa, lsanext)) for (ALL_LSDB(on->dbdesc_list, lsa, lsanext))
json_object_array_add( json_object_array_add(
@ -867,15 +865,17 @@ static void ospf6_neighbor_show_detail(struct vty *vty,
json_array); json_array);
timerclear(&res); timerclear(&res);
if (on->thread_send_lsreq) if (thread_is_scheduled(on->thread_send_lsreq))
timersub(&on->thread_send_lsreq->u.sands, &now, &res); timersub(&on->thread_send_lsreq->u.sands, &now, &res);
timerstring(&res, duration, sizeof(duration)); timerstring(&res, duration, sizeof(duration));
json_object_int_add(json_neighbor, "pendingLsaLsReqCount", json_object_int_add(json_neighbor, "pendingLsaLsReqCount",
on->request_list->count); on->request_list->count);
json_object_string_add(json_neighbor, "pendingLsaLsReqTime", json_object_string_add(json_neighbor, "pendingLsaLsReqTime",
duration); duration);
json_object_string_add(json_neighbor, "lsReqSendThread", json_object_string_add(
(on->thread_send_lsreq ? "on" : "off")); json_neighbor, "lsReqSendThread",
(thread_is_scheduled(on->thread_send_lsreq) ? "on"
: "off"));
json_array = json_object_new_array(); json_array = json_object_new_array();
for (ALL_LSDB(on->request_list, lsa, lsanext)) for (ALL_LSDB(on->request_list, lsa, lsanext))
json_object_array_add( json_object_array_add(
@ -885,7 +885,7 @@ static void ospf6_neighbor_show_detail(struct vty *vty,
timerclear(&res); timerclear(&res);
if (on->thread_send_lsupdate) if (thread_is_scheduled(on->thread_send_lsupdate))
timersub(&on->thread_send_lsupdate->u.sands, &now, timersub(&on->thread_send_lsupdate->u.sands, &now,
&res); &res);
timerstring(&res, duration, sizeof(duration)); timerstring(&res, duration, sizeof(duration));
@ -895,7 +895,9 @@ static void ospf6_neighbor_show_detail(struct vty *vty,
duration); duration);
json_object_string_add( json_object_string_add(
json_neighbor, "lsUpdateSendThread", json_neighbor, "lsUpdateSendThread",
(on->thread_send_lsupdate ? "on" : "off")); (thread_is_scheduled(on->thread_send_lsupdate)
? "on"
: "off"));
json_array = json_object_new_array(); json_array = json_object_new_array();
for (ALL_LSDB(on->lsupdate_list, lsa, lsanext)) for (ALL_LSDB(on->lsupdate_list, lsa, lsanext))
json_object_array_add( json_object_array_add(
@ -904,15 +906,17 @@ static void ospf6_neighbor_show_detail(struct vty *vty,
json_array); json_array);
timerclear(&res); timerclear(&res);
if (on->thread_send_lsack) if (thread_is_scheduled(on->thread_send_lsack))
timersub(&on->thread_send_lsack->u.sands, &now, &res); timersub(&on->thread_send_lsack->u.sands, &now, &res);
timerstring(&res, duration, sizeof(duration)); timerstring(&res, duration, sizeof(duration));
json_object_int_add(json_neighbor, "pendingLsaLsAckCount", json_object_int_add(json_neighbor, "pendingLsaLsAckCount",
on->lsack_list->count); on->lsack_list->count);
json_object_string_add(json_neighbor, "pendingLsaLsAckTime", json_object_string_add(json_neighbor, "pendingLsaLsAckTime",
duration); duration);
json_object_string_add(json_neighbor, "lsAckSendThread", json_object_string_add(
(on->thread_send_lsack ? "on" : "off")); json_neighbor, "lsAckSendThread",
(thread_is_scheduled(on->thread_send_lsack) ? "on"
: "off"));
json_array = json_object_new_array(); json_array = json_object_new_array();
for (ALL_LSDB(on->lsack_list, lsa, lsanext)) for (ALL_LSDB(on->lsack_list, lsa, lsanext))
json_object_array_add( json_object_array_add(
@ -1000,47 +1004,52 @@ static void ospf6_neighbor_show_detail(struct vty *vty,
vty_out(vty, " %s\n", lsa->name); vty_out(vty, " %s\n", lsa->name);
timerclear(&res); timerclear(&res);
if (on->thread_send_dbdesc) if (thread_is_scheduled(on->thread_send_dbdesc))
timersub(&on->thread_send_dbdesc->u.sands, &now, &res); timersub(&on->thread_send_dbdesc->u.sands, &now, &res);
timerstring(&res, duration, sizeof(duration)); timerstring(&res, duration, sizeof(duration));
vty_out(vty, vty_out(vty,
" %d Pending LSAs for DbDesc in Time %s [thread %s]\n", " %d Pending LSAs for DbDesc in Time %s [thread %s]\n",
on->dbdesc_list->count, duration, on->dbdesc_list->count, duration,
(on->thread_send_dbdesc ? "on" : "off")); (thread_is_scheduled(on->thread_send_dbdesc) ? "on"
: "off"));
for (ALL_LSDB(on->dbdesc_list, lsa, lsanext)) for (ALL_LSDB(on->dbdesc_list, lsa, lsanext))
vty_out(vty, " %s\n", lsa->name); vty_out(vty, " %s\n", lsa->name);
timerclear(&res); timerclear(&res);
if (on->thread_send_lsreq) if (thread_is_scheduled(on->thread_send_lsreq))
timersub(&on->thread_send_lsreq->u.sands, &now, &res); timersub(&on->thread_send_lsreq->u.sands, &now, &res);
timerstring(&res, duration, sizeof(duration)); timerstring(&res, duration, sizeof(duration));
vty_out(vty, vty_out(vty,
" %d Pending LSAs for LSReq in Time %s [thread %s]\n", " %d Pending LSAs for LSReq in Time %s [thread %s]\n",
on->request_list->count, duration, on->request_list->count, duration,
(on->thread_send_lsreq ? "on" : "off")); (thread_is_scheduled(on->thread_send_lsreq) ? "on"
: "off"));
for (ALL_LSDB(on->request_list, lsa, lsanext)) for (ALL_LSDB(on->request_list, lsa, lsanext))
vty_out(vty, " %s\n", lsa->name); vty_out(vty, " %s\n", lsa->name);
timerclear(&res); timerclear(&res);
if (on->thread_send_lsupdate) if (thread_is_scheduled(on->thread_send_lsupdate))
timersub(&on->thread_send_lsupdate->u.sands, &now, timersub(&on->thread_send_lsupdate->u.sands, &now,
&res); &res);
timerstring(&res, duration, sizeof(duration)); timerstring(&res, duration, sizeof(duration));
vty_out(vty, vty_out(vty,
" %d Pending LSAs for LSUpdate in Time %s [thread %s]\n", " %d Pending LSAs for LSUpdate in Time %s [thread %s]\n",
on->lsupdate_list->count, duration, on->lsupdate_list->count, duration,
(on->thread_send_lsupdate ? "on" : "off")); (thread_is_scheduled(on->thread_send_lsupdate)
? "on"
: "off"));
for (ALL_LSDB(on->lsupdate_list, lsa, lsanext)) for (ALL_LSDB(on->lsupdate_list, lsa, lsanext))
vty_out(vty, " %s\n", lsa->name); vty_out(vty, " %s\n", lsa->name);
timerclear(&res); timerclear(&res);
if (on->thread_send_lsack) if (thread_is_scheduled(on->thread_send_lsack))
timersub(&on->thread_send_lsack->u.sands, &now, &res); timersub(&on->thread_send_lsack->u.sands, &now, &res);
timerstring(&res, duration, sizeof(duration)); timerstring(&res, duration, sizeof(duration));
vty_out(vty, vty_out(vty,
" %d Pending LSAs for LSAck in Time %s [thread %s]\n", " %d Pending LSAs for LSAck in Time %s [thread %s]\n",
on->lsack_list->count, duration, on->lsack_list->count, duration,
(on->thread_send_lsack ? "on" : "off")); (thread_is_scheduled(on->thread_send_lsack) ? "on"
: "off"));
for (ALL_LSDB(on->lsack_list, lsa, lsanext)) for (ALL_LSDB(on->lsack_list, lsa, lsanext))
vty_out(vty, " %s\n", lsa->name); vty_out(vty, " %s\n", lsa->name);

View File

@ -1007,7 +1007,7 @@ static void ospf6_abr_task_timer(struct thread *thread)
void ospf6_schedule_abr_task(struct ospf6 *ospf6) void ospf6_schedule_abr_task(struct ospf6 *ospf6)
{ {
if (ospf6->t_abr_task) { if (thread_is_scheduled(ospf6->t_abr_task)) {
if (IS_OSPF6_DEBUG_ABR) if (IS_OSPF6_DEBUG_ABR)
zlog_debug("ABR task already scheduled"); zlog_debug("ABR task already scheduled");
return; return;

View File

@ -615,7 +615,6 @@ static void ospf6_spf_calculation_thread(struct thread *t)
char rbuf[32]; char rbuf[32];
ospf6 = (struct ospf6 *)THREAD_ARG(t); ospf6 = (struct ospf6 *)THREAD_ARG(t);
ospf6->t_spf_calc = NULL;
/* execute SPF calculation */ /* execute SPF calculation */
monotime(&start); monotime(&start);
@ -703,7 +702,7 @@ void ospf6_spf_schedule(struct ospf6 *ospf6, unsigned int reason)
} }
/* SPF calculation timer is already scheduled. */ /* SPF calculation timer is already scheduled. */
if (ospf6->t_spf_calc) { if (thread_is_scheduled(ospf6->t_spf_calc)) {
if (IS_OSPF6_DEBUG_SPF(PROCESS) || IS_OSPF6_DEBUG_SPF(TIME)) if (IS_OSPF6_DEBUG_SPF(PROCESS) || IS_OSPF6_DEBUG_SPF(TIME))
zlog_debug( zlog_debug(
"SPF: calculation timer is already scheduled: %p", "SPF: calculation timer is already scheduled: %p",
@ -740,7 +739,7 @@ void ospf6_spf_schedule(struct ospf6 *ospf6, unsigned int reason)
if (IS_OSPF6_DEBUG_SPF(PROCESS) || IS_OSPF6_DEBUG_SPF(TIME)) if (IS_OSPF6_DEBUG_SPF(PROCESS) || IS_OSPF6_DEBUG_SPF(TIME))
zlog_debug("SPF: Rescheduling in %ld msec", delay); zlog_debug("SPF: Rescheduling in %ld msec", delay);
ospf6->t_spf_calc = NULL; THREAD_OFF(ospf6->t_spf_calc);
thread_add_timer_msec(master, ospf6_spf_calculation_thread, ospf6, thread_add_timer_msec(master, ospf6_spf_calculation_thread, ospf6,
delay, &ospf6->t_spf_calc); delay, &ospf6->t_spf_calc);
} }
@ -1253,7 +1252,6 @@ static void ospf6_ase_calculate_timer(struct thread *t)
uint16_t type; uint16_t type;
ospf6 = THREAD_ARG(t); ospf6 = THREAD_ARG(t);
ospf6->t_ase_calc = NULL;
/* Calculate external route for each AS-external-LSA */ /* Calculate external route for each AS-external-LSA */
type = htons(OSPF6_LSTYPE_AS_EXTERNAL); type = htons(OSPF6_LSTYPE_AS_EXTERNAL);

View File

@ -1372,9 +1372,7 @@ static void ospf6_show(struct vty *vty, struct ospf6 *o, json_object *json,
} else } else
json_object_boolean_false_add(json, "spfHasRun"); json_object_boolean_false_add(json, "spfHasRun");
if (thread_is_scheduled(o->t_spf_calc)) {
threadtimer_string(now, o->t_spf_calc, buf, sizeof(buf));
if (o->t_spf_calc) {
long time_store; long time_store;
json_object_boolean_true_add(json, "spfTimerActive"); json_object_boolean_true_add(json, "spfTimerActive");
@ -1467,7 +1465,9 @@ static void ospf6_show(struct vty *vty, struct ospf6 *o, json_object *json,
threadtimer_string(now, o->t_spf_calc, buf, sizeof(buf)); threadtimer_string(now, o->t_spf_calc, buf, sizeof(buf));
vty_out(vty, " SPF timer %s%s\n", vty_out(vty, " SPF timer %s%s\n",
(o->t_spf_calc ? "due in " : "is "), buf); (thread_is_scheduled(o->t_spf_calc) ? "due in "
: "is "),
buf);
if (CHECK_FLAG(o->flag, OSPF6_STUB_ROUTER)) if (CHECK_FLAG(o->flag, OSPF6_STUB_ROUTER))
vty_out(vty, " Router Is Stub Router\n"); vty_out(vty, " Router Is Stub Router\n");
@ -1756,14 +1756,10 @@ DEFUN(show_ipv6_ospf6_route_type_detail, show_ipv6_ospf6_route_type_detail_cmd,
bool ospf6_is_valid_summary_addr(struct vty *vty, struct prefix *p) bool ospf6_is_valid_summary_addr(struct vty *vty, struct prefix *p)
{ {
struct in6_addr addr_zero; /* Default prefix validation*/
if (is_default_prefix(p)) {
memset(&addr_zero, 0, sizeof(addr_zero)); vty_out(vty,
"Default address should not be configured as summary address.\n");
/* Default prefix validation*/
if ((is_default_prefix(p)) ||
(!memcmp(&p->u.prefix6, &addr_zero, sizeof(struct in6_addr)))) {
vty_out(vty, "Default address should not be configured as summary address.\n");
return false; return false;
} }