]> git.proxmox.com Git - mirror_frr.git/commitdiff
ripngd: Ensure better `struct thread *` semantics
authorDonald Sharp <sharpd@nvidia.com>
Mon, 4 Oct 2021 13:28:36 +0000 (09:28 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Mon, 4 Oct 2021 13:28:36 +0000 (09:28 -0400)
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 <sharpd@nvidia.com>
ripngd/ripng_interface.c
ripngd/ripngd.c
ripngd/ripngd.h

index f374fcb839017a8e838b558244c50df9ddbf52e9..7b5e7604d273de73e31f624a3d7d5cb70c039af3 100644 (file)
@@ -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) {
index 4f5c8e77609d3c606f4d99fd5da6ec00fa091322..86abf1eead7e5daaa0a526b4780ae32d23c66420 100644 (file)
@@ -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);
index 12e5a6d4ac2ebfb0c4c26d69752eb91e3df1b25b..6bf687b02a6d86b92e0f36565bc72095e2780c12 100644 (file)
@@ -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;