mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 15:24:43 +00:00
ripd: Remove various macros that overlap THREAD_OFF
Let's just use THREAD_OFF consistently in the code base instead of each daemon having a special macro that needs to be looked at and remembered what it does. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
bc1f09de73
commit
580e37a3fa
@ -64,8 +64,8 @@ static void clear_rip_route(struct rip *rip)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (rinfo) {
|
if (rinfo) {
|
||||||
RIP_TIMER_OFF(rinfo->t_timeout);
|
THREAD_OFF(rinfo->t_timeout);
|
||||||
RIP_TIMER_OFF(rinfo->t_garbage_collect);
|
THREAD_OFF(rinfo->t_garbage_collect);
|
||||||
listnode_delete(list, rinfo);
|
listnode_delete(list, rinfo);
|
||||||
rip_info_free(rinfo);
|
rip_info_free(rinfo);
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ static struct rip_peer *rip_peer_new(void)
|
|||||||
|
|
||||||
static void rip_peer_free(struct rip_peer *peer)
|
static void rip_peer_free(struct rip_peer *peer)
|
||||||
{
|
{
|
||||||
RIP_TIMER_OFF(peer->t_timeout);
|
THREAD_OFF(peer->t_timeout);
|
||||||
XFREE(MTYPE_RIP_PEER, peer);
|
XFREE(MTYPE_RIP_PEER, peer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
44
ripd/ripd.c
44
ripd/ripd.c
@ -144,7 +144,7 @@ static void rip_garbage_collect(struct thread *t)
|
|||||||
rinfo = THREAD_ARG(t);
|
rinfo = THREAD_ARG(t);
|
||||||
|
|
||||||
/* Off timeout timer. */
|
/* Off timeout timer. */
|
||||||
RIP_TIMER_OFF(rinfo->t_timeout);
|
THREAD_OFF(rinfo->t_timeout);
|
||||||
|
|
||||||
/* Get route_node pointer. */
|
/* Get route_node pointer. */
|
||||||
rp = rinfo->rp;
|
rp = rinfo->rp;
|
||||||
@ -226,14 +226,14 @@ struct rip_info *rip_ecmp_replace(struct rip *rip, struct rip_info *rinfo_new)
|
|||||||
if (tmp_rinfo == rinfo)
|
if (tmp_rinfo == rinfo)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
RIP_TIMER_OFF(tmp_rinfo->t_timeout);
|
THREAD_OFF(tmp_rinfo->t_timeout);
|
||||||
RIP_TIMER_OFF(tmp_rinfo->t_garbage_collect);
|
THREAD_OFF(tmp_rinfo->t_garbage_collect);
|
||||||
list_delete_node(list, node);
|
list_delete_node(list, node);
|
||||||
rip_info_free(tmp_rinfo);
|
rip_info_free(tmp_rinfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
RIP_TIMER_OFF(rinfo->t_timeout);
|
THREAD_OFF(rinfo->t_timeout);
|
||||||
RIP_TIMER_OFF(rinfo->t_garbage_collect);
|
THREAD_OFF(rinfo->t_garbage_collect);
|
||||||
memcpy(rinfo, rinfo_new, sizeof(struct rip_info));
|
memcpy(rinfo, rinfo_new, sizeof(struct rip_info));
|
||||||
|
|
||||||
if (rip_route_rte(rinfo)) {
|
if (rip_route_rte(rinfo)) {
|
||||||
@ -262,12 +262,12 @@ struct rip_info *rip_ecmp_delete(struct rip *rip, struct rip_info *rinfo)
|
|||||||
struct route_node *rp = rinfo->rp;
|
struct route_node *rp = rinfo->rp;
|
||||||
struct list *list = (struct list *)rp->info;
|
struct list *list = (struct list *)rp->info;
|
||||||
|
|
||||||
RIP_TIMER_OFF(rinfo->t_timeout);
|
THREAD_OFF(rinfo->t_timeout);
|
||||||
|
|
||||||
if (listcount(list) > 1) {
|
if (listcount(list) > 1) {
|
||||||
/* Some other ECMP entries still exist. Just delete this entry.
|
/* Some other ECMP entries still exist. Just delete this entry.
|
||||||
*/
|
*/
|
||||||
RIP_TIMER_OFF(rinfo->t_garbage_collect);
|
THREAD_OFF(rinfo->t_garbage_collect);
|
||||||
listnode_delete(list, rinfo);
|
listnode_delete(list, rinfo);
|
||||||
if (rip_route_rte(rinfo)
|
if (rip_route_rte(rinfo)
|
||||||
&& CHECK_FLAG(rinfo->flags, RIP_RTF_FIB))
|
&& CHECK_FLAG(rinfo->flags, RIP_RTF_FIB))
|
||||||
@ -313,7 +313,7 @@ static void rip_timeout(struct thread *t)
|
|||||||
static void rip_timeout_update(struct rip *rip, struct rip_info *rinfo)
|
static void rip_timeout_update(struct rip *rip, struct rip_info *rinfo)
|
||||||
{
|
{
|
||||||
if (rinfo->metric != RIP_METRIC_INFINITY) {
|
if (rinfo->metric != RIP_METRIC_INFINITY) {
|
||||||
RIP_TIMER_OFF(rinfo->t_timeout);
|
THREAD_OFF(rinfo->t_timeout);
|
||||||
thread_add_timer(master, rip_timeout, rinfo, rip->timeout_time,
|
thread_add_timer(master, rip_timeout, rinfo, rip->timeout_time,
|
||||||
&rinfo->t_timeout);
|
&rinfo->t_timeout);
|
||||||
}
|
}
|
||||||
@ -659,8 +659,8 @@ static void rip_rte_process(struct rte *rte, struct sockaddr_in *from,
|
|||||||
assert(newinfo.metric
|
assert(newinfo.metric
|
||||||
!= RIP_METRIC_INFINITY);
|
!= RIP_METRIC_INFINITY);
|
||||||
|
|
||||||
RIP_TIMER_OFF(rinfo->t_timeout);
|
THREAD_OFF(rinfo->t_timeout);
|
||||||
RIP_TIMER_OFF(rinfo->t_garbage_collect);
|
THREAD_OFF(rinfo->t_garbage_collect);
|
||||||
memcpy(rinfo, &newinfo,
|
memcpy(rinfo, &newinfo,
|
||||||
sizeof(struct rip_info));
|
sizeof(struct rip_info));
|
||||||
rip_timeout_update(rip, rinfo);
|
rip_timeout_update(rip, rinfo);
|
||||||
@ -1614,7 +1614,7 @@ void rip_redistribute_delete(struct rip *rip, int type, int sub_type,
|
|||||||
RIP_TIMER_ON(rinfo->t_garbage_collect,
|
RIP_TIMER_ON(rinfo->t_garbage_collect,
|
||||||
rip_garbage_collect,
|
rip_garbage_collect,
|
||||||
rip->garbage_time);
|
rip->garbage_time);
|
||||||
RIP_TIMER_OFF(rinfo->t_timeout);
|
THREAD_OFF(rinfo->t_timeout);
|
||||||
rinfo->flags |= RIP_RTF_CHANGED;
|
rinfo->flags |= RIP_RTF_CHANGED;
|
||||||
|
|
||||||
if (IS_RIP_DEBUG_EVENT)
|
if (IS_RIP_DEBUG_EVENT)
|
||||||
@ -2506,7 +2506,7 @@ static void rip_update(struct thread *t)
|
|||||||
|
|
||||||
/* Triggered updates may be suppressed if a regular update is due by
|
/* Triggered updates may be suppressed if a regular update is due by
|
||||||
the time the triggered update would be sent. */
|
the time the triggered update would be sent. */
|
||||||
RIP_TIMER_OFF(rip->t_triggered_interval);
|
THREAD_OFF(rip->t_triggered_interval);
|
||||||
rip->trigger = 0;
|
rip->trigger = 0;
|
||||||
|
|
||||||
/* Register myself. */
|
/* Register myself. */
|
||||||
@ -2553,7 +2553,7 @@ static void rip_triggered_update(struct thread *t)
|
|||||||
int interval;
|
int interval;
|
||||||
|
|
||||||
/* Cancel interval timer. */
|
/* Cancel interval timer. */
|
||||||
RIP_TIMER_OFF(rip->t_triggered_interval);
|
THREAD_OFF(rip->t_triggered_interval);
|
||||||
rip->trigger = 0;
|
rip->trigger = 0;
|
||||||
|
|
||||||
/* Logging triggered update. */
|
/* Logging triggered update. */
|
||||||
@ -2603,7 +2603,7 @@ void rip_redistribute_withdraw(struct rip *rip, int type)
|
|||||||
rinfo->metric = RIP_METRIC_INFINITY;
|
rinfo->metric = RIP_METRIC_INFINITY;
|
||||||
RIP_TIMER_ON(rinfo->t_garbage_collect, rip_garbage_collect,
|
RIP_TIMER_ON(rinfo->t_garbage_collect, rip_garbage_collect,
|
||||||
rip->garbage_time);
|
rip->garbage_time);
|
||||||
RIP_TIMER_OFF(rinfo->t_timeout);
|
THREAD_OFF(rinfo->t_timeout);
|
||||||
rinfo->flags |= RIP_RTF_CHANGED;
|
rinfo->flags |= RIP_RTF_CHANGED;
|
||||||
|
|
||||||
if (IS_RIP_DEBUG_EVENT) {
|
if (IS_RIP_DEBUG_EVENT) {
|
||||||
@ -2785,7 +2785,7 @@ void rip_event(struct rip *rip, enum rip_event event, int sock)
|
|||||||
thread_add_read(master, rip_read, rip, sock, &rip->t_read);
|
thread_add_read(master, rip_read, rip, sock, &rip->t_read);
|
||||||
break;
|
break;
|
||||||
case RIP_UPDATE_EVENT:
|
case RIP_UPDATE_EVENT:
|
||||||
RIP_TIMER_OFF(rip->t_update);
|
THREAD_OFF(rip->t_update);
|
||||||
jitter = rip_update_jitter(rip->update_time);
|
jitter = rip_update_jitter(rip->update_time);
|
||||||
thread_add_timer(master, rip_update, rip,
|
thread_add_timer(master, rip_update, rip,
|
||||||
sock ? 2 : rip->update_time + jitter,
|
sock ? 2 : rip->update_time + jitter,
|
||||||
@ -2915,8 +2915,8 @@ void rip_ecmp_disable(struct rip *rip)
|
|||||||
if (tmp_rinfo == rinfo)
|
if (tmp_rinfo == rinfo)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
RIP_TIMER_OFF(tmp_rinfo->t_timeout);
|
THREAD_OFF(tmp_rinfo->t_timeout);
|
||||||
RIP_TIMER_OFF(tmp_rinfo->t_garbage_collect);
|
THREAD_OFF(tmp_rinfo->t_garbage_collect);
|
||||||
list_delete_node(list, node);
|
list_delete_node(list, node);
|
||||||
rip_info_free(tmp_rinfo);
|
rip_info_free(tmp_rinfo);
|
||||||
}
|
}
|
||||||
@ -3508,8 +3508,8 @@ static void rip_instance_disable(struct rip *rip)
|
|||||||
rip_zebra_ipv4_delete(rip, rp);
|
rip_zebra_ipv4_delete(rip, rp);
|
||||||
|
|
||||||
for (ALL_LIST_ELEMENTS_RO(list, listnode, rinfo)) {
|
for (ALL_LIST_ELEMENTS_RO(list, listnode, rinfo)) {
|
||||||
RIP_TIMER_OFF(rinfo->t_timeout);
|
THREAD_OFF(rinfo->t_timeout);
|
||||||
RIP_TIMER_OFF(rinfo->t_garbage_collect);
|
THREAD_OFF(rinfo->t_garbage_collect);
|
||||||
rip_info_free(rinfo);
|
rip_info_free(rinfo);
|
||||||
}
|
}
|
||||||
list_delete(&list);
|
list_delete(&list);
|
||||||
@ -3521,9 +3521,9 @@ static void rip_instance_disable(struct rip *rip)
|
|||||||
rip_redistribute_disable(rip);
|
rip_redistribute_disable(rip);
|
||||||
|
|
||||||
/* Cancel RIP related timers. */
|
/* Cancel RIP related timers. */
|
||||||
RIP_TIMER_OFF(rip->t_update);
|
THREAD_OFF(rip->t_update);
|
||||||
RIP_TIMER_OFF(rip->t_triggered_update);
|
THREAD_OFF(rip->t_triggered_update);
|
||||||
RIP_TIMER_OFF(rip->t_triggered_interval);
|
THREAD_OFF(rip->t_triggered_interval);
|
||||||
|
|
||||||
/* Cancel read thread. */
|
/* Cancel read thread. */
|
||||||
thread_cancel(&rip->t_read);
|
thread_cancel(&rip->t_read);
|
||||||
|
@ -404,9 +404,6 @@ enum rip_event {
|
|||||||
/* Macro for timer turn on. */
|
/* Macro for timer turn on. */
|
||||||
#define RIP_TIMER_ON(T,F,V) thread_add_timer (master, (F), rinfo, (V), &(T))
|
#define RIP_TIMER_ON(T,F,V) thread_add_timer (master, (F), rinfo, (V), &(T))
|
||||||
|
|
||||||
/* Macro for timer turn off. */
|
|
||||||
#define RIP_TIMER_OFF(X) thread_cancel(&(X))
|
|
||||||
|
|
||||||
#define RIP_OFFSET_LIST_IN 0
|
#define RIP_OFFSET_LIST_IN 0
|
||||||
#define RIP_OFFSET_LIST_OUT 1
|
#define RIP_OFFSET_LIST_OUT 1
|
||||||
#define RIP_OFFSET_LIST_MAX 2
|
#define RIP_OFFSET_LIST_MAX 2
|
||||||
|
Loading…
Reference in New Issue
Block a user