|
| 1 | +From 1514c6a935e370d0ff4d05e23881398ad7ed1aab Mon Sep 17 00:00:00 2001 |
| 2 | +commit cecf5716d5c8e74aa5afaeec836db624d6f68879 |
| 3 | +Author: Donald Sharp < [email protected]> |
| 4 | +Date: Thu Aug 8 14:58:04 2024 -0400 |
| 5 | + |
| 6 | +commit cecf5716d5c8e74aa5afaeec836db624d6f68879 |
| 7 | +Author: Donald Sharp < [email protected]> |
| 8 | +Date: Thu Aug 8 14:58:04 2024 -0400 |
| 9 | + |
| 10 | + lib: Don't print warning if not a daemon |
| 11 | + |
| 12 | + vtysh will print out the upon |
| 13 | + every run of the program if the ulimit is set stupidly |
| 14 | + large. Prevent this from being displayed for vtysh. |
| 15 | + |
| 16 | + Fixes: #16516 |
| 17 | + Signed-off-by: Donald Sharp < [email protected]> |
| 18 | +--- |
| 19 | + lib/event.c | 5 +++-- |
| 20 | + lib/libfrr.c | 8 ++++++++ |
| 21 | + lib/libfrr.h | 2 +- |
| 22 | + 3 files changed, 12 insertions(+), 3 deletions(-) |
| 23 | + |
| 24 | +diff --git a/lib/event.c b/lib/event.c |
| 25 | +index fc46a11c0..be2637142 100644 |
| 26 | +--- a/lib/event.c |
| 27 | ++++ b/lib/event.c |
| 28 | +@@ -571,8 +571,9 @@ struct event_loop *event_master_create(const char *name) |
| 29 | + } |
| 30 | + |
| 31 | + if (rv->fd_limit > STUPIDLY_LARGE_FD_SIZE) { |
| 32 | +- zlog_warn("FD Limit set: %u is stupidly large. Is this what you intended? Consider using --limit-fds also limiting size to %u", |
| 33 | +- rv->fd_limit, STUPIDLY_LARGE_FD_SIZE); |
| 34 | ++ if (frr_is_daemon()) |
| 35 | ++ zlog_warn("FD Limit set: %u is stupidly large. Is this what you intended? Consider using --limit-fds also limiting size to %u", |
| 36 | ++ rv->fd_limit, STUPIDLY_LARGE_FD_SIZE); |
| 37 | + |
| 38 | + rv->fd_limit = STUPIDLY_LARGE_FD_SIZE; |
| 39 | + } |
| 40 | +diff --git a/lib/libfrr.c b/lib/libfrr.c |
| 41 | +index 2861ebe0b..5dd44c05f 100644 |
| 42 | +--- a/lib/libfrr.c |
| 43 | ++++ b/lib/libfrr.c |
| 44 | +@@ -1445,3 +1445,11 @@ void _libfrr_version(void) |
| 45 | + write(1, banner, sizeof(banner) - 1); |
| 46 | + _exit(0); |
| 47 | + } |
| 48 | ++ |
| 49 | ++bool frr_is_daemon(void) |
| 50 | ++{ |
| 51 | ++ if (di) |
| 52 | ++ return true; |
| 53 | ++ |
| 54 | ++ return false; |
| 55 | ++} |
| 56 | +\ No newline at end of file |
| 57 | +diff --git a/lib/libfrr.h b/lib/libfrr.h |
| 58 | +index ee436d9f8..d9025fe7e 100644 |
| 59 | +--- a/lib/libfrr.h |
| 60 | ++++ b/lib/libfrr.h |
| 61 | +@@ -188,7 +188,7 @@ extern const char *frr_get_progname(void); |
| 62 | + extern enum frr_cli_mode frr_get_cli_mode(void); |
| 63 | + extern uint32_t frr_get_fd_limit(void); |
| 64 | + extern bool frr_is_startup_fd(int fd); |
| 65 | +- |
| 66 | ++extern bool frr_is_daemon(void); |
| 67 | + /* call order of these hooks is as ordered here */ |
| 68 | + DECLARE_HOOK(frr_early_init, (struct event_loop * tm), (tm)); |
| 69 | + DECLARE_HOOK(frr_late_init, (struct event_loop * tm), (tm)); |
| 70 | +-- |
| 71 | +2.20.1 |
| 72 | + |
0 commit comments