]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ripd: Ensure better `struct thread *` semantics
authorDonald Sharp <sharpd@nvidia.com>
Mon, 4 Oct 2021 13:36:27 +0000 (09:36 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Mon, 4 Oct 2021 13:36:54 +0000 (09:36 -0400)
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 <sharpd@nvidia.com>
ripd/rip_interface.c
ripd/rip_peer.c
ripd/ripd.c

index a2c86e3b2280a7222d60de46e31fdb35f13dc3e8..2eb7bb6da1e653a3d4d881333c7b42dfbf74d0fb 100644 (file)
@@ -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) {
index 63493e2539c315ed452ff6ee3f12dbad8a898290..12c4edd43611c44299e29739249f27b25642f90e 100644 (file)
@@ -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);
 
index 84fb67956e63eee4cf6d27de0dcbe36a6cc6b110..145b4de0a0d119dd7870322d5c9d6b3b7168b787 100644 (file)
@@ -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: