Skip to content

Commit cecf571

Browse files
committed
lib: Don't print warning if not a daemon
vtysh will print out the `stupidly large FD limit` upon every run of the program if the ulimit is set stupidly large. Prevent this from being displayed for vtysh. Fixes: #16516 Signed-off-by: Donald Sharp <sharpd@nvidia.com>
1 parent 7b8ca3e commit cecf571

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

lib/event.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -555,8 +555,9 @@ struct event_loop *event_master_create(const char *name)
555555
}
556556

557557
if (rv->fd_limit > STUPIDLY_LARGE_FD_SIZE) {
558-
zlog_warn("FD Limit set: %u is stupidly large. Is this what you intended? Consider using --limit-fds also limiting size to %u",
559-
rv->fd_limit, STUPIDLY_LARGE_FD_SIZE);
558+
if (frr_is_daemon())
559+
zlog_warn("FD Limit set: %u is stupidly large. Is this what you intended? Consider using --limit-fds also limiting size to %u",
560+
rv->fd_limit, STUPIDLY_LARGE_FD_SIZE);
560561

561562
rv->fd_limit = STUPIDLY_LARGE_FD_SIZE;
562563
}

lib/libfrr.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1474,3 +1474,11 @@ const char *frr_vers2str(uint32_t version, char *buf, int buflen)
14741474

14751475
return buf;
14761476
}
1477+
1478+
bool frr_is_daemon(void)
1479+
{
1480+
if (di)
1481+
return true;
1482+
1483+
return false;
1484+
}

lib/libfrr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ extern const char *frr_get_progname(void);
190190
extern enum frr_cli_mode frr_get_cli_mode(void);
191191
extern uint32_t frr_get_fd_limit(void);
192192
extern bool frr_is_startup_fd(int fd);
193-
193+
extern bool frr_is_daemon(void);
194194
/* call order of these hooks is as ordered here */
195195
DECLARE_HOOK(frr_early_init, (struct event_loop * tm), (tm));
196196
DECLARE_HOOK(frr_late_init, (struct event_loop * tm), (tm));

0 commit comments

Comments
 (0)