]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: Try to open 5424 log destination when changing log threshold
authorMartin Buck <mb-tmp-tvguho.pbz@gromit.dyndns.org>
Mon, 6 Jan 2025 11:47:33 +0000 (12:47 +0100)
committerMartin Buck <mb-tmp-tvguho.pbz@gromit.dyndns.org>
Wed, 8 Jan 2025 12:30:40 +0000 (13:30 +0100)
When changing the log threshold (prio_min) using zlog_5424_apply_meta(), try
to open the log destination using zlog_5424_open() if we haven't done so
before. Without this, we might never open the destination at all, because
when zlog_5424_apply_dst() gets called (which so far was the only initial
caller of zlog_5424_open()), chances are that prio_min is still at its
initial value of ZLOG_DISABLED, causing it to skip the call to
zlog_5424_open().

Signed-off-by: Martin Buck <mb-tmp-tvguho.pbz@gromit.dyndns.org>
lib/zlog_5424.c

index 4c60d4b40564c9343b10775320015791a370f631..c8586a1a02a62cf287d14defa180579f6bb72efe 100644 (file)
@@ -1076,9 +1076,17 @@ bool zlog_5424_apply_dst(struct zlog_cfg_5424 *zcf)
 
 bool zlog_5424_apply_meta(struct zlog_cfg_5424 *zcf)
 {
+       int fd;
+
        frr_with_mutex (&zcf->cfg_mtx) {
                if (zcf->active)
-                       zlog_5424_cycle(zcf, zcf->active->fd);
+                       fd = zcf->active->fd;
+               else if (zcf->prio_min != ZLOG_DISABLED)
+                       fd = zlog_5424_open(zcf, -1);
+               else
+                       fd = -1;
+               if (fd >= 0)
+                       zlog_5424_cycle(zcf, fd);
        }
 
        return true;