diff options
author | Donald Sharp <sharpd@nvidia.com> | 2021-10-04 15:47:29 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@nvidia.com> | 2021-10-04 15:47:29 +0200 |
commit | eb946ef5052e7aaddc1975f7a8a287d439e0ee29 (patch) | |
tree | 138e6ac681e01bead4cf20bfa75c08d26c5332ae /eigrpd | |
parent | ripd: Ensure better `struct thread *` semantics (diff) | |
download | frr-eb946ef5052e7aaddc1975f7a8a287d439e0ee29.tar.xz frr-eb946ef5052e7aaddc1975f7a8a287d439e0ee29.zip |
eigrpd: Ensure better `struct thread *` semantics
1) 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.
2) Fix mixup of `struct eigrp_interface` and `struct eigrp`
usage of the same thread pointer.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'eigrpd')
-rw-r--r-- | eigrpd/eigrp_filter.c | 4 | ||||
-rw-r--r-- | eigrpd/eigrp_hello.c | 2 | ||||
-rw-r--r-- | eigrpd/eigrp_interface.c | 2 | ||||
-rw-r--r-- | eigrpd/eigrp_packet.c | 6 | ||||
-rw-r--r-- | eigrpd/eigrp_update.c | 4 | ||||
-rw-r--r-- | eigrpd/eigrpd.c | 1 |
6 files changed, 2 insertions, 17 deletions
diff --git a/eigrpd/eigrp_filter.c b/eigrpd/eigrp_filter.c index 8f80b78d2..bb0cf51bd 100644 --- a/eigrpd/eigrp_filter.c +++ b/eigrpd/eigrp_filter.c @@ -203,9 +203,8 @@ void eigrp_distribute_update(struct distribute_ctx *ctx, /* Cancel GR scheduled */ thread_cancel(&(ei->t_distribute)); /* schedule Graceful restart for interface in 10sec */ - e->t_distribute = NULL; thread_add_timer(master, eigrp_distribute_timer_interface, ei, 10, - &e->t_distribute); + &ei->t_distribute); } /* @@ -263,7 +262,6 @@ int eigrp_distribute_timer_process(struct thread *thread) struct eigrp *eigrp; eigrp = THREAD_ARG(thread); - eigrp->t_distribute = NULL; /* execute GR for whole process */ eigrp_update_send_process_GR(eigrp, EIGRP_GR_FILTER, NULL); diff --git a/eigrpd/eigrp_hello.c b/eigrpd/eigrp_hello.c index e3680b31a..2ff8fc5f3 100644 --- a/eigrpd/eigrp_hello.c +++ b/eigrpd/eigrp_hello.c @@ -86,7 +86,6 @@ int eigrp_hello_timer(struct thread *thread) struct eigrp_interface *ei; ei = THREAD_ARG(thread); - ei->t_hello = NULL; if (IS_DEBUG_EIGRP(0, TIMERS)) zlog_debug("Start Hello Timer (%s) Expire [%u]", IF_NAME(ei), @@ -96,7 +95,6 @@ int eigrp_hello_timer(struct thread *thread) eigrp_hello_send(ei, EIGRP_HELLO_NORMAL, NULL); /* Hello timer set. */ - ei->t_hello = NULL; thread_add_timer(master, eigrp_hello_timer, ei, ei->params.v_hello, &ei->t_hello); diff --git a/eigrpd/eigrp_interface.c b/eigrpd/eigrp_interface.c index 02e943043..28987b4af 100644 --- a/eigrpd/eigrp_interface.c +++ b/eigrpd/eigrp_interface.c @@ -265,7 +265,7 @@ int eigrp_if_up(struct eigrp_interface *ei) /* Set multicast memberships appropriately for new state. */ eigrp_if_set_multicast(ei); - thread_add_event(master, eigrp_hello_timer, ei, (1), NULL); + thread_add_event(master, eigrp_hello_timer, ei, (1), &ei->t_hello); /*Prepare metrics*/ metric.bandwidth = eigrp_bandwidth_to_scaled(ei->params.bandwidth); diff --git a/eigrpd/eigrp_packet.c b/eigrpd/eigrp_packet.c index 39e384c12..529d94567 100644 --- a/eigrpd/eigrp_packet.c +++ b/eigrpd/eigrp_packet.c @@ -340,8 +340,6 @@ int eigrp_write(struct thread *thread) #endif /* WANT_EIGRP_WRITE_FRAGMENT */ #define EIGRP_WRITE_IPHL_SHIFT 2 - eigrp->t_write = NULL; - node = listhead(eigrp->oi_write_q); assert(node); ei = listgetdata(node); @@ -470,7 +468,6 @@ out: /* If packets still remain in queue, call write thread. */ if (!list_isempty(eigrp->oi_write_q)) { - eigrp->t_write = NULL; thread_add_write(master, eigrp_write, eigrp, eigrp->fd, &eigrp->t_write); } @@ -497,7 +494,6 @@ int eigrp_read(struct thread *thread) eigrp = THREAD_ARG(thread); /* prepare for next packet. */ - eigrp->t_read = NULL; thread_add_read(master, eigrp_read, eigrp, eigrp->fd, &eigrp->t_read); stream_reset(eigrp->ibuf); @@ -1013,7 +1009,6 @@ int eigrp_unack_packet_retrans(struct thread *thread) return eigrp_retrans_count_exceeded(ep, nbr); /*Start retransmission timer*/ - ep->t_retrans_timer = NULL; thread_add_timer(master, eigrp_unack_packet_retrans, nbr, EIGRP_PACKET_RETRANS_TIME, &ep->t_retrans_timer); @@ -1049,7 +1044,6 @@ int eigrp_unack_multicast_packet_retrans(struct thread *thread) return eigrp_retrans_count_exceeded(ep, nbr); /*Start retransmission timer*/ - ep->t_retrans_timer = NULL; thread_add_timer(master, eigrp_unack_multicast_packet_retrans, nbr, EIGRP_PACKET_RETRANS_TIME, &ep->t_retrans_timer); diff --git a/eigrpd/eigrp_update.c b/eigrpd/eigrp_update.c index 0dc509706..8a9eea8a7 100644 --- a/eigrpd/eigrp_update.c +++ b/eigrpd/eigrp_update.c @@ -917,12 +917,10 @@ int eigrp_update_send_GR_thread(struct thread *thread) /* get argument from thread */ nbr = THREAD_ARG(thread); /* remove this thread pointer */ - nbr->t_nbr_send_gr = NULL; /* if there is packet waiting in queue, * schedule this thread again with small delay */ if (nbr->retrans_queue->count > 0) { - nbr->t_nbr_send_gr = NULL; thread_add_timer_msec(master, eigrp_update_send_GR_thread, nbr, 10, &nbr->t_nbr_send_gr); return 0; @@ -934,7 +932,6 @@ int eigrp_update_send_GR_thread(struct thread *thread) /* if it wasn't last chunk, schedule this thread again */ if (nbr->nbr_gr_packet_type != EIGRP_PACKET_PART_LAST) { thread_execute(master, eigrp_update_send_GR_thread, nbr, 0); - nbr->t_nbr_send_gr = NULL; } return 0; @@ -1003,7 +1000,6 @@ void eigrp_update_send_GR(struct eigrp_neighbor *nbr, enum GR_type gr_type, nbr->nbr_gr_packet_type = EIGRP_PACKET_PART_FIRST; /* execute packet sending in thread */ thread_execute(master, eigrp_update_send_GR_thread, nbr, 0); - nbr->t_nbr_send_gr = NULL; } /** diff --git a/eigrpd/eigrpd.c b/eigrpd/eigrpd.c index 103015490..84d4f6aee 100644 --- a/eigrpd/eigrpd.c +++ b/eigrpd/eigrpd.c @@ -171,7 +171,6 @@ static struct eigrp *eigrp_new(uint16_t as, vrf_id_t vrf_id) eigrp->ibuf = stream_new(EIGRP_PACKET_MAX_LEN + 1); - eigrp->t_read = NULL; thread_add_read(master, eigrp_read, eigrp, eigrp->fd, &eigrp->t_read); eigrp->oi_write_q = list_new(); |