diff options
| author | Donald Sharp <sharpd@nvidia.com> | 2022-02-25 08:19:07 -0500 |
|---|---|---|
| committer | Donald Sharp <sharpd@nvidia.com> | 2022-02-25 08:19:07 -0500 |
| commit | e2eff5c3b13ee31ddc1b80d828ce12fba64f6a3b (patch) | |
| tree | 597ebb5a7ff51609a0b7a444b9001ad122914169 /lib/thread.c | |
| parent | 41ff140670e1c1a0cfbea682000a1cfe3a0cc1a0 (diff) | |
lib: Add a Dev catch for when a timer is set for > 1 year
Since there are timers that are created based upon doing some
math and we know that unsigned values when doing math and we accidently
subtract a larger number from a smaller number causes the unsigned
number to wrap to very large numbers, let's put in a small catch
in place to see if there are any places in the system that
mistakes are made and FRR is accidently creating a problem
for itself.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'lib/thread.c')
| -rw-r--r-- | lib/thread.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/thread.c b/lib/thread.c index 58b8e206fa..bc3bfe89d4 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -1052,6 +1052,12 @@ static void _thread_add_timer_timeval(const struct xref_threadsched *xref, if (thread_timer_list_first(&m->timer) == thread) AWAKEN(m); } +#define ONEYEAR2SEC (60 * 60 * 24 * 365) + if (time_relative->tv_sec > ONEYEAR2SEC) + flog_err( + EC_LIB_TIMER_TOO_LONG, + "Timer: %pTHD is created with an expiration that is greater than 1 year", + thread); } |
