]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib, vrrpd: Use THREAD_ARG
authorDonald Sharp <sharpd@nvidia.com>
Fri, 3 Jun 2022 15:38:15 +0000 (11:38 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Thu, 21 Jul 2022 12:30:50 +0000 (08:30 -0400)
Don't auto set the thread->arg pointer.  It is private
and should be only accessed through the THREAD_ARG pointer.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
lib/agentx.c
lib/northbound_grpc.cpp
vrrpd/vrrp.c

index e03e19aad5925496c2dab662c020549448181ef6..4c087219cb7e331132baefdc13f33a31906e0ebb 100644 (file)
@@ -146,9 +146,9 @@ static void agentx_events_update(void)
                else if (FD_ISSET(fd, &fds)) {
                        struct listnode *newln;
                        thr = XCALLOC(MTYPE_TMP, sizeof(struct thread *));
-                       thread_add_read(agentx_tm, agentx_read, NULL, fd, thr);
+
                        newln = listnode_add_before(events, ln, thr);
-                       (*thr)->arg = newln;
+                       thread_add_read(agentx_tm, agentx_read, newln, fd, thr);
                }
        }
 
index 9cb999110b41aab6c65a6851cee9b59f441422de..95721ffc7745444c0cd1505cdffe134b3750169f 100644 (file)
@@ -198,7 +198,7 @@ class RpcStateBase
 
        static void c_callback(struct thread *thread)
        {
-               auto _tag = static_cast<RpcStateBase *>(thread->arg);
+               auto _tag = static_cast<RpcStateBase *>(THREAD_ARG(thread));
                /*
                 * We hold the lock until the callback finishes and has updated
                 * _tag->state, then we signal done and release.
index 3081c0d955bc6701ad33635d45d621810b2cb5e1..4a0356411f6594cf86d929cc41859aa5eb9e34bd 100644 (file)
@@ -985,7 +985,7 @@ static int vrrp_recv_advertisement(struct vrrp_router *r, struct ipaddr *src,
  */
 static void vrrp_read(struct thread *thread)
 {
-       struct vrrp_router *r = thread->arg;
+       struct vrrp_router *r = THREAD_ARG(thread);
 
        struct vrrp_pkt *pkt;
        ssize_t pktsize;
@@ -1480,7 +1480,7 @@ static void vrrp_change_state(struct vrrp_router *r, int to)
  */
 static void vrrp_adver_timer_expire(struct thread *thread)
 {
-       struct vrrp_router *r = thread->arg;
+       struct vrrp_router *r = THREAD_ARG(thread);
 
        DEBUGD(&vrrp_dbg_proto,
               VRRP_LOGPFX VRRP_LOGPFX_VRID VRRP_LOGPFX_FAM
@@ -1508,7 +1508,7 @@ static void vrrp_adver_timer_expire(struct thread *thread)
  */
 static void vrrp_master_down_timer_expire(struct thread *thread)
 {
-       struct vrrp_router *r = thread->arg;
+       struct vrrp_router *r = THREAD_ARG(thread);
 
        zlog_info(VRRP_LOGPFX VRRP_LOGPFX_VRID VRRP_LOGPFX_FAM
                  "Master_Down_Timer expired",