From: Donald Sharp Date: Mon, 4 Oct 2021 13:28:36 +0000 (-0400) Subject: ripngd: Ensure better `struct thread *` semantics X-Git-Tag: base_8.2~376^2~2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=c733548963447f4383866f66117fd5e302d53baa;p=matthieu%2Ffrr.git ripngd: Ensure better `struct thread *` semantics 1) Remove `struct thread *` pointers that are never used 2) Do not explicitly set the thread pointer to NULL. FRR should only ever use the appropriate THREAD_ON/THREAD_OFF semantics. This is espacially true for the functions we end up calling the thread for. Signed-off-by: Donald Sharp --- diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c index f374fcb839..7b5e7604d2 100644 --- a/ripngd/ripng_interface.c +++ b/ripngd/ripng_interface.c @@ -618,7 +618,6 @@ static int ripng_interface_wakeup(struct thread *t) ifp = THREAD_ARG(t); ri = ifp->info; - ri->t_wakeup = NULL; /* Join to multicast group. */ if (ripng_multicast_join(ifp, ri->ripng->sock) < 0) { diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c index 4f5c8e7760..86abf1eead 100644 --- a/ripngd/ripngd.c +++ b/ripngd/ripngd.c @@ -429,7 +429,6 @@ static int ripng_garbage_collect(struct thread *t) struct agg_node *rp; rinfo = THREAD_ARG(t); - rinfo->t_garbage_collect = NULL; /* Off timeout timer. */ RIPNG_TIMER_OFF(rinfo->t_timeout); @@ -1320,7 +1319,6 @@ static int ripng_read(struct thread *thread) /* Fetch thread data and set read pointer to empty for event managing. `sock' sould be same as ripng->sock. */ sock = THREAD_FD(thread); - ripng->t_read = NULL; /* Add myself to the next event. */ ripng_event(ripng, RIPNG_READ, sock); @@ -1418,9 +1416,6 @@ static int ripng_update(struct thread *t) struct interface *ifp; struct ripng_interface *ri; - /* Clear update timer thread. */ - ripng->t_update = NULL; - /* Logging update event. */ if (IS_RIPNG_DEBUG_EVENT) zlog_debug("RIPng update timer expired!"); @@ -1469,8 +1464,6 @@ static int ripng_triggered_interval(struct thread *t) { struct ripng *ripng = THREAD_ARG(t); - ripng->t_triggered_interval = NULL; - if (ripng->trigger) { ripng->trigger = 0; ripng_triggered_update(t); @@ -1486,8 +1479,6 @@ int ripng_triggered_update(struct thread *t) struct ripng_interface *ri; int interval; - ripng->t_triggered_update = NULL; - /* Cancel interval timer. */ thread_cancel(&ripng->t_triggered_interval); ripng->trigger = 0; @@ -1525,7 +1516,6 @@ int ripng_triggered_update(struct thread *t) update is triggered when the timer expires. */ interval = (frr_weak_random() % 5) + 1; - ripng->t_triggered_interval = NULL; thread_add_timer(master, ripng_triggered_interval, ripng, interval, &ripng->t_triggered_interval); @@ -1942,7 +1932,6 @@ void ripng_event(struct ripng *ripng, enum ripng_event event, int sock) /* Update timer jitter. */ jitter = ripng_update_jitter(ripng->update_time); - ripng->t_update = NULL; thread_add_timer(master, ripng_update, ripng, sock ? 2 : ripng->update_time + jitter, &ripng->t_update); diff --git a/ripngd/ripngd.h b/ripngd/ripngd.h index 12e5a6d4ac..6bf687b02a 100644 --- a/ripngd/ripngd.h +++ b/ripngd/ripngd.h @@ -137,10 +137,7 @@ struct ripng { /* RIPng threads. */ struct thread *t_read; - struct thread *t_write; struct thread *t_update; - struct thread *t_garbage; - struct thread *t_zebra; /* Triggered update hack. */ int trigger;