summaryrefslogtreecommitdiff
path: root/ospf6d/ospf6_neighbor.c
diff options
context:
space:
mode:
Diffstat (limited to 'ospf6d/ospf6_neighbor.c')
-rw-r--r--ospf6d/ospf6_neighbor.c192
1 files changed, 94 insertions, 98 deletions
diff --git a/ospf6d/ospf6_neighbor.c b/ospf6d/ospf6_neighbor.c
index 5ab5a49a4b..42e4074522 100644
--- a/ospf6d/ospf6_neighbor.c
+++ b/ospf6d/ospf6_neighbor.c
@@ -7,7 +7,7 @@
#include "log.h"
#include "memory.h"
-#include "thread.h"
+#include "frrevent.h"
#include "linklist.h"
#include "vty.h"
#include "command.h"
@@ -163,18 +163,18 @@ void ospf6_neighbor_delete(struct ospf6_neighbor *on)
ospf6_lsdb_delete(on->lsupdate_list);
ospf6_lsdb_delete(on->lsack_list);
- THREAD_OFF(on->inactivity_timer);
+ EVENT_OFF(on->inactivity_timer);
- THREAD_OFF(on->last_dbdesc_release_timer);
+ EVENT_OFF(on->last_dbdesc_release_timer);
- THREAD_OFF(on->thread_send_dbdesc);
- THREAD_OFF(on->thread_send_lsreq);
- THREAD_OFF(on->thread_send_lsupdate);
- THREAD_OFF(on->thread_send_lsack);
- THREAD_OFF(on->thread_exchange_done);
- THREAD_OFF(on->thread_adj_ok);
+ EVENT_OFF(on->thread_send_dbdesc);
+ EVENT_OFF(on->thread_send_lsreq);
+ EVENT_OFF(on->thread_send_lsupdate);
+ EVENT_OFF(on->thread_send_lsack);
+ EVENT_OFF(on->thread_exchange_done);
+ EVENT_OFF(on->thread_adj_ok);
- THREAD_OFF(on->gr_helper_info.t_grace_timer);
+ EVENT_OFF(on->gr_helper_info.t_grace_timer);
bfd_sess_free(&on->bfd_session);
XFREE(MTYPE_OSPF6_NEIGHBOR, on);
@@ -272,31 +272,31 @@ static int need_adjacency(struct ospf6_neighbor *on)
return 0;
}
-void hello_received(struct thread *thread)
+void hello_received(struct event *thread)
{
struct ospf6_neighbor *on;
- on = (struct ospf6_neighbor *)THREAD_ARG(thread);
+ on = (struct ospf6_neighbor *)EVENT_ARG(thread);
assert(on);
if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT))
zlog_debug("Neighbor Event %s: *HelloReceived*", on->name);
/* reset Inactivity Timer */
- THREAD_OFF(on->inactivity_timer);
- thread_add_timer(master, inactivity_timer, on,
- on->ospf6_if->dead_interval, &on->inactivity_timer);
+ EVENT_OFF(on->inactivity_timer);
+ event_add_timer(master, inactivity_timer, on,
+ on->ospf6_if->dead_interval, &on->inactivity_timer);
if (on->state <= OSPF6_NEIGHBOR_DOWN)
ospf6_neighbor_state_change(OSPF6_NEIGHBOR_INIT, on,
OSPF6_NEIGHBOR_EVENT_HELLO_RCVD);
}
-void twoway_received(struct thread *thread)
+void twoway_received(struct event *thread)
{
struct ospf6_neighbor *on;
- on = (struct ospf6_neighbor *)THREAD_ARG(thread);
+ on = (struct ospf6_neighbor *)EVENT_ARG(thread);
assert(on);
if (on->state > OSPF6_NEIGHBOR_INIT)
@@ -305,7 +305,7 @@ void twoway_received(struct thread *thread)
if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT))
zlog_debug("Neighbor Event %s: *2Way-Received*", on->name);
- thread_add_event(master, neighbor_change, on->ospf6_if, 0, NULL);
+ event_add_event(master, neighbor_change, on->ospf6_if, 0, NULL);
if (!need_adjacency(on)) {
ospf6_neighbor_state_change(OSPF6_NEIGHBOR_TWOWAY, on,
@@ -319,17 +319,17 @@ void twoway_received(struct thread *thread)
SET_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MBIT);
SET_FLAG(on->dbdesc_bits, OSPF6_DBDESC_IBIT);
- THREAD_OFF(on->thread_send_dbdesc);
- thread_add_event(master, ospf6_dbdesc_send, on, 0,
- &on->thread_send_dbdesc);
+ EVENT_OFF(on->thread_send_dbdesc);
+ event_add_event(master, ospf6_dbdesc_send, on, 0,
+ &on->thread_send_dbdesc);
}
-void negotiation_done(struct thread *thread)
+void negotiation_done(struct event *thread)
{
struct ospf6_neighbor *on;
struct ospf6_lsa *lsa, *lsanext;
- on = (struct ospf6_neighbor *)THREAD_ARG(thread);
+ on = (struct ospf6_neighbor *)EVENT_ARG(thread);
assert(on);
if (on->state != OSPF6_NEIGHBOR_EXSTART)
@@ -373,19 +373,19 @@ void negotiation_done(struct thread *thread)
OSPF6_NEIGHBOR_EVENT_NEGOTIATION_DONE);
}
-static void ospf6_neighbor_last_dbdesc_release(struct thread *thread)
+static void ospf6_neighbor_last_dbdesc_release(struct event *thread)
{
- struct ospf6_neighbor *on = THREAD_ARG(thread);
+ struct ospf6_neighbor *on = EVENT_ARG(thread);
assert(on);
memset(&on->dbdesc_last, 0, sizeof(struct ospf6_dbdesc));
}
-void exchange_done(struct thread *thread)
+void exchange_done(struct event *thread)
{
struct ospf6_neighbor *on;
- on = (struct ospf6_neighbor *)THREAD_ARG(thread);
+ on = (struct ospf6_neighbor *)EVENT_ARG(thread);
assert(on);
if (on->state != OSPF6_NEIGHBOR_EXCHANGE)
@@ -394,15 +394,15 @@ void exchange_done(struct thread *thread)
if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT))
zlog_debug("Neighbor Event %s: *ExchangeDone*", on->name);
- THREAD_OFF(on->thread_send_dbdesc);
+ EVENT_OFF(on->thread_send_dbdesc);
ospf6_lsdb_remove_all(on->dbdesc_list);
/* RFC 2328 (10.8): Release the last dbdesc after dead_interval */
if (!CHECK_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MSBIT)) {
- THREAD_OFF(on->last_dbdesc_release_timer);
- thread_add_timer(master, ospf6_neighbor_last_dbdesc_release, on,
- on->ospf6_if->dead_interval,
- &on->last_dbdesc_release_timer);
+ EVENT_OFF(on->last_dbdesc_release_timer);
+ event_add_timer(master, ospf6_neighbor_last_dbdesc_release, on,
+ on->ospf6_if->dead_interval,
+ &on->last_dbdesc_release_timer);
}
if (on->request_list->count == 0)
@@ -412,8 +412,8 @@ void exchange_done(struct thread *thread)
ospf6_neighbor_state_change(OSPF6_NEIGHBOR_LOADING, on,
OSPF6_NEIGHBOR_EVENT_EXCHANGE_DONE);
- thread_add_event(master, ospf6_lsreq_send, on, 0,
- &on->thread_send_lsreq);
+ event_add_event(master, ospf6_lsreq_send, on, 0,
+ &on->thread_send_lsreq);
}
}
@@ -428,20 +428,20 @@ void ospf6_check_nbr_loading(struct ospf6_neighbor *on)
if ((on->state == OSPF6_NEIGHBOR_LOADING)
|| (on->state == OSPF6_NEIGHBOR_EXCHANGE)) {
if (on->request_list->count == 0)
- thread_add_event(master, loading_done, on, 0, NULL);
+ event_add_event(master, loading_done, on, 0, NULL);
else if (on->last_ls_req == NULL) {
- THREAD_OFF(on->thread_send_lsreq);
- thread_add_event(master, ospf6_lsreq_send, on, 0,
- &on->thread_send_lsreq);
+ EVENT_OFF(on->thread_send_lsreq);
+ event_add_event(master, ospf6_lsreq_send, on, 0,
+ &on->thread_send_lsreq);
}
}
}
-void loading_done(struct thread *thread)
+void loading_done(struct event *thread)
{
struct ospf6_neighbor *on;
- on = (struct ospf6_neighbor *)THREAD_ARG(thread);
+ on = (struct ospf6_neighbor *)EVENT_ARG(thread);
assert(on);
if (on->state != OSPF6_NEIGHBOR_LOADING)
@@ -456,11 +456,11 @@ void loading_done(struct thread *thread)
OSPF6_NEIGHBOR_EVENT_LOADING_DONE);
}
-void adj_ok(struct thread *thread)
+void adj_ok(struct event *thread)
{
struct ospf6_neighbor *on;
- on = (struct ospf6_neighbor *)THREAD_ARG(thread);
+ on = (struct ospf6_neighbor *)EVENT_ARG(thread);
assert(on);
if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT))
@@ -473,9 +473,9 @@ void adj_ok(struct thread *thread)
SET_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MBIT);
SET_FLAG(on->dbdesc_bits, OSPF6_DBDESC_IBIT);
- THREAD_OFF(on->thread_send_dbdesc);
- thread_add_event(master, ospf6_dbdesc_send, on, 0,
- &on->thread_send_dbdesc);
+ EVENT_OFF(on->thread_send_dbdesc);
+ event_add_event(master, ospf6_dbdesc_send, on, 0,
+ &on->thread_send_dbdesc);
} else if (on->state >= OSPF6_NEIGHBOR_EXSTART && !need_adjacency(on)) {
ospf6_neighbor_state_change(OSPF6_NEIGHBOR_TWOWAY, on,
@@ -484,11 +484,11 @@ void adj_ok(struct thread *thread)
}
}
-void seqnumber_mismatch(struct thread *thread)
+void seqnumber_mismatch(struct event *thread)
{
struct ospf6_neighbor *on;
- on = (struct ospf6_neighbor *)THREAD_ARG(thread);
+ on = (struct ospf6_neighbor *)EVENT_ARG(thread);
assert(on);
if (on->state < OSPF6_NEIGHBOR_EXCHANGE)
@@ -505,18 +505,18 @@ void seqnumber_mismatch(struct thread *thread)
ospf6_neighbor_clear_ls_lists(on);
- THREAD_OFF(on->thread_send_dbdesc);
+ EVENT_OFF(on->thread_send_dbdesc);
on->dbdesc_seqnum++; /* Incr seqnum as per RFC2328, sec 10.3 */
- thread_add_event(master, ospf6_dbdesc_send, on, 0,
- &on->thread_send_dbdesc);
+ event_add_event(master, ospf6_dbdesc_send, on, 0,
+ &on->thread_send_dbdesc);
}
-void bad_lsreq(struct thread *thread)
+void bad_lsreq(struct event *thread)
{
struct ospf6_neighbor *on;
- on = (struct ospf6_neighbor *)THREAD_ARG(thread);
+ on = (struct ospf6_neighbor *)EVENT_ARG(thread);
assert(on);
if (on->state < OSPF6_NEIGHBOR_EXCHANGE)
@@ -533,19 +533,18 @@ void bad_lsreq(struct thread *thread)
ospf6_neighbor_clear_ls_lists(on);
- THREAD_OFF(on->thread_send_dbdesc);
+ EVENT_OFF(on->thread_send_dbdesc);
on->dbdesc_seqnum++; /* Incr seqnum as per RFC2328, sec 10.3 */
- thread_add_event(master, ospf6_dbdesc_send, on, 0,
- &on->thread_send_dbdesc);
-
+ event_add_event(master, ospf6_dbdesc_send, on, 0,
+ &on->thread_send_dbdesc);
}
-void oneway_received(struct thread *thread)
+void oneway_received(struct event *thread)
{
struct ospf6_neighbor *on;
- on = (struct ospf6_neighbor *)THREAD_ARG(thread);
+ on = (struct ospf6_neighbor *)EVENT_ARG(thread);
assert(on);
if (on->state < OSPF6_NEIGHBOR_TWOWAY)
@@ -556,23 +555,23 @@ void oneway_received(struct thread *thread)
ospf6_neighbor_state_change(OSPF6_NEIGHBOR_INIT, on,
OSPF6_NEIGHBOR_EVENT_ONEWAY_RCVD);
- thread_add_event(master, neighbor_change, on->ospf6_if, 0, NULL);
+ event_add_event(master, neighbor_change, on->ospf6_if, 0, NULL);
ospf6_neighbor_clear_ls_lists(on);
- THREAD_OFF(on->thread_send_dbdesc);
- THREAD_OFF(on->thread_send_lsreq);
- THREAD_OFF(on->thread_send_lsupdate);
- THREAD_OFF(on->thread_send_lsack);
- THREAD_OFF(on->thread_exchange_done);
- THREAD_OFF(on->thread_adj_ok);
+ EVENT_OFF(on->thread_send_dbdesc);
+ EVENT_OFF(on->thread_send_lsreq);
+ EVENT_OFF(on->thread_send_lsupdate);
+ EVENT_OFF(on->thread_send_lsack);
+ EVENT_OFF(on->thread_exchange_done);
+ EVENT_OFF(on->thread_adj_ok);
}
-void inactivity_timer(struct thread *thread)
+void inactivity_timer(struct event *thread)
{
struct ospf6_neighbor *on;
- on = (struct ospf6_neighbor *)THREAD_ARG(thread);
+ on = (struct ospf6_neighbor *)EVENT_ARG(thread);
assert(on);
if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT))
@@ -588,8 +587,7 @@ void inactivity_timer(struct thread *thread)
ospf6_neighbor_state_change(
OSPF6_NEIGHBOR_DOWN, on,
OSPF6_NEIGHBOR_EVENT_INACTIVITY_TIMER);
- thread_add_event(master, neighbor_change, on->ospf6_if, 0,
- NULL);
+ event_add_event(master, neighbor_change, on->ospf6_if, 0, NULL);
listnode_delete(on->ospf6_if->neighbor_list, on);
ospf6_neighbor_delete(on);
@@ -600,9 +598,9 @@ void inactivity_timer(struct thread *thread)
"%s, Acting as HELPER for this neighbour, So restart the dead timer.",
__PRETTY_FUNCTION__);
- thread_add_timer(master, inactivity_timer, on,
- on->ospf6_if->dead_interval,
- &on->inactivity_timer);
+ event_add_timer(master, inactivity_timer, on,
+ on->ospf6_if->dead_interval,
+ &on->inactivity_timer);
}
}
@@ -817,7 +815,7 @@ static void ospf6_neighbor_show_detail(struct vty *vty,
timerclear(&res);
- if (thread_is_scheduled(on->thread_send_dbdesc))
+ if (event_is_scheduled(on->thread_send_dbdesc))
timersub(&on->thread_send_dbdesc->u.sands, &now, &res);
timerstring(&res, duration, sizeof(duration));
json_object_int_add(json_neighbor, "pendingLsaDbDescCount",
@@ -826,8 +824,8 @@ static void ospf6_neighbor_show_detail(struct vty *vty,
duration);
json_object_string_add(
json_neighbor, "dbDescSendThread",
- (thread_is_scheduled(on->thread_send_dbdesc) ? "on"
- : "off"));
+ (event_is_scheduled(on->thread_send_dbdesc) ? "on"
+ : "off"));
json_array = json_object_new_array();
for (ALL_LSDB(on->dbdesc_list, lsa, lsanext))
json_object_array_add(
@@ -836,7 +834,7 @@ static void ospf6_neighbor_show_detail(struct vty *vty,
json_array);
timerclear(&res);
- if (thread_is_scheduled(on->thread_send_lsreq))
+ if (event_is_scheduled(on->thread_send_lsreq))
timersub(&on->thread_send_lsreq->u.sands, &now, &res);
timerstring(&res, duration, sizeof(duration));
json_object_int_add(json_neighbor, "pendingLsaLsReqCount",
@@ -845,8 +843,8 @@ static void ospf6_neighbor_show_detail(struct vty *vty,
duration);
json_object_string_add(
json_neighbor, "lsReqSendThread",
- (thread_is_scheduled(on->thread_send_lsreq) ? "on"
- : "off"));
+ (event_is_scheduled(on->thread_send_lsreq) ? "on"
+ : "off"));
json_array = json_object_new_array();
for (ALL_LSDB(on->request_list, lsa, lsanext))
json_object_array_add(
@@ -856,7 +854,7 @@ static void ospf6_neighbor_show_detail(struct vty *vty,
timerclear(&res);
- if (thread_is_scheduled(on->thread_send_lsupdate))
+ if (event_is_scheduled(on->thread_send_lsupdate))
timersub(&on->thread_send_lsupdate->u.sands, &now,
&res);
timerstring(&res, duration, sizeof(duration));
@@ -866,9 +864,8 @@ static void ospf6_neighbor_show_detail(struct vty *vty,
duration);
json_object_string_add(
json_neighbor, "lsUpdateSendThread",
- (thread_is_scheduled(on->thread_send_lsupdate)
- ? "on"
- : "off"));
+ (event_is_scheduled(on->thread_send_lsupdate) ? "on"
+ : "off"));
json_array = json_object_new_array();
for (ALL_LSDB(on->lsupdate_list, lsa, lsanext))
json_object_array_add(
@@ -877,7 +874,7 @@ static void ospf6_neighbor_show_detail(struct vty *vty,
json_array);
timerclear(&res);
- if (thread_is_scheduled(on->thread_send_lsack))
+ if (event_is_scheduled(on->thread_send_lsack))
timersub(&on->thread_send_lsack->u.sands, &now, &res);
timerstring(&res, duration, sizeof(duration));
json_object_int_add(json_neighbor, "pendingLsaLsAckCount",
@@ -886,8 +883,8 @@ static void ospf6_neighbor_show_detail(struct vty *vty,
duration);
json_object_string_add(
json_neighbor, "lsAckSendThread",
- (thread_is_scheduled(on->thread_send_lsack) ? "on"
- : "off"));
+ (event_is_scheduled(on->thread_send_lsack) ? "on"
+ : "off"));
json_array = json_object_new_array();
for (ALL_LSDB(on->lsack_list, lsa, lsanext))
json_object_array_add(
@@ -975,52 +972,51 @@ static void ospf6_neighbor_show_detail(struct vty *vty,
vty_out(vty, " %s\n", lsa->name);
timerclear(&res);
- if (thread_is_scheduled(on->thread_send_dbdesc))
+ if (event_is_scheduled(on->thread_send_dbdesc))
timersub(&on->thread_send_dbdesc->u.sands, &now, &res);
timerstring(&res, duration, sizeof(duration));
vty_out(vty,
" %d Pending LSAs for DbDesc in Time %s [thread %s]\n",
on->dbdesc_list->count, duration,
- (thread_is_scheduled(on->thread_send_dbdesc) ? "on"
- : "off"));
+ (event_is_scheduled(on->thread_send_dbdesc) ? "on"
+ : "off"));
for (ALL_LSDB(on->dbdesc_list, lsa, lsanext))
vty_out(vty, " %s\n", lsa->name);
timerclear(&res);
- if (thread_is_scheduled(on->thread_send_lsreq))
+ if (event_is_scheduled(on->thread_send_lsreq))
timersub(&on->thread_send_lsreq->u.sands, &now, &res);
timerstring(&res, duration, sizeof(duration));
vty_out(vty,
" %d Pending LSAs for LSReq in Time %s [thread %s]\n",
on->request_list->count, duration,
- (thread_is_scheduled(on->thread_send_lsreq) ? "on"
- : "off"));
+ (event_is_scheduled(on->thread_send_lsreq) ? "on"
+ : "off"));
for (ALL_LSDB(on->request_list, lsa, lsanext))
vty_out(vty, " %s\n", lsa->name);
timerclear(&res);
- if (thread_is_scheduled(on->thread_send_lsupdate))
+ if (event_is_scheduled(on->thread_send_lsupdate))
timersub(&on->thread_send_lsupdate->u.sands, &now,
&res);
timerstring(&res, duration, sizeof(duration));
vty_out(vty,
" %d Pending LSAs for LSUpdate in Time %s [thread %s]\n",
on->lsupdate_list->count, duration,
- (thread_is_scheduled(on->thread_send_lsupdate)
- ? "on"
- : "off"));
+ (event_is_scheduled(on->thread_send_lsupdate) ? "on"
+ : "off"));
for (ALL_LSDB(on->lsupdate_list, lsa, lsanext))
vty_out(vty, " %s\n", lsa->name);
timerclear(&res);
- if (thread_is_scheduled(on->thread_send_lsack))
+ if (event_is_scheduled(on->thread_send_lsack))
timersub(&on->thread_send_lsack->u.sands, &now, &res);
timerstring(&res, duration, sizeof(duration));
vty_out(vty,
" %d Pending LSAs for LSAck in Time %s [thread %s]\n",
on->lsack_list->count, duration,
- (thread_is_scheduled(on->thread_send_lsack) ? "on"
- : "off"));
+ (event_is_scheduled(on->thread_send_lsack) ? "on"
+ : "off"));
for (ALL_LSDB(on->lsack_list, lsa, lsanext))
vty_out(vty, " %s\n", lsa->name);