backport patches from upstream
Signed-off-by: Qiumiao Zhang <zhangqiumiao1@huawei.com>
This commit is contained in:
parent
234afec904
commit
4a0738c437
@ -0,0 +1,155 @@
|
||||
From f886d1f1b2fcda9d9b72efdc15b387d3fc9b1f55 Mon Sep 17 00:00:00 2001
|
||||
From: Rainer Gerhards <rgerhards@adiscon.com>
|
||||
Date: Wed, 6 Dec 2023 17:11:20 +0100
|
||||
Subject: [PATCH] core bugfix: rsyslog messages may not always have FQDN
|
||||
|
||||
Even if hostname FQDN is configured, rsyslog internal messages generated
|
||||
after rsyslog startup and before the first HUP will not necessarily have
|
||||
FQDN but instead only the shortname of the local host. This commit
|
||||
fixes the situation.
|
||||
|
||||
Special thanks to github user eciii for doing a great bug analysis
|
||||
and helping us considerably to fix the issue.
|
||||
|
||||
closes https://github.com/rsyslog/rsyslog/issues/5218
|
||||
|
||||
Reference:https://github.com/rsyslog/rsyslog/commit/f886d1f1b2fcda9d9b72efdc15b387d3fc9b1f55
|
||||
Conflict:NA
|
||||
---
|
||||
runtime/glbl.c | 4 ++--
|
||||
runtime/net.c | 4 ++--
|
||||
runtime/net.h | 2 +-
|
||||
runtime/rsconf.h | 2 +-
|
||||
runtime/rsyslog.h | 4 ++--
|
||||
tools/rsyslogd.c | 10 ++++++----
|
||||
6 files changed, 14 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/runtime/glbl.c b/runtime/glbl.c
|
||||
index a2e2545..3fdaeea 100644
|
||||
--- a/runtime/glbl.c
|
||||
+++ b/runtime/glbl.c
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
* Module begun 2008-04-16 by Rainer Gerhards
|
||||
*
|
||||
- * Copyright 2008-2022 Rainer Gerhards and Adiscon GmbH.
|
||||
+ * Copyright 2008-2023 Rainer Gerhards and Adiscon GmbH.
|
||||
*
|
||||
* This file is part of the rsyslog runtime library.
|
||||
*
|
||||
@@ -1431,7 +1431,7 @@ finalize_it:
|
||||
* hostname. These messages are currently in iminternal queue. Once they
|
||||
* are taken from that queue, the hostname will be adapted.
|
||||
*/
|
||||
- queryLocalHostname();
|
||||
+ queryLocalHostname(loadConf);
|
||||
RETiRet;
|
||||
}
|
||||
|
||||
diff --git a/runtime/net.c b/runtime/net.c
|
||||
index 8611125..ff46cbc 100644
|
||||
--- a/runtime/net.c
|
||||
+++ b/runtime/net.c
|
||||
@@ -1160,7 +1160,7 @@ cvthname(struct sockaddr_storage *f, prop_t **localName, prop_t **fqdn, prop_t *
|
||||
*/
|
||||
#define EMPTY_HOSTNAME_REPLACEMENT "localhost-empty-hostname"
|
||||
static rsRetVal
|
||||
-getLocalHostname(uchar **ppName)
|
||||
+getLocalHostname(rsconf_t *const pConf, uchar **ppName)
|
||||
{
|
||||
DEFiRet;
|
||||
char hnbuf[8192];
|
||||
@@ -1183,7 +1183,7 @@ getLocalHostname(uchar **ppName)
|
||||
|
||||
char *dot = strstr(hnbuf, ".");
|
||||
struct addrinfo *res = NULL;
|
||||
- if(!empty_hostname && dot == NULL && runConf != NULL && !glbl.GetDisableDNS(runConf)) {
|
||||
+ if(!empty_hostname && dot == NULL && pConf != NULL && !glbl.GetDisableDNS(pConf)) {
|
||||
/* we need to (try) to find the real name via resolver */
|
||||
struct addrinfo flags;
|
||||
memset(&flags, 0, sizeof(flags));
|
||||
diff --git a/runtime/net.h b/runtime/net.h
|
||||
index c2847f6..88d2df5 100644
|
||||
--- a/runtime/net.h
|
||||
+++ b/runtime/net.h
|
||||
@@ -152,7 +152,7 @@ BEGINinterface(net) /* name must also be changed in ENDinterface macro! */
|
||||
int ipfreebind, char *device);
|
||||
void (*closeUDPListenSockets)(int *finet);
|
||||
int (*isAllowedSender)(uchar *pszType, struct sockaddr *pFrom, const char *pszFromHost); /* deprecated! */
|
||||
- rsRetVal (*getLocalHostname)(uchar**);
|
||||
+ rsRetVal (*getLocalHostname)(rsconf_t *const, uchar**);
|
||||
int (*should_use_so_bsdcompat)(void);
|
||||
/* permitted peer handling should be replaced by something better (see comments above) */
|
||||
rsRetVal (*AddPermittedPeer)(permittedPeers_t **ppRootPeer, uchar *pszID);
|
||||
diff --git a/runtime/rsconf.h b/runtime/rsconf.h
|
||||
index dd89b81..58f4212 100644
|
||||
--- a/runtime/rsconf.h
|
||||
+++ b/runtime/rsconf.h
|
||||
@@ -1,6 +1,6 @@
|
||||
/* The rsconf object. It models a complete rsyslog configuration.
|
||||
*
|
||||
- * Copyright 2011-2022 Rainer Gerhards and Adiscon GmbH.
|
||||
+ * Copyright 2011-2023 Rainer Gerhards and Adiscon GmbH.
|
||||
*
|
||||
* This file is part of the rsyslog runtime library.
|
||||
*
|
||||
diff --git a/runtime/rsyslog.h b/runtime/rsyslog.h
|
||||
index 2607506..b28d628 100644
|
||||
--- a/runtime/rsyslog.h
|
||||
+++ b/runtime/rsyslog.h
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Begun 2005-09-15 RGerhards
|
||||
*
|
||||
- * Copyright (C) 2005-2019 by Rainer Gerhards and Adiscon GmbH
|
||||
+ * Copyright (C) 2005-2023 by Rainer Gerhards and Adiscon GmbH
|
||||
*
|
||||
* This file is part of the rsyslog runtime library.
|
||||
*
|
||||
@@ -781,7 +781,7 @@ rsRetVal rsrtExit(void);
|
||||
int rsrtIsInit(void);
|
||||
void rsrtSetErrLogger(void (*errLogger)(const int, const int, const uchar*));
|
||||
void dfltErrLogger(const int, const int, const uchar *errMsg);
|
||||
-rsRetVal queryLocalHostname(void);
|
||||
+rsRetVal queryLocalHostname(rsconf_t *const);
|
||||
|
||||
|
||||
/* this define below is (later) intended to be used to implement empty
|
||||
diff --git a/tools/rsyslogd.c b/tools/rsyslogd.c
|
||||
index cc3486e..a5548a3 100644
|
||||
--- a/tools/rsyslogd.c
|
||||
+++ b/tools/rsyslogd.c
|
||||
@@ -237,16 +237,18 @@ setsid(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
-
|
||||
+/* we need a pointer to the conf, because in early startup stage we
|
||||
+ * need to use loadConf, later on runConf.
|
||||
+ */
|
||||
rsRetVal
|
||||
-queryLocalHostname(void)
|
||||
+queryLocalHostname(rsconf_t *const pConf)
|
||||
{
|
||||
uchar *LocalHostName = NULL;
|
||||
uchar *LocalDomain = NULL;
|
||||
uchar *LocalFQDNName;
|
||||
DEFiRet;
|
||||
|
||||
- CHKiRet(net.getLocalHostname(&LocalFQDNName));
|
||||
+ CHKiRet(net.getLocalHostname(pConf, &LocalFQDNName));
|
||||
uchar *dot = (uchar*) strstr((char*)LocalFQDNName, ".");
|
||||
if(dot == NULL) {
|
||||
CHKmalloc(LocalHostName = (uchar*) strdup((char*)LocalFQDNName));
|
||||
@@ -1859,7 +1861,7 @@ doHUP(void)
|
||||
logmsgInternal(NO_ERRCODE, LOG_SYSLOG|LOG_INFO, (uchar*)buf, 0);
|
||||
}
|
||||
|
||||
- queryLocalHostname(); /* re-read our name */
|
||||
+ queryLocalHostname(runConf); /* re-read our name */
|
||||
ruleset.IterateAllActions(ourConf, doHUPActions, NULL);
|
||||
DBGPRINTF("doHUP: doing modules\n");
|
||||
modDoHUP();
|
||||
--
|
||||
2.19.1
|
||||
|
||||
29
backport-imfile-remove-state-file-on-file-delete-fix.patch
Normal file
29
backport-imfile-remove-state-file-on-file-delete-fix.patch
Normal file
@ -0,0 +1,29 @@
|
||||
From eadb0b6d93867c26a26f0a5effa7332420d319cc Mon Sep 17 00:00:00 2001
|
||||
From: alakatos <alakatos@redhat.com>
|
||||
Date: Fri, 3 Nov 2023 10:24:15 +0100
|
||||
Subject: [PATCH] imfile: remove state file on file delete fix
|
||||
|
||||
The state file would remain in the working directory
|
||||
after shutdown, even though deleteStateOnfileDelete is
|
||||
set to "on" and the monitored file was removed.
|
||||
|
||||
Fixes #5258
|
||||
|
||||
Reference:https://github.com/rsyslog/rsyslog/commit/eadb0b6d93867c26a26f0a5effa7332420d319cc
|
||||
Conflict:NA
|
||||
---
|
||||
plugins/imfile/imfile.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/plugins/imfile/imfile.c b/plugins/imfile/imfile.c
|
||||
index 5febd6db67..3b0bb10698 100644
|
||||
--- a/plugins/imfile/imfile.c
|
||||
+++ b/plugins/imfile/imfile.c
|
||||
@@ -1153,6 +1153,7 @@ fs_node_destroy(fs_node_t *const node)
|
||||
DBGPRINTF("node destroy: %p edges:\n", node);
|
||||
|
||||
for(edge = node->edges ; edge != NULL ; ) {
|
||||
+ detect_updates(edge);
|
||||
fs_node_destroy(edge->node);
|
||||
fs_edge_t *const toDel = edge;
|
||||
edge = edge->next;
|
||||
@ -0,0 +1,85 @@
|
||||
From 25224fb536488ae63e6addd2c9005bc2b8dc126a Mon Sep 17 00:00:00 2001
|
||||
From: Rainer Gerhards <rgerhards@adiscon.com>
|
||||
Date: Wed, 21 Feb 2024 09:31:00 +0100
|
||||
Subject: [PATCH] omfile: do not carry out actual action when writing to
|
||||
/dev/null
|
||||
|
||||
In some use cases omfile is configured to write to /dev/null. This seems
|
||||
primarily be done because of statistics gathering but maybe some other
|
||||
scenarios. We now add conditional logic to not do any actual omfile
|
||||
action when the target file is /dev/null.
|
||||
|
||||
Note: this check only works on static file names. When /dev/null is
|
||||
evaluated as part of dynafile, it will be handled just in the regular
|
||||
case like before this patch.
|
||||
|
||||
Reference:https://github.com/rsyslog/rsyslog/commit/25224fb536488ae63e6addd2c9005bc2b8dc126a
|
||||
Conflict:NA
|
||||
---
|
||||
tools/omfile.c | 15 ++++++++++++++-
|
||||
1 file changed, 14 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tools/omfile.c b/tools/omfile.c
|
||||
index 64578c4..e18809a 100644
|
||||
--- a/tools/omfile.c
|
||||
+++ b/tools/omfile.c
|
||||
@@ -17,7 +17,7 @@
|
||||
* pipes. These have been moved to ompipe, to reduced the entanglement
|
||||
* between the two different functionalities. -- rgerhards
|
||||
*
|
||||
- * Copyright 2007-2022 Adiscon GmbH.
|
||||
+ * Copyright 2007-2024 Adiscon GmbH.
|
||||
*
|
||||
* This file is part of rsyslog.
|
||||
*
|
||||
@@ -139,6 +139,7 @@ typedef struct _instanceData {
|
||||
strm_t *pStrm; /* our output stream */
|
||||
short nInactive; /* number of minutes not writen (STATIC files only) */
|
||||
char bDynamicName; /* 0 - static name, 1 - dynamic name (with properties) */
|
||||
+ int isDevNull; /* do we "write" to /dev/null? - if so, do nothing */
|
||||
int fCreateMode; /* file creation mode for open() */
|
||||
int fDirCreateMode; /* creation mode for mkdir() */
|
||||
int bCreateDirs; /* auto-create directories? */
|
||||
@@ -1086,6 +1087,11 @@ BEGINcommitTransaction
|
||||
instanceData *__restrict__ const pData = pWrkrData->pData;
|
||||
unsigned i;
|
||||
CODESTARTcommitTransaction
|
||||
+
|
||||
+ if(pData->isDevNull) {
|
||||
+ goto terminate;
|
||||
+ }
|
||||
+
|
||||
pthread_mutex_lock(&pData->mutWrite);
|
||||
|
||||
for(i = 0 ; i < nParams ; ++i) {
|
||||
@@ -1110,6 +1116,8 @@ finalize_it:
|
||||
iRet = (pData->bDynamicName && runModConf->bDynafileDoNotSuspend) ?
|
||||
RS_RET_OK : RS_RET_SUSPENDED;
|
||||
}
|
||||
+
|
||||
+terminate:
|
||||
ENDcommitTransaction
|
||||
|
||||
|
||||
@@ -1139,6 +1147,7 @@ setInstParamDefaults(instanceData *__restrict__ const pData)
|
||||
pData->useSigprov = 0;
|
||||
pData->useCryprov = 0;
|
||||
pData->iCloseTimeout = -1;
|
||||
+ pData->isDevNull = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1377,6 +1386,10 @@ CODESTARTnewActInst
|
||||
ABORT_FINALIZE(RS_RET_MISSING_CNFPARAMS);
|
||||
}
|
||||
|
||||
+ if(!strcmp((const char*) pData->fname, "/dev/null")) {
|
||||
+ pData->isDevNull = 1;
|
||||
+ }
|
||||
+
|
||||
if(pData->sigprovName != NULL) {
|
||||
initSigprov(pData, lst);
|
||||
}
|
||||
--
|
||||
2.19.1
|
||||
|
||||
13
rsyslog.spec
13
rsyslog.spec
@ -7,7 +7,7 @@
|
||||
|
||||
Name: rsyslog
|
||||
Version: 8.2210.0
|
||||
Release: 8
|
||||
Release: 9
|
||||
Summary: The rocket-fast system for log processing
|
||||
License: (GPLv3+ and ASL 2.0)
|
||||
URL: http://www.rsyslog.com/
|
||||
@ -49,6 +49,9 @@ Patch6016: backport-tcpflood-bugfix-TCP-sending-was-not-implemented-properl
|
||||
Patch6017: backport-tcpflood-bugfix-plain-tcp-send-error-not-properly-reported.patch
|
||||
Patch6018: backport-fix-startup-issue-on-modern-systemd-systems.patch
|
||||
Patch6019: backport-tcp-net-subsystem-handle-data-race-gracefully.patch
|
||||
Patch6020: backport-imfile-remove-state-file-on-file-delete-fix.patch
|
||||
Patch6021: backport-core-bugfix-rsyslog-messages-may-not-always-have-FQD.patch
|
||||
Patch6022: backport-omfile-do-not-carry-out-actual-action-when-writing-t.patch
|
||||
|
||||
BuildRequires: gcc autoconf automake bison dos2unix flex pkgconfig python3-docutils libtool
|
||||
BuildRequires: libgcrypt-devel libuuid-devel zlib-devel krb5-devel libnet-devel gnutls-devel
|
||||
@ -514,6 +517,14 @@ done
|
||||
%{_mandir}/man1/rscryutil.1.gz
|
||||
|
||||
%changelog
|
||||
* Tue Jun 18 2024 zhangqiumiao <zhangqiumiao1@huawei.com> - 8.2210.0-9
|
||||
- Type:bugfix
|
||||
- CVE:NA
|
||||
- SUG:NA
|
||||
- DESC:imfile: remove state file on file delete fix
|
||||
omfile: do not carry out actual action when writing to /dev/null
|
||||
core bugfix: rsyslog messages may not always have FQDN
|
||||
|
||||
* Thu Mar 21 2024 zhangqiumiao <zhangqiumiao1@huawei.com> - 8.2210.0-8
|
||||
- Type:bugfix
|
||||
- CVE:NA
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user