diff options
author | Mark Stapp <mjs@voltanet.io> | 2020-07-06 18:55:03 +0200 |
---|---|---|
committer | Mark Stapp <mjs@voltanet.io> | 2020-10-23 14:59:34 +0200 |
commit | b3d6bc6ef0140a194b4bc2993a6aba72ab5d54c9 (patch) | |
tree | b5ef6dcab41d9da516a6ff044056e0faca7b35da /ripngd | |
parent | Merge pull request #7345 from opensourcerouting/bgp-aggr-suppress (diff) | |
download | frr-b3d6bc6ef0140a194b4bc2993a6aba72ab5d54c9.tar.xz frr-b3d6bc6ef0140a194b4bc2993a6aba72ab5d54c9.zip |
* : update signature of thread_cancel api
Change thread_cancel to take a ** to an event, NULL-check
before dereferencing, and NULL the caller's pointer. Update
many callers to use the new signature.
Signed-off-by: Mark Stapp <mjs@voltanet.io>
Diffstat (limited to 'ripngd')
-rw-r--r-- | ripngd/ripng_interface.c | 5 | ||||
-rw-r--r-- | ripngd/ripng_peer.c | 4 | ||||
-rw-r--r-- | ripngd/ripngd.c | 21 | ||||
-rw-r--r-- | ripngd/ripngd.h | 8 |
4 files changed, 8 insertions, 30 deletions
diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c index 16859c2d2..115d7a6b9 100644 --- a/ripngd/ripng_interface.c +++ b/ripngd/ripng_interface.c @@ -321,10 +321,7 @@ void ripng_interface_clean(struct ripng *ripng) ri->enable_interface = 0; ri->running = 0; - if (ri->t_wakeup) { - thread_cancel(ri->t_wakeup); - ri->t_wakeup = NULL; - } + thread_cancel(&ri->t_wakeup); } } diff --git a/ripngd/ripng_peer.c b/ripngd/ripng_peer.c index e6ff58dd0..0ac489c67 100644 --- a/ripngd/ripng_peer.c +++ b/ripngd/ripng_peer.c @@ -95,8 +95,7 @@ static struct ripng_peer *ripng_peer_get(struct ripng *ripng, peer = ripng_peer_lookup(ripng, addr); if (peer) { - if (peer->t_timeout) - thread_cancel(peer->t_timeout); + thread_cancel(&peer->t_timeout); } else { peer = ripng_peer_new(); peer->ripng = ripng; @@ -105,7 +104,6 @@ static struct ripng_peer *ripng_peer_get(struct ripng *ripng, } /* Update timeout thread. */ - peer->t_timeout = NULL; thread_add_timer(master, ripng_peer_timeout, peer, RIPNG_PEER_TIMER_DEFAULT, &peer->t_timeout); diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c index 060477010..8d9249e4a 100644 --- a/ripngd/ripngd.c +++ b/ripngd/ripngd.c @@ -1463,10 +1463,7 @@ static int ripng_update(struct thread *t) /* Triggered updates may be suppressed if a regular update is due by the time the triggered update would be sent. */ - if (ripng->t_triggered_interval) { - thread_cancel(ripng->t_triggered_interval); - ripng->t_triggered_interval = NULL; - } + thread_cancel(&ripng->t_triggered_interval); ripng->trigger = 0; /* Reset flush event. */ @@ -1500,10 +1497,7 @@ int ripng_triggered_update(struct thread *t) ripng->t_triggered_update = NULL; /* Cancel interval timer. */ - if (ripng->t_triggered_interval) { - thread_cancel(ripng->t_triggered_interval); - ripng->t_triggered_interval = NULL; - } + thread_cancel(&ripng->t_triggered_interval); ripng->trigger = 0; /* Logging triggered update. */ @@ -1952,10 +1946,8 @@ void ripng_event(struct ripng *ripng, enum ripng_event event, int sock) &ripng->t_read); break; case RIPNG_UPDATE_EVENT: - if (ripng->t_update) { - thread_cancel(ripng->t_update); - ripng->t_update = NULL; - } + thread_cancel(&ripng->t_update); + /* Update timer jitter. */ jitter = ripng_update_jitter(ripng->update_time); @@ -2719,10 +2711,7 @@ static void ripng_instance_disable(struct ripng *ripng) RIPNG_TIMER_OFF(ripng->t_triggered_interval); /* Cancel the read thread */ - if (ripng->t_read) { - thread_cancel(ripng->t_read); - ripng->t_read = NULL; - } + thread_cancel(&ripng->t_read); /* Close the RIPng socket */ if (ripng->sock >= 0) { diff --git a/ripngd/ripngd.h b/ripngd/ripngd.h index 70508d5cb..97291829b 100644 --- a/ripngd/ripngd.h +++ b/ripngd/ripngd.h @@ -351,13 +351,7 @@ enum ripng_event { /* RIPng timer on/off macro. */ #define RIPNG_TIMER_ON(T,F,V) thread_add_timer (master, (F), rinfo, (V), &(T)) -#define RIPNG_TIMER_OFF(T) \ - do { \ - if (T) { \ - thread_cancel(T); \ - (T) = NULL; \ - } \ - } while (0) +#define RIPNG_TIMER_OFF(T) thread_cancel(&(T)); #define RIPNG_OFFSET_LIST_IN 0 #define RIPNG_OFFSET_LIST_OUT 1 |