]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: Don't print warning if not a daemon
authorDonald Sharp <sharpd@nvidia.com>
Thu, 8 Aug 2024 18:58:04 +0000 (14:58 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Thu, 8 Aug 2024 19:26:41 +0000 (15:26 -0400)
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>
lib/event.c
lib/libfrr.c
lib/libfrr.h

index f4aa7c58b9d275335291c9e1c0e394c9e546db2a..d925d0d5f0fc497b029deeca5853c6da969cd9e0 100644 (file)
@@ -555,8 +555,9 @@ struct event_loop *event_master_create(const char *name)
        }
 
        if (rv->fd_limit > STUPIDLY_LARGE_FD_SIZE) {
-               zlog_warn("FD Limit set: %u is stupidly large.  Is this what you intended?  Consider using --limit-fds also limiting size to %u",
-                         rv->fd_limit, STUPIDLY_LARGE_FD_SIZE);
+               if (frr_is_daemon())
+                       zlog_warn("FD Limit set: %u is stupidly large.  Is this what you intended?  Consider using --limit-fds also limiting size to %u",
+                                 rv->fd_limit, STUPIDLY_LARGE_FD_SIZE);
 
                rv->fd_limit = STUPIDLY_LARGE_FD_SIZE;
        }
index 328c6ec8b21bf838a5a8e667780c717a00cbee57..2a973c9106b7c9bb5f1a492ca0e0921ffb113bf9 100644 (file)
@@ -1474,3 +1474,11 @@ const char *frr_vers2str(uint32_t version, char *buf, int buflen)
 
        return buf;
 }
+
+bool frr_is_daemon(void)
+{
+       if (di)
+               return true;
+
+       return false;
+}
index 3248670c8348059cd8f5a371258ff78d0e0f8103..7ed7be4d984d7338b42a0f492f0df6e9d3fc7edb 100644 (file)
@@ -190,7 +190,7 @@ extern const char *frr_get_progname(void);
 extern enum frr_cli_mode frr_get_cli_mode(void);
 extern uint32_t frr_get_fd_limit(void);
 extern bool frr_is_startup_fd(int fd);
-
+extern bool frr_is_daemon(void);
 /* call order of these hooks is as ordered here */
 DECLARE_HOOK(frr_early_init, (struct event_loop * tm), (tm));
 DECLARE_HOOK(frr_late_init, (struct event_loop * tm), (tm));