From: Donald Sharp Date: Mon, 4 Oct 2021 13:36:27 +0000 (-0400) Subject: ripd: Ensure better `struct thread *` semantics X-Git-Tag: base_8.2~376^2~1 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=64da2e8ecd842759511847a990274616dc05aade;p=matthieu%2Ffrr.git ripd: Ensure better `struct thread *` semantics 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/ripd/rip_interface.c b/ripd/rip_interface.c index a2c86e3b22..2eb7bb6da1 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -805,7 +805,6 @@ static int rip_interface_wakeup(struct thread *t) ifp = THREAD_ARG(t); ri = ifp->info; - ri->t_wakeup = NULL; /* Join to multicast group. */ if (rip_multicast_join(ifp, ri->rip->sock) < 0) { diff --git a/ripd/rip_peer.c b/ripd/rip_peer.c index 63493e2539..12c4edd436 100644 --- a/ripd/rip_peer.c +++ b/ripd/rip_peer.c @@ -95,7 +95,6 @@ static struct rip_peer *rip_peer_get(struct rip *rip, struct in_addr *addr) } /* Update timeout thread. */ - peer->t_timeout = NULL; thread_add_timer(master, rip_peer_timeout, peer, RIP_PEER_TIMER_DEFAULT, &peer->t_timeout); diff --git a/ripd/ripd.c b/ripd/ripd.c index 84fb67956e..145b4de0a0 100644 --- a/ripd/ripd.c +++ b/ripd/ripd.c @@ -142,7 +142,6 @@ static int rip_garbage_collect(struct thread *t) struct route_node *rp; rinfo = THREAD_ARG(t); - rinfo->t_garbage_collect = NULL; /* Off timeout timer. */ RIP_TIMER_OFF(rinfo->t_timeout); @@ -1744,7 +1743,6 @@ static int rip_read(struct thread *t) /* Fetch socket then register myself. */ sock = THREAD_FD(t); - rip->t_read = NULL; /* Add myself to tne next event */ rip_event(rip, RIP_READ, sock); @@ -2545,9 +2543,6 @@ static int rip_update(struct thread *t) { struct rip *rip = THREAD_ARG(t); - /* Clear timer pointer. */ - rip->t_update = NULL; - if (IS_RIP_DEBUG_EVENT) zlog_debug("update timer fire!"); @@ -2588,8 +2583,6 @@ static int rip_triggered_interval(struct thread *t) { struct rip *rip = THREAD_ARG(t); - rip->t_triggered_interval = NULL; - if (rip->trigger) { rip->trigger = 0; rip_triggered_update(t); @@ -2603,9 +2596,6 @@ static int rip_triggered_update(struct thread *t) struct rip *rip = THREAD_ARG(t); int interval; - /* Clear thred pointer. */ - rip->t_triggered_update = NULL; - /* Cancel interval timer. */ RIP_TIMER_OFF(rip->t_triggered_interval); rip->trigger = 0; @@ -2628,7 +2618,6 @@ static int rip_triggered_update(struct thread *t) update is triggered when the timer expires. */ interval = (frr_weak_random() % 5) + 1; - rip->t_triggered_interval = NULL; thread_add_timer(master, rip_triggered_interval, rip, interval, &rip->t_triggered_interval); @@ -2834,7 +2823,6 @@ void rip_event(struct rip *rip, enum rip_event event, int sock) switch (event) { case RIP_READ: - rip->t_read = NULL; thread_add_read(master, rip_read, rip, sock, &rip->t_read); break; case RIP_UPDATE_EVENT: