mirror of
https://github.com/kernelkit/infix.git
synced 2026-08-01 05:13:01 +02:00
@@ -35,14 +35,14 @@ log()
|
|||||||
{
|
{
|
||||||
local fn="/var/log/syslog"
|
local fn="/var/log/syslog"
|
||||||
[ -n "$1" ] && fn="/var/log/$1"
|
[ -n "$1" ] && fn="/var/log/$1"
|
||||||
less +G "$fn"
|
less +G -r "$fn"
|
||||||
}
|
}
|
||||||
|
|
||||||
follow()
|
follow()
|
||||||
{
|
{
|
||||||
local fn="/var/log/syslog"
|
local fn="/var/log/syslog"
|
||||||
[ -n "$1" ] && fn="/var/log/$1"
|
[ -n "$1" ] && fn="/var/log/$1"
|
||||||
tail -F "$fn"
|
less +F -r "$fn"
|
||||||
}
|
}
|
||||||
|
|
||||||
_logfile_completions()
|
_logfile_completions()
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
service name:netopeer notify:none log env:/etc/default/confd \
|
||||||
|
[12345] <pid/confd> netopeer2-server -F -t $CONFD_TIMEOUT -v 1 \
|
||||||
|
-- NETCONF server
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
# Use <pid/syslogd> as barrier for other system tasks and service that
|
# Use <pid/syslogd> as barrier for other system tasks and service that
|
||||||
# rely on modules, firmware, and device nodes to be ready.
|
# rely on modules, firmware, and device nodes to be ready.
|
||||||
service if:udevd nowarn env:-/etc/default/sysklogd <run/udevadm:post/success> \
|
service if:udevd nowarn env:-/etc/default/sysklogd <run/udevadm:post/success> \
|
||||||
[S0123456789] syslogd -F $SYSLOGD_ARGS -- System log daemon
|
[S0123456789] syslogd -8 -F $SYSLOGD_ARGS -- System log daemon
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
../available/netconf.conf
|
||||||
@@ -5,10 +5,11 @@
|
|||||||
# -K :: exit immediately when an interrupt character (usually ^C) is typed
|
# -K :: exit immediately when an interrupt character (usually ^C) is typed
|
||||||
# -R :: Almost raw control charachters, only ANSI color escape sequences and
|
# -R :: Almost raw control charachters, only ANSI color escape sequences and
|
||||||
# OSC 8 hyperlink sequences are output. Allows veritcal scrolling
|
# OSC 8 hyperlink sequences are output. Allows veritcal scrolling
|
||||||
|
# -r :: Causes "raw" control characters to be displayed, including unicode.
|
||||||
# -X :: No termcap initialization and deinitialization set to the terminal.
|
# -X :: No termcap initialization and deinitialization set to the terminal.
|
||||||
# This is what leaves the contents of the output on screen.
|
# This is what leaves the contents of the output on screen.
|
||||||
|
|
||||||
export LESS="-P %f (press h for help or q to quit)"
|
export LESS="-P %f (press h for help or q to quit)"
|
||||||
export LANG=en_US.UTF-8
|
export LANG=en_US.UTF-8
|
||||||
|
|
||||||
less -RIKd -FX "$@"
|
less -rIKd -FX "$@"
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ All notable changes to the project are documented in this file.
|
|||||||
- Add neofetch system information tool for system introspection, issue #1143
|
- Add neofetch system information tool for system introspection, issue #1143
|
||||||
- Add mtr and iperf3 network diagnostic tools, issue #1144
|
- Add mtr and iperf3 network diagnostic tools, issue #1144
|
||||||
- Improve default bash settings with better history handling and tab completion
|
- Improve default bash settings with better history handling and tab completion
|
||||||
|
- cli: new `terminal reset` and `terminal resize` convenience commands
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
- Fix #1100: Reduce DHCP client logging verbosity by 70% and include interface
|
- Fix #1100: Reduce DHCP client logging verbosity by 70% and include interface
|
||||||
@@ -24,6 +25,7 @@ All notable changes to the project are documented in this file.
|
|||||||
- Fix #1119: CLI UX regression, restore proper behavior for `no enabled` command
|
- Fix #1119: CLI UX regression, restore proper behavior for `no enabled` command
|
||||||
- Fix #1155: `show ospf` commands regression
|
- Fix #1155: `show ospf` commands regression
|
||||||
- Fix #1150: show-legacy wrapper permissions
|
- Fix #1150: show-legacy wrapper permissions
|
||||||
|
- Fixes for unicode translation in log and pager outputs as well as `syslogd`
|
||||||
|
|
||||||
[BPI-R3]: https://wiki.banana-pi.org/Banana_Pi_BPI-R3
|
[BPI-R3]: https://wiki.banana-pi.org/Banana_Pi_BPI-R3
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,3 @@ run name:failure log:prio:user.crit norestart env:/etc/default/confd \
|
|||||||
run name:error :2 log:console norestart \
|
run name:error :2 log:console norestart \
|
||||||
if:<run/failure/failure> \
|
if:<run/failure/failure> \
|
||||||
[S] /usr/libexec/confd/error --
|
[S] /usr/libexec/confd/error --
|
||||||
|
|
||||||
service name:netopeer notify:none log env:/etc/default/confd \
|
|
||||||
[12345] <pid/confd> netopeer2-server -F -t $CONFD_TIMEOUT -v 1 \
|
|
||||||
-- NETCONF server
|
|
||||||
|
|||||||
@@ -5,3 +5,8 @@ config BR2_PACKAGE_NGHTTP2_ASIO
|
|||||||
select BR2_PACKAGE_BOOST
|
select BR2_PACKAGE_BOOST
|
||||||
help
|
help
|
||||||
C++ bindings for nghttp2
|
C++ bindings for nghttp2
|
||||||
|
|
||||||
|
This is the CESNET fork of nghttp2-asio, introduced here:
|
||||||
|
https://github.com/CESNET/rousette/commit/fff3429
|
||||||
|
|
||||||
|
https://github.com/CESNET/nghttp2-asio
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
# Locally calculated
|
# Locally calculated
|
||||||
sha256 6b94f3abc1aabd0c72a7c7d92a77f79dda7c8a0cb3df839a97890b4116a2de2a COPYING
|
sha256 6b94f3abc1aabd0c72a7c7d92a77f79dda7c8a0cb3df839a97890b4116a2de2a COPYING
|
||||||
sha256 d971c538a31eae5714d2434d90f86794f267615e85e8d2bb0c383e83c300e1ce nghttp2-asio-e877868abe06a83ed0a6ac6e245c07f6f20866b5-git4.tar.gz
|
sha256 883af672c1d210398170749a8ccda30103b2894bcd4eccd80f36771aad0b15c3 nghttp2-asio-2173b82e6caa85950c769eecc5da6809faadf61a-git4.tar.gz
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
#
|
#
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
NGHTTP2_ASIO_VERSION = e877868abe06a83ed0a6ac6e245c07f6f20866b5
|
NGHTTP2_ASIO_VERSION = 2173b82e6caa85950c769eecc5da6809faadf61a
|
||||||
NGHTTP2_ASIO_SITE = https://github.com/kernelkit/nghttp2-asio.git
|
NGHTTP2_ASIO_SITE = https://github.com/CESNET/nghttp2-asio
|
||||||
NGHTTP2_ASIO_SITE_METHOD = git
|
NGHTTP2_ASIO_SITE_METHOD = git
|
||||||
NGHTTP2_ASIO_LICENSE = MIT
|
NGHTTP2_ASIO_LICENSE = MIT
|
||||||
NGHTTP2_ASIO_LICENSE_FILES = COPYING
|
NGHTTP2_ASIO_LICENSE_FILES = COPYING
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
From a4136d889237dadb9253ea7eb668a525dd779e6d Mon Sep 17 00:00:00 2001
|
From c0d13b8e426608a30b1eea382f908fb6447fd01d Mon Sep 17 00:00:00 2001
|
||||||
From: =?UTF-8?q?Jan=20Kundr=C3=A1t?= <jan.kundrat@cesnet.cz>
|
From: =?UTF-8?q?Jan=20Kundr=C3=A1t?= <jan.kundrat@cesnet.cz>
|
||||||
Date: Thu, 12 Jun 2025 10:33:42 +0100
|
Date: Thu, 12 Jun 2025 10:33:42 +0100
|
||||||
Subject: [PATCH 01/17] Log HTTP headers and the input data payload
|
Subject: [PATCH 01/13] Log HTTP headers and the input data payload
|
||||||
MIME-Version: 1.0
|
MIME-Version: 1.0
|
||||||
Content-Type: text/plain; charset=UTF-8
|
Content-Type: text/plain; charset=UTF-8
|
||||||
Content-Transfer-Encoding: 8bit
|
Content-Transfer-Encoding: 8bit
|
||||||
@@ -11,7 +11,7 @@ Organization: Wires
|
|||||||
Hažlinský just found.
|
Hažlinský just found.
|
||||||
|
|
||||||
Change-Id: I2a930a02c7d30c051390fe73e6af9849edd580b4
|
Change-Id: I2a930a02c7d30c051390fe73e6af9849edd580b4
|
||||||
Signed-off-by: Mattias Walström <lazzer@gmail.com>
|
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
||||||
---
|
---
|
||||||
src/restconf/Server.cpp | 10 ++++++++--
|
src/restconf/Server.cpp | 10 ++++++++--
|
||||||
1 file changed, 8 insertions(+), 2 deletions(-)
|
1 file changed, 8 insertions(+), 2 deletions(-)
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
From 6c5b482ea5c9fbc1149a0864b05d1bb1fa7100bf Mon Sep 17 00:00:00 2001
|
From 027a47ac3ff6c369caab7c007a5a171a68270829 Mon Sep 17 00:00:00 2001
|
||||||
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Pecka?= <tomas.pecka@cesnet.cz>
|
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Pecka?= <tomas.pecka@cesnet.cz>
|
||||||
Date: Fri, 13 Jun 2025 10:47:55 +0200
|
Date: Fri, 13 Jun 2025 10:47:55 +0200
|
||||||
Subject: [PATCH 02/17] restconf: prevent throwing exception in
|
Subject: [PATCH 02/13] restconf: prevent throwing exception in
|
||||||
withRestconfExceptions wrapper
|
withRestconfExceptions wrapper
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
Organization: Wires
|
Organization: Wires
|
||||||
|
|
||||||
In case the catch block of withRestconfExceptions is reached and an
|
In case the catch block of withRestconfExceptions is reached and an
|
||||||
@@ -22,7 +19,7 @@ handle such situations.
|
|||||||
|
|
||||||
Bug: https://github.com/CESNET/rousette/issues/19
|
Bug: https://github.com/CESNET/rousette/issues/19
|
||||||
Change-Id: Ifbd74b9bdc0ca66c4e5449a7673ef2f12ae9215e
|
Change-Id: Ifbd74b9bdc0ca66c4e5449a7673ef2f12ae9215e
|
||||||
Signed-off-by: Mattias Walström <lazzer@gmail.com>
|
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
||||||
---
|
---
|
||||||
src/restconf/Server.cpp | 2 +-
|
src/restconf/Server.cpp | 2 +-
|
||||||
tests/restconf-plain-patch.cpp | 24 ++++++++++++++++++++++++
|
tests/restconf-plain-patch.cpp | 24 ++++++++++++++++++++++++
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
From 41c9d9cab47a88ee6c70ab8009b789226c0982fe Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Jan=20Kundr=C3=A1t?= <jan.kundrat@cesnet.cz>
|
|
||||||
Date: Tue, 17 Jun 2025 12:46:27 +0200
|
|
||||||
Subject: [PATCH 03/17] CI: switch to the new cloud's Swift URL
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
Organization: Wires
|
|
||||||
|
|
||||||
Change-Id: I69f8351394262a2a9b691422592741bfb40a8e38
|
|
||||||
Signed-off-by: Mattias Walström <lazzer@gmail.com>
|
|
||||||
---
|
|
||||||
ci/build.sh | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/ci/build.sh b/ci/build.sh
|
|
||||||
index d49bd56..59b31ab 100755
|
|
||||||
--- a/ci/build.sh
|
|
||||||
+++ b/ci/build.sh
|
|
||||||
@@ -67,7 +67,7 @@ if [[ -z "${ARTIFACT_URL}" ]]; then
|
|
||||||
# nothing ahead in the pipeline -> fallback to the latest promoted artifact
|
|
||||||
DEPSRCDIR=$(jq < ~/zuul-env.json -e -r ".projects[] | select(.name == \"CzechLight/dependencies\").src_dir")
|
|
||||||
DEP_SUBMODULE_COMMIT=$(git --git-dir ${HOME}/${DEPSRCDIR}/.git rev-parse HEAD)
|
|
||||||
- ARTIFACT_URL="https://object-store.cloud.muni.cz/swift/v1/ci-artifacts-${ZUUL_TENANT}/${ZUUL_GERRIT_HOSTNAME}/CzechLight/dependencies/deps-${ZUUL_JOB_NAME_NO_PROJECT%%-cover?(-previous)}/${DEP_SUBMODULE_COMMIT}.tar.zst"
|
|
||||||
+ ARTIFACT_URL="https://object-store.brno.openstack.cloud.e-infra.cz/swift/v1/KEY_b637b9c937414b29b3e277b4a85cc658/ci-artifacts-${ZUUL_TENANT}/${ZUUL_GERRIT_HOSTNAME}/CzechLight/dependencies/deps-${ZUUL_JOB_NAME_NO_PROJECT%%-cover?(-previous)}/${DEP_SUBMODULE_COMMIT}.tar.zst"
|
|
||||||
fi
|
|
||||||
|
|
||||||
curl ${ARTIFACT_URL} | unzstd --stdout | tar -C ${PREFIX} -xf -
|
|
||||||
--
|
|
||||||
2.43.0
|
|
||||||
|
|
||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
From ec8673126929b6459fcd99c84a79993a725b40e1 Mon Sep 17 00:00:00 2001
|
From d1c56f14b54b113df8fba759924bb47cfa27366c Mon Sep 17 00:00:00 2001
|
||||||
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Pecka?= <tomas.pecka@cesnet.cz>
|
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Pecka?= <tomas.pecka@cesnet.cz>
|
||||||
Date: Fri, 13 Jun 2025 10:47:55 +0200
|
Date: Fri, 13 Jun 2025 10:47:55 +0200
|
||||||
Subject: [PATCH 04/17] restconf: crash instead of a deadlock when the handler
|
Subject: [PATCH 03/13] restconf: crash instead of a deadlock when the handler
|
||||||
throws
|
throws
|
||||||
MIME-Version: 1.0
|
MIME-Version: 1.0
|
||||||
Content-Type: text/plain; charset=UTF-8
|
Content-Type: text/plain; charset=UTF-8
|
||||||
@@ -37,7 +37,7 @@ called twice [3].
|
|||||||
Signed-off-by: Jan Kundrát <jan.kundrat@cesnet.cz>
|
Signed-off-by: Jan Kundrát <jan.kundrat@cesnet.cz>
|
||||||
Bug: https://github.com/CESNET/rousette/issues/19
|
Bug: https://github.com/CESNET/rousette/issues/19
|
||||||
Change-Id: I2c090b9a76b062101ba422a7d50e8e699779e203
|
Change-Id: I2c090b9a76b062101ba422a7d50e8e699779e203
|
||||||
Signed-off-by: Mattias Walström <lazzer@gmail.com>
|
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
||||||
---
|
---
|
||||||
src/restconf/Server.cpp | 28 ++++++++++++++++++++++++++++
|
src/restconf/Server.cpp | 28 ++++++++++++++++++++++++++++
|
||||||
src/restconf/Server.h | 4 ++++
|
src/restconf/Server.h | 4 ++++
|
||||||
+3
-6
@@ -1,10 +1,7 @@
|
|||||||
From 4eae6200aa812950ebbac1660a1899f4edf41e11 Mon Sep 17 00:00:00 2001
|
From db64d7b3fc0a0373067e6c5ac9e41b93351778a1 Mon Sep 17 00:00:00 2001
|
||||||
From: =?UTF-8?q?Jan=20Kundr=C3=A1t?= <jan.kundrat@cesnet.cz>
|
From: =?UTF-8?q?Jan=20Kundr=C3=A1t?= <jan.kundrat@cesnet.cz>
|
||||||
Date: Wed, 7 Aug 2024 19:07:35 +0200
|
Date: Wed, 7 Aug 2024 19:07:35 +0200
|
||||||
Subject: [PATCH 06/17] close long-lived connections on SIGTERM
|
Subject: [PATCH 04/13] close long-lived connections on SIGTERM
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
Organization: Wires
|
Organization: Wires
|
||||||
|
|
||||||
Without this patch, all the ongoing SSE streams would be left alive for
|
Without this patch, all the ongoing SSE streams would be left alive for
|
||||||
@@ -23,7 +20,7 @@ hope it is).
|
|||||||
|
|
||||||
Change-Id: If442134783ba1d699de47c51a9068378f53e8339
|
Change-Id: If442134783ba1d699de47c51a9068378f53e8339
|
||||||
Co-authored-by: Tomas Pecka <tomas.pecka@cesnet.cz>
|
Co-authored-by: Tomas Pecka <tomas.pecka@cesnet.cz>
|
||||||
Signed-off-by: Mattias Walström <lazzer@gmail.com>
|
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
||||||
---
|
---
|
||||||
CMakeLists.txt | 1 +
|
CMakeLists.txt | 1 +
|
||||||
src/clock.cpp | 7 +--
|
src/clock.cpp | 7 +--
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
From 37ca95c387d76c3f296a4e44b211772a1ca155ab Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Jan=20Kundr=C3=A1t?= <jan.kundrat@cesnet.cz>
|
|
||||||
Date: Wed, 18 Jun 2025 12:01:04 +0200
|
|
||||||
Subject: [PATCH 05/17] doc: let's stop calling this "an almost-RESTCONF
|
|
||||||
server"
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
Organization: Wires
|
|
||||||
|
|
||||||
Change-Id: If55ace481c78d838a811ded76a564f8fb59f9233
|
|
||||||
Signed-off-by: Mattias Walström <lazzer@gmail.com>
|
|
||||||
---
|
|
||||||
README.md | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/README.md b/README.md
|
|
||||||
index 0796dce..a42c64d 100644
|
|
||||||
--- a/README.md
|
|
||||||
+++ b/README.md
|
|
||||||
@@ -1,4 +1,4 @@
|
|
||||||
-# An almost-RESTCONF server
|
|
||||||
+# A RESTCONF server for sysrepo
|
|
||||||
|
|
||||||

|
|
||||||
[](https://gerrit.cesnet.cz/q/project:CzechLight/rousette)
|
|
||||||
--
|
|
||||||
2.43.0
|
|
||||||
|
|
||||||
+3
-6
@@ -1,10 +1,7 @@
|
|||||||
From ca2894d4888c673d227fc196a25f83ded20e8f04 Mon Sep 17 00:00:00 2001
|
From 5c8a139d04d9b3dfb28b8c0e1a4aa7b945a1e8fc Mon Sep 17 00:00:00 2001
|
||||||
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Pecka?= <tomas.pecka@cesnet.cz>
|
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Pecka?= <tomas.pecka@cesnet.cz>
|
||||||
Date: Mon, 30 Jun 2025 15:38:02 +0200
|
Date: Mon, 30 Jun 2025 15:38:02 +0200
|
||||||
Subject: [PATCH 07/17] restconf: refactor server stop
|
Subject: [PATCH 05/13] restconf: refactor server stop
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
Organization: Wires
|
Organization: Wires
|
||||||
|
|
||||||
In 94b24795 ("server: simplify listening/stopping") we needed to call
|
In 94b24795 ("server: simplify listening/stopping") we needed to call
|
||||||
@@ -20,7 +17,7 @@ does not seem like it should be called from *every* io_service.)
|
|||||||
[2] https://www.boost.org/doc/libs/1_85_0/doc/html/boost_asio/reference/post.html
|
[2] https://www.boost.org/doc/libs/1_85_0/doc/html/boost_asio/reference/post.html
|
||||||
|
|
||||||
Change-Id: I2f33c38a78dce4081a03326c9a9bb25817fc9d2f
|
Change-Id: I2f33c38a78dce4081a03326c9a9bb25817fc9d2f
|
||||||
Signed-off-by: Mattias Walström <lazzer@gmail.com>
|
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
||||||
---
|
---
|
||||||
src/restconf/Server.cpp | 13 +++++--------
|
src/restconf/Server.cpp | 13 +++++--------
|
||||||
1 file changed, 5 insertions(+), 8 deletions(-)
|
1 file changed, 5 insertions(+), 8 deletions(-)
|
||||||
+3
-6
@@ -1,10 +1,7 @@
|
|||||||
From 5becffe8a1dd47c8836ce1800a1b72acdf86021f Mon Sep 17 00:00:00 2001
|
From 086cfe1847e406df90852dc3cb52ece3d0cbe22b Mon Sep 17 00:00:00 2001
|
||||||
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Pecka?= <tomas.pecka@cesnet.cz>
|
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Pecka?= <tomas.pecka@cesnet.cz>
|
||||||
Date: Mon, 12 May 2025 14:56:54 +0200
|
Date: Mon, 12 May 2025 14:56:54 +0200
|
||||||
Subject: [PATCH 10/17] http: send keep-alive pings from EventStream
|
Subject: [PATCH 06/13] http: send keep-alive pings from EventStream
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
Organization: Wires
|
Organization: Wires
|
||||||
|
|
||||||
The nghttp2-asio server disconnects client after 60 seconds of no
|
The nghttp2-asio server disconnects client after 60 seconds of no
|
||||||
@@ -31,7 +28,7 @@ to the server when the server sends these "keep-alive comments".
|
|||||||
[3] https://html.spec.whatwg.org/multipage/server-sent-events.html#authoring-notes
|
[3] https://html.spec.whatwg.org/multipage/server-sent-events.html#authoring-notes
|
||||||
|
|
||||||
Change-Id: I57e510d0b61ac7ed032c582779780c64768b7d53
|
Change-Id: I57e510d0b61ac7ed032c582779780c64768b7d53
|
||||||
Signed-off-by: Mattias Walström <lazzer@gmail.com>
|
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
||||||
---
|
---
|
||||||
src/clock.cpp | 4 +-
|
src/clock.cpp | 4 +-
|
||||||
src/http/EventStream.cpp | 44 +++++++++++++--
|
src/http/EventStream.cpp | 44 +++++++++++++--
|
||||||
+3
-6
@@ -1,10 +1,7 @@
|
|||||||
From ff4ff1c193083feca76d9f0f4485e4b175c373c2 Mon Sep 17 00:00:00 2001
|
From 06e2751e4da052195db96aaa90549fba398208bd Mon Sep 17 00:00:00 2001
|
||||||
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Pecka?= <tomas.pecka@cesnet.cz>
|
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Pecka?= <tomas.pecka@cesnet.cz>
|
||||||
Date: Wed, 23 Jul 2025 14:27:26 +0200
|
Date: Wed, 23 Jul 2025 14:27:26 +0200
|
||||||
Subject: [PATCH 11/17] refactor: event streams use named constructors
|
Subject: [PATCH 07/13] refactor: event streams use named constructors
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
Organization: Wires
|
Organization: Wires
|
||||||
|
|
||||||
This commit refactors the EventStream and NotificationStream to use
|
This commit refactors the EventStream and NotificationStream to use
|
||||||
@@ -17,7 +14,7 @@ named constructors which perform the double initialization themselves.
|
|||||||
This way, the code is more readable and the intention should be clearer.
|
This way, the code is more readable and the intention should be clearer.
|
||||||
|
|
||||||
Change-Id: Iac96c49c20670dfe924d7c8db33328ed9c2fc9dd
|
Change-Id: Iac96c49c20670dfe924d7c8db33328ed9c2fc9dd
|
||||||
Signed-off-by: Mattias Walström <lazzer@gmail.com>
|
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
||||||
---
|
---
|
||||||
src/clock.cpp | 3 +--
|
src/clock.cpp | 3 +--
|
||||||
src/http/EventStream.cpp | 20 ++++++++++++++++++++
|
src/http/EventStream.cpp | 20 ++++++++++++++++++++
|
||||||
+3
-6
@@ -1,16 +1,13 @@
|
|||||||
From f4602a03adc9134a9b7a9d338e900b40557da6c4 Mon Sep 17 00:00:00 2001
|
From e98e079d0fdedf48facbfcf187950946c1ffed7a Mon Sep 17 00:00:00 2001
|
||||||
From: =?UTF-8?q?Jan=20Kundr=C3=A1t?= <jan.kundrat@cesnet.cz>
|
From: =?UTF-8?q?Jan=20Kundr=C3=A1t?= <jan.kundrat@cesnet.cz>
|
||||||
Date: Thu, 7 Aug 2025 12:14:02 +0200
|
Date: Thu, 7 Aug 2025 12:14:02 +0200
|
||||||
Subject: [PATCH 12/17] refactor: a better convention for weak_from_this->lock
|
Subject: [PATCH 08/13] refactor: a better convention for weak_from_this->lock
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
Organization: Wires
|
Organization: Wires
|
||||||
|
|
||||||
It is not a "client", so let's stop calling it a "client". My bad.
|
It is not a "client", so let's stop calling it a "client". My bad.
|
||||||
|
|
||||||
Change-Id: Id8dc4d92c3ade8d86697366d0102e84bd466f504
|
Change-Id: Id8dc4d92c3ade8d86697366d0102e84bd466f504
|
||||||
Signed-off-by: Mattias Walström <lazzer@gmail.com>
|
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
||||||
---
|
---
|
||||||
src/http/EventStream.cpp | 44 ++++++++++++++++++++--------------------
|
src/http/EventStream.cpp | 44 ++++++++++++++++++++--------------------
|
||||||
1 file changed, 22 insertions(+), 22 deletions(-)
|
1 file changed, 22 insertions(+), 22 deletions(-)
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
From 9961430bacdd8dbac64a01b2a2ffb6a4b7e806b6 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Pecka?= <tomas.pecka@cesnet.cz>
|
|
||||||
Date: Tue, 13 May 2025 13:48:35 +0200
|
|
||||||
Subject: [PATCH 08/17] tests: use std::string::starts_with
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
Organization: Wires
|
|
||||||
|
|
||||||
We are C++20, so we can use line, which is more readable.
|
|
||||||
|
|
||||||
Change-Id: I40d4038b421f6bc1fcf320f609b50d5ce7018a45
|
|
||||||
Signed-off-by: Mattias Walström <lazzer@gmail.com>
|
|
||||||
---
|
|
||||||
tests/restconf_utils.cpp | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/tests/restconf_utils.cpp b/tests/restconf_utils.cpp
|
|
||||||
index cbfce2c..08b9623 100644
|
|
||||||
--- a/tests/restconf_utils.cpp
|
|
||||||
+++ b/tests/restconf_utils.cpp
|
|
||||||
@@ -228,7 +228,7 @@ std::vector<std::string> SSEClient::parseEvents(const std::string& msg)
|
|
||||||
std::string event;
|
|
||||||
|
|
||||||
while (std::getline(iss, line)) {
|
|
||||||
- if (line.compare(0, prefix.size(), prefix) == 0) {
|
|
||||||
+ if (line.starts_with(prefix)) {
|
|
||||||
event += line.substr(prefix.size());
|
|
||||||
} else if (line.empty()) {
|
|
||||||
res.emplace_back(std::move(event));
|
|
||||||
--
|
|
||||||
2.43.0
|
|
||||||
|
|
||||||
+3
-6
@@ -1,15 +1,12 @@
|
|||||||
From 4e9b535a59861f25c0602eaa1fc39126d7cd9899 Mon Sep 17 00:00:00 2001
|
From de7c55a1e8d3dda20ee3dc408612f2ddb309e888 Mon Sep 17 00:00:00 2001
|
||||||
From: =?UTF-8?q?Jan=20Kundr=C3=A1t?= <jan.kundrat@cesnet.cz>
|
From: =?UTF-8?q?Jan=20Kundr=C3=A1t?= <jan.kundrat@cesnet.cz>
|
||||||
Date: Thu, 7 Aug 2025 12:21:54 +0200
|
Date: Thu, 7 Aug 2025 12:21:54 +0200
|
||||||
Subject: [PATCH 13/17] fix a possible bad_weak_ptr exception
|
Subject: [PATCH 09/13] fix a possible bad_weak_ptr exception
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
Organization: Wires
|
Organization: Wires
|
||||||
|
|
||||||
Change-Id: I8c7f7a943a1d848f15527988cb76c2a0a10089e6
|
Change-Id: I8c7f7a943a1d848f15527988cb76c2a0a10089e6
|
||||||
Fixes: 4eae6200 (close long-lived connections on SIGTERM)
|
Fixes: 4eae6200 (close long-lived connections on SIGTERM)
|
||||||
Signed-off-by: Mattias Walström <lazzer@gmail.com>
|
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
||||||
---
|
---
|
||||||
src/http/EventStream.cpp | 2 +-
|
src/http/EventStream.cpp | 2 +-
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
@@ -1,172 +0,0 @@
|
|||||||
From 746c0cdfef6808f393be7946630b8acbb0636706 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Pecka?= <tomas.pecka@cesnet.cz>
|
|
||||||
Date: Tue, 22 Jul 2025 17:47:50 +0200
|
|
||||||
Subject: [PATCH 09/17] tests: add SSE event watcher for comments
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
Organization: Wires
|
|
||||||
|
|
||||||
I want to test whether client receives even the Server Sent Events
|
|
||||||
which should be ignored, i.e., lines starting with colon.
|
|
||||||
|
|
||||||
Change-Id: If54f0af05b4884aab01325f12fd0a6859791b41b
|
|
||||||
Signed-off-by: Mattias Walström <lazzer@gmail.com>
|
|
||||||
---
|
|
||||||
tests/event_watchers.cpp | 7 ++++++-
|
|
||||||
tests/event_watchers.h | 4 +++-
|
|
||||||
tests/restconf_utils.cpp | 36 ++++++++++++++++++++----------------
|
|
||||||
tests/restconf_utils.h | 12 +++++++++---
|
|
||||||
4 files changed, 38 insertions(+), 21 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/tests/event_watchers.cpp b/tests/event_watchers.cpp
|
|
||||||
index 690338e..26ba951 100644
|
|
||||||
--- a/tests/event_watchers.cpp
|
|
||||||
+++ b/tests/event_watchers.cpp
|
|
||||||
@@ -64,7 +64,7 @@ void RestconfNotificationWatcher::setDataFormat(const libyang::DataFormat dataFo
|
|
||||||
this->dataFormat = dataFormat;
|
|
||||||
}
|
|
||||||
|
|
||||||
-void RestconfNotificationWatcher::operator()(const std::string& msg) const
|
|
||||||
+void RestconfNotificationWatcher::dataEvent(const std::string& msg) const
|
|
||||||
{
|
|
||||||
spdlog::trace("Client received data: {}", msg);
|
|
||||||
auto notifDataNode = ctx.parseOp(msg,
|
|
||||||
@@ -79,3 +79,8 @@ void RestconfNotificationWatcher::operator()(const std::string& msg) const
|
|
||||||
|
|
||||||
data(*dataRoot->printStr(libyang::DataFormat::JSON, libyang::PrintFlags::Shrink));
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+void RestconfNotificationWatcher::commentEvent(const std::string& msg) const
|
|
||||||
+{
|
|
||||||
+ comment(msg);
|
|
||||||
+}
|
|
||||||
diff --git a/tests/event_watchers.h b/tests/event_watchers.h
|
|
||||||
index 3b533ba..7022b64 100644
|
|
||||||
--- a/tests/event_watchers.h
|
|
||||||
+++ b/tests/event_watchers.h
|
|
||||||
@@ -39,8 +39,10 @@ struct RestconfNotificationWatcher {
|
|
||||||
|
|
||||||
RestconfNotificationWatcher(const libyang::Context& ctx);
|
|
||||||
void setDataFormat(const libyang::DataFormat dataFormat);
|
|
||||||
- void operator()(const std::string& msg) const;
|
|
||||||
+ void dataEvent(const std::string& msg) const;
|
|
||||||
+ void commentEvent(const std::string& msg) const;
|
|
||||||
|
|
||||||
+ MAKE_CONST_MOCK1(comment, void(const std::string&));
|
|
||||||
MAKE_CONST_MOCK1(data, void(const std::string&));
|
|
||||||
};
|
|
||||||
|
|
||||||
diff --git a/tests/restconf_utils.cpp b/tests/restconf_utils.cpp
|
|
||||||
index 08b9623..5b1ebe3 100644
|
|
||||||
--- a/tests/restconf_utils.cpp
|
|
||||||
+++ b/tests/restconf_utils.cpp
|
|
||||||
@@ -169,10 +169,11 @@ SSEClient::SSEClient(
|
|
||||||
const std::string& server_address,
|
|
||||||
const std::string& server_port,
|
|
||||||
std::binary_semaphore& requestSent,
|
|
||||||
- const RestconfNotificationWatcher& notification,
|
|
||||||
+ const RestconfNotificationWatcher& eventWatcher,
|
|
||||||
const std::string& uri,
|
|
||||||
const std::map<std::string, std::string>& headers,
|
|
||||||
- const boost::posix_time::seconds silenceTimeout)
|
|
||||||
+ const boost::posix_time::seconds silenceTimeout,
|
|
||||||
+ const ReportIgnoredLines reportIgnoredLines)
|
|
||||||
: client(std::make_shared<ng_client::session>(io, server_address, server_port))
|
|
||||||
, t(io, silenceTimeout)
|
|
||||||
{
|
|
||||||
@@ -191,17 +192,15 @@ SSEClient::SSEClient(
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
- client->on_connect([&, uri, reqHeaders, silenceTimeout, server_address, server_port](auto) {
|
|
||||||
+ client->on_connect([&, uri, reqHeaders, silenceTimeout, server_address, server_port, reportIgnoredLines](auto) {
|
|
||||||
boost::system::error_code ec;
|
|
||||||
|
|
||||||
auto req = client->submit(ec, "GET", serverAddressAndPort(server_address, server_port) + uri, "", reqHeaders);
|
|
||||||
- req->on_response([&, silenceTimeout](const ng_client::response& res) {
|
|
||||||
+ req->on_response([&, silenceTimeout, reportIgnoredLines](const ng_client::response& res) {
|
|
||||||
requestSent.release();
|
|
||||||
- res.on_data([&, silenceTimeout](const uint8_t* data, std::size_t len) {
|
|
||||||
+ res.on_data([&, silenceTimeout, reportIgnoredLines](const uint8_t* data, std::size_t len) {
|
|
||||||
// not a production-ready code. In real-life condition the data received in one callback might probably be incomplete
|
|
||||||
- for (const auto& event : parseEvents(std::string(reinterpret_cast<const char*>(data), len))) {
|
|
||||||
- notification(event);
|
|
||||||
- }
|
|
||||||
+ parseEvents(std::string(reinterpret_cast<const char*>(data), len), eventWatcher, reportIgnoredLines);
|
|
||||||
t.expires_from_now(silenceTimeout);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -218,25 +217,30 @@ SSEClient::SSEClient(
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
-std::vector<std::string> SSEClient::parseEvents(const std::string& msg)
|
|
||||||
+void SSEClient::parseEvents(const std::string& msg, const RestconfNotificationWatcher& eventWatcher, const ReportIgnoredLines reportIgnoredLines)
|
|
||||||
{
|
|
||||||
- static const std::string prefix = "data:";
|
|
||||||
+ static const std::string dataPrefix = "data:";
|
|
||||||
+ static const std::string ignorePrefix = ":";
|
|
||||||
|
|
||||||
- std::vector<std::string> res;
|
|
||||||
std::istringstream iss(msg);
|
|
||||||
std::string line;
|
|
||||||
std::string event;
|
|
||||||
|
|
||||||
while (std::getline(iss, line)) {
|
|
||||||
- if (line.starts_with(prefix)) {
|
|
||||||
- event += line.substr(prefix.size());
|
|
||||||
- } else if (line.empty()) {
|
|
||||||
- res.emplace_back(std::move(event));
|
|
||||||
+ if (line.starts_with(ignorePrefix) && reportIgnoredLines == ReportIgnoredLines::Yes) {
|
|
||||||
+ eventWatcher.commentEvent(line);
|
|
||||||
+ } else if (line.starts_with(ignorePrefix)) {
|
|
||||||
+ continue;
|
|
||||||
+ } else if (line.starts_with(dataPrefix)) {
|
|
||||||
+ event += line.substr(dataPrefix.size());
|
|
||||||
+ } else if (line.empty() && !event.empty()) {
|
|
||||||
+ eventWatcher.dataEvent(event);
|
|
||||||
event.clear();
|
|
||||||
+ } else if (line.empty()) {
|
|
||||||
+ continue;
|
|
||||||
} else {
|
|
||||||
CAPTURE(msg);
|
|
||||||
FAIL("Unprefixed response");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
- return res;
|
|
||||||
}
|
|
||||||
diff --git a/tests/restconf_utils.h b/tests/restconf_utils.h
|
|
||||||
index 9efe398..9dde10b 100644
|
|
||||||
--- a/tests/restconf_utils.h
|
|
||||||
+++ b/tests/restconf_utils.h
|
|
||||||
@@ -88,17 +88,23 @@ struct SSEClient {
|
|
||||||
std::shared_ptr<ng_client::session> client;
|
|
||||||
boost::asio::deadline_timer t;
|
|
||||||
|
|
||||||
+ enum class ReportIgnoredLines {
|
|
||||||
+ No,
|
|
||||||
+ Yes,
|
|
||||||
+ };
|
|
||||||
+
|
|
||||||
SSEClient(
|
|
||||||
boost::asio::io_service& io,
|
|
||||||
const std::string& server_address,
|
|
||||||
const std::string& server_port,
|
|
||||||
std::binary_semaphore& requestSent,
|
|
||||||
- const RestconfNotificationWatcher& notification,
|
|
||||||
+ const RestconfNotificationWatcher& eventWatcher,
|
|
||||||
const std::string& uri,
|
|
||||||
const std::map<std::string, std::string>& headers,
|
|
||||||
- const boost::posix_time::seconds silenceTimeout = boost::posix_time::seconds(1)); // test code; the server should respond "soon"
|
|
||||||
+ const boost::posix_time::seconds silenceTimeout = boost::posix_time::seconds(1), // test code; the server should respond "soon"
|
|
||||||
+ const ReportIgnoredLines reportIgnoredLines = ReportIgnoredLines::No);
|
|
||||||
|
|
||||||
- static std::vector<std::string> parseEvents(const std::string& msg);
|
|
||||||
+ static void parseEvents(const std::string& msg, const RestconfNotificationWatcher& eventWatcher, const ReportIgnoredLines reportIgnoredLines);
|
|
||||||
};
|
|
||||||
|
|
||||||
#define PREPARE_LOOP_WITH_EXCEPTIONS \
|
|
||||||
--
|
|
||||||
2.43.0
|
|
||||||
|
|
||||||
+3
-6
@@ -1,10 +1,7 @@
|
|||||||
From 6bca750f866b5b14c4d9c3da68e5c8f1e4eee36c Mon Sep 17 00:00:00 2001
|
From 0f034d6da3e6d0a91bbe09717cb33aaf3a3ed747 Mon Sep 17 00:00:00 2001
|
||||||
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Pecka?= <tomas.pecka@cesnet.cz>
|
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Pecka?= <tomas.pecka@cesnet.cz>
|
||||||
Date: Mon, 19 May 2025 12:11:09 +0200
|
Date: Mon, 19 May 2025 12:11:09 +0200
|
||||||
Subject: [PATCH 14/17] http: add optional callbacks to EventStream
|
Subject: [PATCH 10/13] http: add optional callbacks to EventStream
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
Organization: Wires
|
Organization: Wires
|
||||||
|
|
||||||
In some cases, it might be useful to have a callback that is called when
|
In some cases, it might be useful to have a callback that is called when
|
||||||
@@ -14,7 +11,7 @@ implementation where we would like to clean up stuff after client
|
|||||||
disconnects.
|
disconnects.
|
||||||
|
|
||||||
Change-Id: Icfc2959e38b812b7c18f45976415209b29151c7b
|
Change-Id: Icfc2959e38b812b7c18f45976415209b29151c7b
|
||||||
Signed-off-by: Mattias Walström <lazzer@gmail.com>
|
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
||||||
---
|
---
|
||||||
src/http/EventStream.cpp | 18 +++++++++++++++---
|
src/http/EventStream.cpp | 18 +++++++++++++++---
|
||||||
src/http/EventStream.h | 10 ++++++++--
|
src/http/EventStream.h | 10 ++++++++--
|
||||||
+3
-6
@@ -1,10 +1,7 @@
|
|||||||
From f6ee629de8abef42a24c42b185052b0c8e78bd6b Mon Sep 17 00:00:00 2001
|
From d72adb3da31cb509e64c8f33174e375fa9468b0b Mon Sep 17 00:00:00 2001
|
||||||
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Pecka?= <tomas.pecka@cesnet.cz>
|
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Pecka?= <tomas.pecka@cesnet.cz>
|
||||||
Date: Mon, 19 May 2025 12:23:16 +0200
|
Date: Mon, 19 May 2025 12:23:16 +0200
|
||||||
Subject: [PATCH 15/17] restconf: add internal RPC handler dispatcher
|
Subject: [PATCH 11/13] restconf: add internal RPC handler dispatcher
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
Organization: Wires
|
Organization: Wires
|
||||||
|
|
||||||
This code adds a new internal RPC handler dispatcher that checks if user
|
This code adds a new internal RPC handler dispatcher that checks if user
|
||||||
@@ -14,7 +11,7 @@ So far, there are no RPCs processed, but support for the
|
|||||||
ietf-subscribed-notifications:establish-subscription RPC is coming soon.
|
ietf-subscribed-notifications:establish-subscription RPC is coming soon.
|
||||||
|
|
||||||
Change-Id: I99121a511011229e4098f95e91601b39d333444a
|
Change-Id: I99121a511011229e4098f95e91601b39d333444a
|
||||||
Signed-off-by: Mattias Walström <lazzer@gmail.com>
|
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
||||||
---
|
---
|
||||||
src/restconf/Server.cpp | 24 ++++++++++++++++++++----
|
src/restconf/Server.cpp | 24 ++++++++++++++++++++----
|
||||||
tests/restconf-rpc.cpp | 18 ++++++++++++++++++
|
tests/restconf-rpc.cpp | 18 ++++++++++++++++++
|
||||||
+3
-6
@@ -1,10 +1,7 @@
|
|||||||
From 1067e05674633b97d64b428686aff44822230c5f Mon Sep 17 00:00:00 2001
|
From 86ea8a1fdc2cb8baa1edbd32bd4f8b45acdef816 Mon Sep 17 00:00:00 2001
|
||||||
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Pecka?= <tomas.pecka@cesnet.cz>
|
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Pecka?= <tomas.pecka@cesnet.cz>
|
||||||
Date: Mon, 8 Sep 2025 20:24:15 +0200
|
Date: Mon, 8 Sep 2025 20:24:15 +0200
|
||||||
Subject: [PATCH 17/17] EventStream: fix possible heap-use-after-free
|
Subject: [PATCH 12/13] EventStream: fix possible heap-use-after-free
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
Organization: Wires
|
Organization: Wires
|
||||||
|
|
||||||
I have started getting heap-use-after-free errors from sanitizers (see
|
I have started getting heap-use-after-free errors from sanitizers (see
|
||||||
@@ -64,7 +61,7 @@ before actually resuming the response.
|
|||||||
(...)
|
(...)
|
||||||
|
|
||||||
Change-Id: Ifdb1f8610cacffca3bb49da17aa9b1d267cdd472
|
Change-Id: Ifdb1f8610cacffca3bb49da17aa9b1d267cdd472
|
||||||
Signed-off-by: Mattias Walström <lazzer@gmail.com>
|
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
||||||
---
|
---
|
||||||
src/http/EventStream.cpp | 17 ++++++++++++++++-
|
src/http/EventStream.cpp | 17 ++++++++++++++++-
|
||||||
1 file changed, 16 insertions(+), 1 deletion(-)
|
1 file changed, 16 insertions(+), 1 deletion(-)
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
From ba43271df7cc83806a08d6937719544786fd331d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Joachim Wiberg <troglobit@gmail.com>
|
||||||
|
Date: Sun, 28 Sep 2025 06:04:12 +0200
|
||||||
|
Subject: [PATCH 13/13] Add '--log-level LEVEL' command line option
|
||||||
|
Organization: Wires
|
||||||
|
|
||||||
|
The default 'trace' log level is quite verbose for production systems.
|
||||||
|
This commit changes the default to 'info' and adds a command line option
|
||||||
|
to control the log level.
|
||||||
|
|
||||||
|
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
||||||
|
---
|
||||||
|
src/restconf/main.cpp | 27 +++++++++++++++++++++++++--
|
||||||
|
1 file changed, 25 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/restconf/main.cpp b/src/restconf/main.cpp
|
||||||
|
index 477e846..f253421 100644
|
||||||
|
--- a/src/restconf/main.cpp
|
||||||
|
+++ b/src/restconf/main.cpp
|
||||||
|
@@ -26,11 +26,12 @@
|
||||||
|
static const char usage[] =
|
||||||
|
R"(Rousette - RESTCONF server
|
||||||
|
Usage:
|
||||||
|
- rousette [--syslog] [--timeout <SECONDS>] [--help]
|
||||||
|
+ rousette [--syslog] [--timeout <SECONDS>] [--log-level <LEVEL>] [--help]
|
||||||
|
Options:
|
||||||
|
-h --help Show this screen.
|
||||||
|
-t --timeout <SECONDS> Change default timeout in sysrepo (if not set, use sysrepo internal).
|
||||||
|
--syslog Log to syslog.
|
||||||
|
+ --log-level <LEVEL> Set log level (trace, debug, info, warn, error, critical, off) [default: info].
|
||||||
|
)";
|
||||||
|
#ifdef HAVE_SYSTEMD
|
||||||
|
|
||||||
|
@@ -75,10 +76,32 @@ int main(int argc, char* argv [])
|
||||||
|
{
|
||||||
|
auto args = docopt::docopt(usage, {argv + 1, argv + argc}, true,""/* version */, true);
|
||||||
|
auto timeout = std::chrono::milliseconds{0};
|
||||||
|
+ auto logLevel = spdlog::level::info;
|
||||||
|
|
||||||
|
if (args["--timeout"]) {
|
||||||
|
timeout = std::chrono::milliseconds{args["--timeout"].asLong() * 1000};
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ if (args["--log-level"]) {
|
||||||
|
+ auto levelStr = args["--log-level"].asString();
|
||||||
|
+ if (levelStr == "trace") {
|
||||||
|
+ logLevel = spdlog::level::trace;
|
||||||
|
+ } else if (levelStr == "debug") {
|
||||||
|
+ logLevel = spdlog::level::debug;
|
||||||
|
+ } else if (levelStr == "info") {
|
||||||
|
+ logLevel = spdlog::level::info;
|
||||||
|
+ } else if (levelStr == "warn" || levelStr == "warning") {
|
||||||
|
+ logLevel = spdlog::level::warn;
|
||||||
|
+ } else if (levelStr == "error" || levelStr == "err") {
|
||||||
|
+ logLevel = spdlog::level::err;
|
||||||
|
+ } else if (levelStr == "critical") {
|
||||||
|
+ logLevel = spdlog::level::critical;
|
||||||
|
+ } else if (levelStr == "off") {
|
||||||
|
+ logLevel = spdlog::level::off;
|
||||||
|
+ } else {
|
||||||
|
+ throw std::runtime_error("Invalid log level: " + levelStr + ". Valid levels: trace, debug, info, warn, error, critical, off");
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
if (args["--syslog"].asBool()) {
|
||||||
|
auto syslog_sink = std::make_shared<spdlog::sinks::syslog_sink_mt>("rousette", LOG_PID, LOG_USER, true);
|
||||||
|
auto logger = std::make_shared<spdlog::logger>("rousette", syslog_sink);
|
||||||
|
@@ -94,7 +117,7 @@ int main(int argc, char* argv [])
|
||||||
|
auto logger = std::make_shared<spdlog::logger>("rousette", stdout_sink);
|
||||||
|
spdlog::set_default_logger(logger);
|
||||||
|
}
|
||||||
|
- spdlog::set_level(spdlog::level::trace);
|
||||||
|
+ spdlog::set_level(logLevel);
|
||||||
|
|
||||||
|
/* We will parse URIs using boost::spirit's alnum/alpha/... matchers which are locale-dependent.
|
||||||
|
* Let's use something stable no matter what the system is using
|
||||||
|
--
|
||||||
|
2.43.0
|
||||||
|
|
||||||
@@ -1,120 +0,0 @@
|
|||||||
From b7966613b43b01402c9f0af286a0b3237161779d Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Pecka?= <tomas.pecka@cesnet.cz>
|
|
||||||
Date: Tue, 2 Sep 2025 15:33:43 +0200
|
|
||||||
Subject: [PATCH 16/17] tests: processing incomplete events in SSE client
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
Organization: Wires
|
|
||||||
|
|
||||||
During my testing I noticed that I obtained incomplete message in
|
|
||||||
on_data callback. The message was split into two callbacks.
|
|
||||||
This commit fixes the FIXME by buffering the data and processing
|
|
||||||
a complete event, once available.
|
|
||||||
|
|
||||||
Change-Id: Ied07e69e8b518f20fcc82134a4c041e7ec3a06d6
|
|
||||||
Signed-off-by: Mattias Walström <lazzer@gmail.com>
|
|
||||||
---
|
|
||||||
tests/restconf_utils.cpp | 53 +++++++++++++++++++++++-----------------
|
|
||||||
tests/restconf_utils.h | 3 ++-
|
|
||||||
2 files changed, 33 insertions(+), 23 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/tests/restconf_utils.cpp b/tests/restconf_utils.cpp
|
|
||||||
index 5b1ebe3..740b1fa 100644
|
|
||||||
--- a/tests/restconf_utils.cpp
|
|
||||||
+++ b/tests/restconf_utils.cpp
|
|
||||||
@@ -199,8 +199,8 @@ SSEClient::SSEClient(
|
|
||||||
req->on_response([&, silenceTimeout, reportIgnoredLines](const ng_client::response& res) {
|
|
||||||
requestSent.release();
|
|
||||||
res.on_data([&, silenceTimeout, reportIgnoredLines](const uint8_t* data, std::size_t len) {
|
|
||||||
- // not a production-ready code. In real-life condition the data received in one callback might probably be incomplete
|
|
||||||
- parseEvents(std::string(reinterpret_cast<const char*>(data), len), eventWatcher, reportIgnoredLines);
|
|
||||||
+ dataBuffer.append(std::string(reinterpret_cast<const char*>(data), len));
|
|
||||||
+ parseEvents(eventWatcher, reportIgnoredLines);
|
|
||||||
t.expires_from_now(silenceTimeout);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -217,30 +217,39 @@ SSEClient::SSEClient(
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
-void SSEClient::parseEvents(const std::string& msg, const RestconfNotificationWatcher& eventWatcher, const ReportIgnoredLines reportIgnoredLines)
|
|
||||||
+void SSEClient::parseEvents(const RestconfNotificationWatcher& eventWatcher, const ReportIgnoredLines reportIgnoredLines)
|
|
||||||
{
|
|
||||||
static const std::string dataPrefix = "data:";
|
|
||||||
static const std::string ignorePrefix = ":";
|
|
||||||
|
|
||||||
- std::istringstream iss(msg);
|
|
||||||
- std::string line;
|
|
||||||
- std::string event;
|
|
||||||
-
|
|
||||||
- while (std::getline(iss, line)) {
|
|
||||||
- if (line.starts_with(ignorePrefix) && reportIgnoredLines == ReportIgnoredLines::Yes) {
|
|
||||||
- eventWatcher.commentEvent(line);
|
|
||||||
- } else if (line.starts_with(ignorePrefix)) {
|
|
||||||
- continue;
|
|
||||||
- } else if (line.starts_with(dataPrefix)) {
|
|
||||||
- event += line.substr(dataPrefix.size());
|
|
||||||
- } else if (line.empty() && !event.empty()) {
|
|
||||||
- eventWatcher.dataEvent(event);
|
|
||||||
- event.clear();
|
|
||||||
- } else if (line.empty()) {
|
|
||||||
- continue;
|
|
||||||
- } else {
|
|
||||||
- CAPTURE(msg);
|
|
||||||
- FAIL("Unprefixed response");
|
|
||||||
+ std::size_t pos = 0;
|
|
||||||
+ constexpr auto EVENT_SEPARATOR = "\n\n"; // FIXME: Not a production-ready code; does not deal with all possible newline combinations of CR and LF
|
|
||||||
+
|
|
||||||
+ while ((pos = dataBuffer.find(EVENT_SEPARATOR)) != std::string::npos) {
|
|
||||||
+ // extract event
|
|
||||||
+ auto rawEvent = dataBuffer.substr(0, pos + std::char_traits<char>::length(EVENT_SEPARATOR));
|
|
||||||
+ std::istringstream stream(rawEvent);
|
|
||||||
+ dataBuffer.erase(0, pos + std::char_traits<char>::length(EVENT_SEPARATOR));
|
|
||||||
+
|
|
||||||
+ // split on newlines
|
|
||||||
+ std::string line;
|
|
||||||
+ std::string event;
|
|
||||||
+ while (std::getline(stream, line)) {
|
|
||||||
+ if (line.starts_with(ignorePrefix) && reportIgnoredLines == ReportIgnoredLines::Yes) {
|
|
||||||
+ eventWatcher.commentEvent(line);
|
|
||||||
+ } else if (line.starts_with(ignorePrefix)) {
|
|
||||||
+ continue;
|
|
||||||
+ } else if (line.starts_with(dataPrefix)) {
|
|
||||||
+ event += line.substr(dataPrefix.size());
|
|
||||||
+ } else if (line.empty() && !event.empty()) {
|
|
||||||
+ eventWatcher.dataEvent(event);
|
|
||||||
+ event.clear();
|
|
||||||
+ } else if (line.empty()) {
|
|
||||||
+ continue;
|
|
||||||
+ } else {
|
|
||||||
+ CAPTURE(rawEvent);
|
|
||||||
+ FAIL("Unprefixed response");
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
diff --git a/tests/restconf_utils.h b/tests/restconf_utils.h
|
|
||||||
index 9dde10b..c35df54 100644
|
|
||||||
--- a/tests/restconf_utils.h
|
|
||||||
+++ b/tests/restconf_utils.h
|
|
||||||
@@ -87,6 +87,7 @@ void setupRealNacm(sysrepo::Session session);
|
|
||||||
struct SSEClient {
|
|
||||||
std::shared_ptr<ng_client::session> client;
|
|
||||||
boost::asio::deadline_timer t;
|
|
||||||
+ std::string dataBuffer;
|
|
||||||
|
|
||||||
enum class ReportIgnoredLines {
|
|
||||||
No,
|
|
||||||
@@ -104,7 +105,7 @@ struct SSEClient {
|
|
||||||
const boost::posix_time::seconds silenceTimeout = boost::posix_time::seconds(1), // test code; the server should respond "soon"
|
|
||||||
const ReportIgnoredLines reportIgnoredLines = ReportIgnoredLines::No);
|
|
||||||
|
|
||||||
- static void parseEvents(const std::string& msg, const RestconfNotificationWatcher& eventWatcher, const ReportIgnoredLines reportIgnoredLines);
|
|
||||||
+ void parseEvents(const RestconfNotificationWatcher& eventWatcher, const ReportIgnoredLines reportIgnoredLines);
|
|
||||||
};
|
|
||||||
|
|
||||||
#define PREPARE_LOOP_WITH_EXCEPTIONS \
|
|
||||||
--
|
|
||||||
2.43.0
|
|
||||||
|
|
||||||
@@ -13,4 +13,6 @@ config BR2_PACKAGE_ROUSETTE
|
|||||||
select BR2_PACKAGE_SYSREPO_CPP
|
select BR2_PACKAGE_SYSREPO_CPP
|
||||||
select BR2_PACKAGE_DATE
|
select BR2_PACKAGE_DATE
|
||||||
help
|
help
|
||||||
RESTconf server
|
A RESTCONF server for sysrepo
|
||||||
|
|
||||||
|
https://github.com/CESNET/rousette
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
From 8e230d3f2e1e33691998862e99ab4e13410527b9 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Joachim Wiberg <troglobit@gmail.com>
|
|
||||||
Date: Wed, 8 Jan 2025 07:49:06 +0100
|
|
||||||
Subject: [PATCH 01/16] Drop redundant initial call to localtime_r()
|
|
||||||
Organization: Wires
|
|
||||||
|
|
||||||
Fixes #94
|
|
||||||
|
|
||||||
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
|
||||||
---
|
|
||||||
src/syslogd.c | 1 -
|
|
||||||
1 file changed, 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/src/syslogd.c b/src/syslogd.c
|
|
||||||
index 17115fc..5ad4dbc 100644
|
|
||||||
--- a/src/syslogd.c
|
|
||||||
+++ b/src/syslogd.c
|
|
||||||
@@ -1508,7 +1508,6 @@ void printsys(char *msg)
|
|
||||||
*/
|
|
||||||
if (KeepKernTime || !sys_seqno_init) {
|
|
||||||
now = boot_time + ustime / 1000000;
|
|
||||||
- localtime_r(&now, &buffer.timestamp.tm);
|
|
||||||
} else {
|
|
||||||
struct timeval tv;
|
|
||||||
|
|
||||||
--
|
|
||||||
2.43.0
|
|
||||||
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
From 13c8071821ad27247061dbf4efe5a34505520bc1 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Patrick Oppenlander <patrick.oppenlander@gmail.com>
|
|
||||||
Date: Thu, 23 Jan 2025 15:22:57 +1100
|
|
||||||
Subject: [PATCH 02/16] fix local hostname '+@', '-@' support
|
|
||||||
Organization: Wires
|
|
||||||
|
|
||||||
Signed-off-by: Patrick Oppenlander <patrick.oppenlander@gmail.com>
|
|
||||||
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
|
||||||
---
|
|
||||||
src/syslogd.c | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/src/syslogd.c b/src/syslogd.c
|
|
||||||
index 5ad4dbc..c07e143 100644
|
|
||||||
--- a/src/syslogd.c
|
|
||||||
+++ b/src/syslogd.c
|
|
||||||
@@ -3895,7 +3895,7 @@ static int cfparse(FILE *fp, struct files *newf)
|
|
||||||
char *local = LocalHostName;
|
|
||||||
|
|
||||||
while (i < sizeof(host) - 1 && *local)
|
|
||||||
- host[i++] = *local;
|
|
||||||
+ host[i++] = *local++;
|
|
||||||
p++;
|
|
||||||
} else if (!isprint(*p) || isblank(*p))
|
|
||||||
break;
|
|
||||||
--
|
|
||||||
2.43.0
|
|
||||||
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
From 979edb2515d24174fe9a3e2d6402d62172028c52 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Joachim Wiberg <troglobit@gmail.com>
|
|
||||||
Date: Sat, 1 Feb 2025 20:33:19 +0100
|
|
||||||
Subject: [PATCH 03/16] Fix #95: printsys(), minor code simplification
|
|
||||||
Organization: Wires
|
|
||||||
|
|
||||||
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
|
||||||
---
|
|
||||||
src/syslogd.c | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/src/syslogd.c b/src/syslogd.c
|
|
||||||
index c07e143..f812d9e 100644
|
|
||||||
--- a/src/syslogd.c
|
|
||||||
+++ b/src/syslogd.c
|
|
||||||
@@ -1511,11 +1511,11 @@ void printsys(char *msg)
|
|
||||||
} else {
|
|
||||||
struct timeval tv;
|
|
||||||
|
|
||||||
- now = time(NULL);
|
|
||||||
if (gettimeofday(&tv, NULL) == -1) {
|
|
||||||
tv.tv_sec = time(NULL);
|
|
||||||
tv.tv_usec = 0;
|
|
||||||
}
|
|
||||||
+ now = tv.tv_sec;
|
|
||||||
ustime = tv.tv_usec;
|
|
||||||
}
|
|
||||||
|
|
||||||
--
|
|
||||||
2.43.0
|
|
||||||
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
From 360dfe4b6b17378990daef797a7e6a551c799b98 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Joachim Wiberg <troglobit@gmail.com>
|
|
||||||
Date: Sun, 2 Feb 2025 06:34:16 +0100
|
|
||||||
Subject: [PATCH 04/16] Fix #98: fprintlog_first(), drop superfluous call
|
|
||||||
Organization: Wires
|
|
||||||
|
|
||||||
The call to check_timestamp() is not needed (anymore) already called in
|
|
||||||
logmsg(), which is the only way of entering this function (today).
|
|
||||||
|
|
||||||
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
|
||||||
---
|
|
||||||
src/syslogd.c | 3 ---
|
|
||||||
1 file changed, 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/syslogd.c b/src/syslogd.c
|
|
||||||
index f812d9e..6748cc6 100644
|
|
||||||
--- a/src/syslogd.c
|
|
||||||
+++ b/src/syslogd.c
|
|
||||||
@@ -2424,9 +2424,6 @@ static void fprintlog_first(struct filed *f, struct buf_msg *buffer)
|
|
||||||
|
|
||||||
logit("Called fprintlog_first(), ");
|
|
||||||
|
|
||||||
- /* Messages generated by syslogd itself may not have a timestamp */
|
|
||||||
- check_timestamp(buffer);
|
|
||||||
-
|
|
||||||
if (f->f_type != F_FORW_SUSP && f->f_type != F_FORW_UNKN) {
|
|
||||||
f->f_time = timer_now();
|
|
||||||
f->f_prevcount = 0;
|
|
||||||
--
|
|
||||||
2.43.0
|
|
||||||
|
|
||||||
@@ -1,118 +0,0 @@
|
|||||||
From 472c3d6a24e43f8186ce069da267e9ae52c18699 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Joachim Wiberg <troglobit@gmail.com>
|
|
||||||
Date: Thu, 27 Feb 2025 19:07:11 +0100
|
|
||||||
Subject: [PATCH 05/16] Fix #100: parsing of userspace messages in /dev/kmsg
|
|
||||||
Organization: Wires
|
|
||||||
|
|
||||||
Some applications that inject log messages to /dev/kmsg do not use a
|
|
||||||
space separating the APP_NAME (and optional PID), while some do. So we
|
|
||||||
need to support the following variants for the human readable payload,
|
|
||||||
as defined in [1]:
|
|
||||||
|
|
||||||
1. APP: MESG
|
|
||||||
2. APP:MESG
|
|
||||||
3. APP MESG
|
|
||||||
4. APP[PID]: MESG
|
|
||||||
5. APP[PID]:MESG
|
|
||||||
6. APP[PID] MESG
|
|
||||||
|
|
||||||
Prior to this change, 4 & 5 were treated the same, causing #100, and the
|
|
||||||
other alternatives were not supported at all. This patch drops the bad
|
|
||||||
local implementation in printsys() in favor of the generic parsemsg()
|
|
||||||
helper function for RFC3164 messages, which properly extracts both the
|
|
||||||
application name and PID if present.
|
|
||||||
|
|
||||||
This helper's ': ' separator check is relaxed since some clients only
|
|
||||||
send ':' (no space) before the message. The RFC can be interpreted
|
|
||||||
either way, so we now allow either/or or no separator.
|
|
||||||
|
|
||||||
[1]: https://www.kernel.org/doc/Documentation/ABI/testing/dev-kmsg
|
|
||||||
|
|
||||||
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
|
||||||
---
|
|
||||||
src/syslogd.c | 55 +++++++++++++++++++++++++++------------------------
|
|
||||||
1 file changed, 29 insertions(+), 26 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/syslogd.c b/src/syslogd.c
|
|
||||||
index 6748cc6..b52af73 100644
|
|
||||||
--- a/src/syslogd.c
|
|
||||||
+++ b/src/syslogd.c
|
|
||||||
@@ -1242,16 +1242,38 @@ parsemsg_rfc3164_app_name_procid(char **msg, char **app_name, char **procid)
|
|
||||||
procid_length = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
- /* Separator. */
|
|
||||||
- if (m[0] != ':' || m[1] != ' ')
|
|
||||||
- goto bad;
|
|
||||||
+ /*
|
|
||||||
+ * Relaxed separator check. This function is used both for
|
|
||||||
+ * incoming remote/local syslog messages, and the /dev/kmsg
|
|
||||||
+ * printsys() function.
|
|
||||||
+ *
|
|
||||||
+ * RFC3164 sec. 4.1.3 states that: "the conclusion of the TAG
|
|
||||||
+ * field has been seen to be the left square bracket character
|
|
||||||
+ * ('['), a colon character (':'), or a space character". This
|
|
||||||
+ * uncertainty continues in sec. 5.3: "a colon and a space
|
|
||||||
+ * character *usually* follow the TAG" (emphasis added).
|
|
||||||
+ *
|
|
||||||
+ * Hence, we should be prepared for any of:
|
|
||||||
+ * - APP: msg
|
|
||||||
+ * - APP:msg
|
|
||||||
+ * - APP msg
|
|
||||||
+ * - APP[PID]: msg
|
|
||||||
+ * - APP[PID]:msg
|
|
||||||
+ * - APP[PID] msg
|
|
||||||
+ */
|
|
||||||
+ if (*m == ':') {
|
|
||||||
+ m++;
|
|
||||||
+ if (isblank(*m))
|
|
||||||
+ m++;
|
|
||||||
+ } else if (isblank(*m))
|
|
||||||
+ m++;
|
|
||||||
|
|
||||||
/* Split strings from input. */
|
|
||||||
app_name_begin[app_name_length] = '\0';
|
|
||||||
if (procid_begin != 0)
|
|
||||||
procid_begin[procid_length] = '\0';
|
|
||||||
|
|
||||||
- *msg = m + 2;
|
|
||||||
+ *msg = m;
|
|
||||||
*app_name = app_name_begin;
|
|
||||||
*procid = procid_begin;
|
|
||||||
return;
|
|
||||||
@@ -1630,29 +1652,10 @@ void printsys(char *msg)
|
|
||||||
/*
|
|
||||||
* Check for user writing to /dev/kmsg before /dev/log
|
|
||||||
* is up. Syntax to write: <PRI>APP_NAME[PROC_ID]:msg
|
|
||||||
+ * Kernel facility is 0, anything != 0 is userspace.
|
|
||||||
*/
|
|
||||||
- if (buffer.pri & LOG_FACMASK) {
|
|
||||||
- for (q = p; *q && !isspace(*q) && *q != '['; q++)
|
|
||||||
- ;
|
|
||||||
-
|
|
||||||
- if (*q == '[') {
|
|
||||||
- char *ptr = &q[1];
|
|
||||||
-
|
|
||||||
- while (*ptr && isdigit(*ptr))
|
|
||||||
- ptr++;
|
|
||||||
-
|
|
||||||
- if (ptr[0] == ']' && ptr[1] == ':') {
|
|
||||||
- *ptr++ = 0;
|
|
||||||
- *q++ = 0;
|
|
||||||
-
|
|
||||||
- buffer.app_name = p;
|
|
||||||
- buffer.proc_id = q;
|
|
||||||
-
|
|
||||||
- /* user log message cont. here */
|
|
||||||
- p = &ptr[1];
|
|
||||||
- }
|
|
||||||
- }
|
|
||||||
- }
|
|
||||||
+ if (buffer.pri & LOG_FACMASK)
|
|
||||||
+ parsemsg_rfc3164_app_name_procid(&p, &buffer.app_name, &buffer.proc_id);
|
|
||||||
|
|
||||||
q = lp;
|
|
||||||
while (*p != '\0' && (c = *p++) != '\n' && q < &line[MAXLINE])
|
|
||||||
--
|
|
||||||
2.43.0
|
|
||||||
|
|
||||||
@@ -1,99 +0,0 @@
|
|||||||
From 8cdf4b0c4b9914b8b7aa1c1c1d76dad0fa429115 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Joachim Wiberg <troglobit@gmail.com>
|
|
||||||
Date: Sat, 1 Mar 2025 09:23:01 +0100
|
|
||||||
Subject: [PATCH 06/16] Fix #93: update documentation on behavior of -T flag
|
|
||||||
Organization: Wires
|
|
||||||
|
|
||||||
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
|
||||||
---
|
|
||||||
man/syslogd.8 | 17 ++++++++++-------
|
|
||||||
src/syslogd.c | 10 +++++-----
|
|
||||||
2 files changed, 15 insertions(+), 12 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/man/syslogd.8 b/man/syslogd.8
|
|
||||||
index f3e6ad2..7534529 100644
|
|
||||||
--- a/man/syslogd.8
|
|
||||||
+++ b/man/syslogd.8
|
|
||||||
@@ -411,10 +411,13 @@ the command line option always wins, so it must be removed for
|
|
||||||
.Nm
|
|
||||||
to consider the .conf file option instead.
|
|
||||||
.It Fl T
|
|
||||||
-Always use the local time and date for messages received from the network,
|
|
||||||
-instead of the timestamp field supplied in the message by the remote host.
|
|
||||||
-This is useful if some of the originating hosts cannot keep time properly
|
|
||||||
-or are unable to generate a correct timestamp.
|
|
||||||
+Always use the local time and date for messages instead of the timestamp
|
|
||||||
+field in the log message. This applies to both messages received from a
|
|
||||||
+remote syslog server and locally originated. Useful if the originating
|
|
||||||
+hosts cannot keep time properly or are unable to generate a correct
|
|
||||||
+timestamp. See
|
|
||||||
+.Fl t
|
|
||||||
+for details on the timestamp of (local) kernel messages.
|
|
||||||
.It Fl t
|
|
||||||
Keep (trust) kernel timestamp.
|
|
||||||
.Pp
|
|
||||||
@@ -472,9 +475,9 @@ API included with the
|
|
||||||
.Nm sysklogd
|
|
||||||
project.
|
|
||||||
.Pp
|
|
||||||
-The date and time are taken from the received message. If the format of
|
|
||||||
-the timestamp field is incorrect, time obtained from the local host is
|
|
||||||
-used instead. This can be overridden by the
|
|
||||||
+The date and time for a log message are by default read from the
|
|
||||||
+received message. If the format of the timestamp field is incorrect,
|
|
||||||
+the time of reception is used instead. See also the
|
|
||||||
.Fl T
|
|
||||||
flag.
|
|
||||||
.Sh SECURITY
|
|
||||||
diff --git a/src/syslogd.c b/src/syslogd.c
|
|
||||||
index b52af73..5a40732 100644
|
|
||||||
--- a/src/syslogd.c
|
|
||||||
+++ b/src/syslogd.c
|
|
||||||
@@ -148,7 +148,7 @@ static int no_compress; /* don't compress messages (1=pipes, 2=all) */
|
|
||||||
static int secure_opt; /* sink for others, log to remote, or only unix domain socks */
|
|
||||||
static int secure_mode; /* same as above but from syslog.conf, only if cmdline unset */
|
|
||||||
|
|
||||||
-static int RemoteAddDate; /* Always set the date on remote messages */
|
|
||||||
+static int AlwaysAddDate; /* Always use our timestamp for log messages */
|
|
||||||
static int RemoteHostname; /* Log remote hostname from the message */
|
|
||||||
|
|
||||||
static int KernLog = 1; /* Track kernel logs by default */
|
|
||||||
@@ -458,7 +458,7 @@ int usage(int code)
|
|
||||||
" If specified twice, no socket at all will be opened, which also\n"
|
|
||||||
" disables support for logging to remote machines.\n"
|
|
||||||
" -t Keep kernel timestamp, even after initial ring buffer emptying\n"
|
|
||||||
- " -T Use local time and date for messages received from remote hosts\n"
|
|
||||||
+ " -T Use local time and date for log messages (both local and remote)\n"
|
|
||||||
" -? Show this help text\n"
|
|
||||||
" -v Show program version and exit\n"
|
|
||||||
"\n"
|
|
||||||
@@ -585,7 +585,7 @@ int main(int argc, char *argv[])
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'T':
|
|
||||||
- RemoteAddDate = 1;
|
|
||||||
+ AlwaysAddDate = 1;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 't': /* keep/trust kernel timestamp always */
|
|
||||||
@@ -1129,7 +1129,7 @@ parsemsg_rfc5424(const char *from, int pri, char *msg)
|
|
||||||
}
|
|
||||||
#undef PARSE_NUMBER
|
|
||||||
PARSE_CHAR("TIMESTAMP", ' ');
|
|
||||||
- if (!RemoteAddDate)
|
|
||||||
+ if (!AlwaysAddDate)
|
|
||||||
timestamp = ×tamp_remote;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1311,7 +1311,7 @@ parsemsg_rfc3164(const char *from, int pri, char *msg)
|
|
||||||
|
|
||||||
msg += RFC3164_DATELEN + 1;
|
|
||||||
|
|
||||||
- if (!RemoteAddDate) {
|
|
||||||
+ if (!AlwaysAddDate) {
|
|
||||||
struct timeval tv;
|
|
||||||
time_t t_remote;
|
|
||||||
struct tm tm_now;
|
|
||||||
--
|
|
||||||
2.43.0
|
|
||||||
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
From b5b4a4ecb893dd643fb25763fb9c6f6ca972725e Mon Sep 17 00:00:00 2001
|
|
||||||
From: Joachim Wiberg <troglobit@gmail.com>
|
|
||||||
Date: Sun, 2 Mar 2025 13:56:46 +0100
|
|
||||||
Subject: [PATCH 07/16] Update internal timer consistently
|
|
||||||
Organization: Wires
|
|
||||||
|
|
||||||
Timer is already updated by parsemsg() before calling logmsg(). For
|
|
||||||
consistency, add explicit update also to printsys() (kernel) and
|
|
||||||
flog() (internally originated) messages.
|
|
||||||
|
|
||||||
Issue #70
|
|
||||||
|
|
||||||
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
|
||||||
---
|
|
||||||
src/syslogd.c | 6 ++++++
|
|
||||||
1 file changed, 6 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/src/syslogd.c b/src/syslogd.c
|
|
||||||
index 5a40732..1737f7c 100644
|
|
||||||
--- a/src/syslogd.c
|
|
||||||
+++ b/src/syslogd.c
|
|
||||||
@@ -1467,6 +1467,9 @@ void printsys(char *msg)
|
|
||||||
char *lp, *p, *q;
|
|
||||||
int c;
|
|
||||||
|
|
||||||
+ /* Update current time before logging */
|
|
||||||
+ timer_update();
|
|
||||||
+
|
|
||||||
lp = line;
|
|
||||||
for (p = msg; *p != '\0';) {
|
|
||||||
memset(&buffer, 0, sizeof(buffer));
|
|
||||||
@@ -2669,6 +2672,9 @@ void flog(int pri, char *fmt, ...)
|
|
||||||
char proc_id[10];
|
|
||||||
va_list ap;
|
|
||||||
|
|
||||||
+ /* Update current time before logging */
|
|
||||||
+ timer_update();
|
|
||||||
+
|
|
||||||
va_start(ap, fmt);
|
|
||||||
(void)vsnprintf(buf, sizeof(buf), fmt, ap);
|
|
||||||
va_end(ap);
|
|
||||||
--
|
|
||||||
2.43.0
|
|
||||||
|
|
||||||
-61
@@ -1,61 +0,0 @@
|
|||||||
From d3362a104b414af2b352a15a6d1e92f823bdb9b6 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Joachim Wiberg <troglobit@gmail.com>
|
|
||||||
Date: Sun, 2 Mar 2025 14:06:37 +0100
|
|
||||||
Subject: [PATCH 08/16] Update ChangeLog and bump version for upcoming v2.7.1
|
|
||||||
release
|
|
||||||
Organization: Wires
|
|
||||||
|
|
||||||
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
|
||||||
---
|
|
||||||
ChangeLog.md | 14 ++++++++++++++
|
|
||||||
configure.ac | 2 +-
|
|
||||||
2 files changed, 15 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/ChangeLog.md b/ChangeLog.md
|
|
||||||
index b96857f..aa3e793 100644
|
|
||||||
--- a/ChangeLog.md
|
|
||||||
+++ b/ChangeLog.md
|
|
||||||
@@ -4,6 +4,19 @@ Change Log
|
|
||||||
All relevant changes to the project are documented in this file.
|
|
||||||
|
|
||||||
|
|
||||||
+[v2.7.1][UNRELEASED] - 2025-03-xx
|
|
||||||
+-----------------------
|
|
||||||
+
|
|
||||||
+### Changes
|
|
||||||
+- Update `syslogd -T` documentation, it applies to messages originating
|
|
||||||
+ both locally and from both remote syslog servers, issue #93
|
|
||||||
+
|
|
||||||
+### Fixes
|
|
||||||
+- Fix #99: hostname filtering support, introduced in v2.7.0, broken
|
|
||||||
+- Fix #100: parsing of userspace messages in `/dev/kmsg` inserted an
|
|
||||||
+ extra space before the message payload
|
|
||||||
+
|
|
||||||
+
|
|
||||||
[v2.7.0][] - 2025-01-06
|
|
||||||
-----------------------
|
|
||||||
|
|
||||||
@@ -667,6 +680,7 @@ and a replacement for `syslog.h` to enable new features in RFC5424.
|
|
||||||
|
|
||||||
|
|
||||||
[UNRELEASED]: https://github.com/troglobit/sysklogd/compare/v2.7.0...HEAD
|
|
||||||
+[v2.7.1]: https://github.com/troglobit/sysklogd/compare/v2.7.0...v2.7.1
|
|
||||||
[v2.7.0]: https://github.com/troglobit/sysklogd/compare/v2.6.2...v2.7.0
|
|
||||||
[v2.6.2]: https://github.com/troglobit/sysklogd/compare/v2.6.1...v2.6.2
|
|
||||||
[v2.6.1]: https://github.com/troglobit/sysklogd/compare/v2.6.0...v2.6.1
|
|
||||||
diff --git a/configure.ac b/configure.ac
|
|
||||||
index f387800..64de416 100644
|
|
||||||
--- a/configure.ac
|
|
||||||
+++ b/configure.ac
|
|
||||||
@@ -25,7 +25,7 @@
|
|
||||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
# SUCH DAMAGE.
|
|
||||||
|
|
||||||
-AC_INIT([sysklogd], [2.7.0],
|
|
||||||
+AC_INIT([sysklogd], [2.7.1-rc1],
|
|
||||||
[https://github.com/troglobit/sysklogd/issues],,
|
|
||||||
[https://github.com/troglobit/sysklogd])
|
|
||||||
AC_CONFIG_AUX_DIR(aux)
|
|
||||||
--
|
|
||||||
2.43.0
|
|
||||||
|
|
||||||
-47
@@ -1,47 +0,0 @@
|
|||||||
From 5552a3ea0d025573a5e212d62ee3e04bd376c7c4 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Joachim Wiberg <troglobit@gmail.com>
|
|
||||||
Date: Mon, 3 Mar 2025 03:17:39 +0100
|
|
||||||
Subject: [PATCH 09/16] Bump version and update ChangeLog for v2.7.1 release
|
|
||||||
Organization: Wires
|
|
||||||
|
|
||||||
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
|
||||||
---
|
|
||||||
ChangeLog.md | 4 ++--
|
|
||||||
configure.ac | 2 +-
|
|
||||||
2 files changed, 3 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/ChangeLog.md b/ChangeLog.md
|
|
||||||
index aa3e793..12829c0 100644
|
|
||||||
--- a/ChangeLog.md
|
|
||||||
+++ b/ChangeLog.md
|
|
||||||
@@ -4,12 +4,12 @@ Change Log
|
|
||||||
All relevant changes to the project are documented in this file.
|
|
||||||
|
|
||||||
|
|
||||||
-[v2.7.1][UNRELEASED] - 2025-03-xx
|
|
||||||
+[v2.7.1][] - 2025-03-03
|
|
||||||
-----------------------
|
|
||||||
|
|
||||||
### Changes
|
|
||||||
- Update `syslogd -T` documentation, it applies to messages originating
|
|
||||||
- both locally and from both remote syslog servers, issue #93
|
|
||||||
+ both locally and from remote syslog servers, issue #93
|
|
||||||
|
|
||||||
### Fixes
|
|
||||||
- Fix #99: hostname filtering support, introduced in v2.7.0, broken
|
|
||||||
diff --git a/configure.ac b/configure.ac
|
|
||||||
index 64de416..a2cf9be 100644
|
|
||||||
--- a/configure.ac
|
|
||||||
+++ b/configure.ac
|
|
||||||
@@ -25,7 +25,7 @@
|
|
||||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
# SUCH DAMAGE.
|
|
||||||
|
|
||||||
-AC_INIT([sysklogd], [2.7.1-rc1],
|
|
||||||
+AC_INIT([sysklogd], [2.7.1],
|
|
||||||
[https://github.com/troglobit/sysklogd/issues],,
|
|
||||||
[https://github.com/troglobit/sysklogd])
|
|
||||||
AC_CONFIG_AUX_DIR(aux)
|
|
||||||
--
|
|
||||||
2.43.0
|
|
||||||
|
|
||||||
@@ -1,162 +0,0 @@
|
|||||||
From 64cd26232e598f902cf93b540152df5f7d8991e8 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Luz Paz <luzpaz@pm.me>
|
|
||||||
Date: Mon, 3 Mar 2025 07:16:35 -0500
|
|
||||||
Subject: [PATCH 10/16] Fix various typos Fixes user-facing and non-user-facing
|
|
||||||
typos Found via `codespell -q 3 -L bootup,clen,nd,servent,siz,tast,unx`
|
|
||||||
Organization: Wires
|
|
||||||
|
|
||||||
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
|
||||||
---
|
|
||||||
ChangeLog.md | 2 +-
|
|
||||||
README.md | 2 +-
|
|
||||||
man/syslog.conf.5 | 2 +-
|
|
||||||
src/logger.c | 2 +-
|
|
||||||
src/syslog.h | 2 +-
|
|
||||||
src/syslogd.c | 4 ++--
|
|
||||||
src/syslogd.h | 2 +-
|
|
||||||
syslog.conf | 4 ++--
|
|
||||||
test/listen.sh | 4 ++--
|
|
||||||
9 files changed, 12 insertions(+), 12 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/ChangeLog.md b/ChangeLog.md
|
|
||||||
index 12829c0..da44e01 100644
|
|
||||||
--- a/ChangeLog.md
|
|
||||||
+++ b/ChangeLog.md
|
|
||||||
@@ -508,7 +508,7 @@ and a replacement for `syslog.h` to enable new features in RFC5424.
|
|
||||||
- New `syslogp()` API from NetBSD, for applications wanting to use
|
|
||||||
RFC5424 features like MsgID or structured data
|
|
||||||
- Many *incompatible changes* to command line options in `syslogd` and
|
|
||||||
- `klogd` for compatiblity with FreeBSD and NetBSD syslogd. Examples:
|
|
||||||
+ `klogd` for compatibility with FreeBSD and NetBSD syslogd. Examples:
|
|
||||||
- In syslogd: `-b` and `-c` have been replaced with `-r` for global
|
|
||||||
log rotation, `-a` has been replaced with the new `-p` support. The
|
|
||||||
`-r` flag and `-s HOST` has also been dropped in favor of the BSD
|
|
||||||
diff --git a/README.md b/README.md
|
|
||||||
index eff6b03..12ce92c 100644
|
|
||||||
--- a/README.md
|
|
||||||
+++ b/README.md
|
|
||||||
@@ -63,7 +63,7 @@ Main differences from the original sysklogd package are:
|
|
||||||
|
|
||||||
- The separate `klogd` daemon is no longer part of the sysklogd project,
|
|
||||||
syslogd now natively supports logging kernel messages as well
|
|
||||||
-- *Major* command line changes to `syslogd`, for compatibilty with *BSD
|
|
||||||
+- *Major* command line changes to `syslogd`, for compatibility with *BSD
|
|
||||||
- Supports `include /etc/syslog.d/*.conf` directive, see example .conf
|
|
||||||
- Built-in log-rotation support, with compression by default, useful for
|
|
||||||
embedded systems. No need for cron and/or a separate log rotate daemon
|
|
||||||
diff --git a/man/syslog.conf.5 b/man/syslog.conf.5
|
|
||||||
index f7d9ea1..64a7260 100644
|
|
||||||
--- a/man/syslog.conf.5
|
|
||||||
+++ b/man/syslog.conf.5
|
|
||||||
@@ -704,7 +704,7 @@ This example shows one combination of program and hostname filters.
|
|
||||||
!-ppp
|
|
||||||
*.* /var/log/syslog
|
|
||||||
|
|
||||||
-# Local pppd messages of severity info, or higer, go to its own log file
|
|
||||||
+# Local pppd messages of severity info, or higher, go to its own log file
|
|
||||||
!+ppp
|
|
||||||
*.info /var/log/ppp.log
|
|
||||||
|
|
||||||
diff --git a/src/logger.c b/src/logger.c
|
|
||||||
index ffdb9e1..8fcb42a 100644
|
|
||||||
--- a/src/logger.c
|
|
||||||
+++ b/src/logger.c
|
|
||||||
@@ -286,7 +286,7 @@ static int usage(int code)
|
|
||||||
" -h HOST Send (UDP) message to this remote syslog server (IP or DNS name)\n"
|
|
||||||
" -H NAME Use NAME instead of system hostname in message header\n"
|
|
||||||
" -i Log process ID of the logger process with each line (LOG_PID)\n"
|
|
||||||
- " -I PID Log process ID using PID, recommed using PID $$ for shell scripts\n"
|
|
||||||
+ " -I PID Log process ID using PID, recommend using PID $$ for shell scripts\n"
|
|
||||||
#ifdef __linux__
|
|
||||||
" -k Log to kernel /dev/kmsg if /dev/log doesn't exist yet\n"
|
|
||||||
#endif
|
|
||||||
diff --git a/src/syslog.h b/src/syslog.h
|
|
||||||
index 9c33967..4f35ad0 100644
|
|
||||||
--- a/src/syslog.h
|
|
||||||
+++ b/src/syslog.h
|
|
||||||
@@ -191,7 +191,7 @@ CODE facilitynames[] = {
|
|
||||||
#define LOG_NDELAY 0x008 /* don't delay open */
|
|
||||||
#define LOG_NOWAIT 0x010 /* don't wait for console forks: DEPRECATED */
|
|
||||||
#define LOG_PERROR 0x020 /* log to stderr as well */
|
|
||||||
-#define LOG_PTRIM 0x040 /* trim anything syslog addded when writing to stderr */
|
|
||||||
+#define LOG_PTRIM 0x040 /* trim anything syslog added when writing to stderr */
|
|
||||||
#define LOG_NLOG 0x080 /* don't write to the system log */
|
|
||||||
#define LOG_STDOUT 0x100 /* like nlog, for debugging syslogp() API */
|
|
||||||
#define LOG_RFC3164 0x200 /* Log to remote/ipc socket in old BSD format */
|
|
||||||
diff --git a/src/syslogd.c b/src/syslogd.c
|
|
||||||
index 1737f7c..9128e7f 100644
|
|
||||||
--- a/src/syslogd.c
|
|
||||||
+++ b/src/syslogd.c
|
|
||||||
@@ -177,7 +177,7 @@ static TAILQ_HEAD(notifiers, notifier) nothead = TAILQ_HEAD_INITIALIZER(nothead)
|
|
||||||
static TAILQ_HEAD(peers, peer) pqueue = TAILQ_HEAD_INITIALIZER(pqueue);
|
|
||||||
|
|
||||||
/*
|
|
||||||
- * List fo peers allowed to log to us.
|
|
||||||
+ * List of peers allowed to log to us.
|
|
||||||
*/
|
|
||||||
static SIMPLEQ_HEAD(allowed, allowedpeer) aphead = SIMPLEQ_HEAD_INITIALIZER(aphead);
|
|
||||||
|
|
||||||
@@ -4456,7 +4456,7 @@ static void notifier_free_all(void)
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
- * The following function is resposible for handling a SIGHUP signal. Since
|
|
||||||
+ * The following function is responsible for handling a SIGHUP signal. Since
|
|
||||||
* we are now doing mallocs/free as part of init we had better not being
|
|
||||||
* doing this during a signal handler. Instead this function simply sets
|
|
||||||
* a flag variable which will tell the main loop to go through a restart.
|
|
||||||
diff --git a/src/syslogd.h b/src/syslogd.h
|
|
||||||
index ff97a0a..511e3e8 100644
|
|
||||||
--- a/src/syslogd.h
|
|
||||||
+++ b/src/syslogd.h
|
|
||||||
@@ -224,7 +224,7 @@
|
|
||||||
#define F_PIPE 9 /* named pipe */
|
|
||||||
|
|
||||||
/*
|
|
||||||
- * Stuct to hold property-based filters
|
|
||||||
+ * Struct to hold property-based filters
|
|
||||||
*/
|
|
||||||
struct prop_filter {
|
|
||||||
uint8_t prop_type;
|
|
||||||
diff --git a/syslog.conf b/syslog.conf
|
|
||||||
index 581fc32..3426c25 100644
|
|
||||||
--- a/syslog.conf
|
|
||||||
+++ b/syslog.conf
|
|
||||||
@@ -44,7 +44,7 @@ mail.err /var/log/mail.err
|
|
||||||
|
|
||||||
#
|
|
||||||
# Store all critical events, except kernel logs, in critical RFC5424 format.
|
|
||||||
-# Overide global log rotation settings, rotate every 10MiB, keep 5 old logs,
|
|
||||||
+# Override global log rotation settings, rotate every 10MiB, keep 5 old logs,
|
|
||||||
#
|
|
||||||
#*.=crit;kern.none /var/log/critical ;rotate=10M:5,RFC5424
|
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ mail.err /var/log/mail.err
|
|
||||||
# Secure mode, same as -s, none(0), on(1), full(2). When enabled
|
|
||||||
# only logging to remote syslog server possible, with full secure
|
|
||||||
# mode, not even that is possible. We default to prevent syslogd
|
|
||||||
-# from opening UDP/514 and receving messages from other systems.
|
|
||||||
+# from opening UDP/514 and receiving messages from other systems.
|
|
||||||
#
|
|
||||||
secure_mode 1
|
|
||||||
|
|
||||||
diff --git a/test/listen.sh b/test/listen.sh
|
|
||||||
index 1b706e8..7665261 100755
|
|
||||||
--- a/test/listen.sh
|
|
||||||
+++ b/test/listen.sh
|
|
||||||
@@ -99,10 +99,10 @@ run_step "Verify listen off - no remote no ports" verify_secure_daem
|
|
||||||
run_step "Verify listen off - only send to remote, no ports" verify_safe_daemon
|
|
||||||
run_step "Verify listen on, default" verify_default_daemon
|
|
||||||
|
|
||||||
-run_step "Verfiy listen on 127.0.0.1:510" verify_local_daemon
|
|
||||||
+run_step "Verify listen on 127.0.0.1:510" verify_local_daemon
|
|
||||||
run_step "Verify port 514 is closed" check_not_open 514
|
|
||||||
|
|
||||||
-run_step "Verfiy listen on 10.0.0.1:512" verify_bind
|
|
||||||
+run_step "Verify listen on 10.0.0.1:512" verify_bind
|
|
||||||
run_step "Verify port 510 is closed" check_not_open 510
|
|
||||||
|
|
||||||
run_step "Verify delayed bind to new address 10.0.0.2:513" verify_delayed_bind
|
|
||||||
--
|
|
||||||
2.43.0
|
|
||||||
|
|
||||||
-70
@@ -1,70 +0,0 @@
|
|||||||
From 2fbac9e54b60e813a5ecfb4ff4177b6351bfbffd Mon Sep 17 00:00:00 2001
|
|
||||||
From: Joachim Wiberg <troglobit@gmail.com>
|
|
||||||
Date: Tue, 18 Mar 2025 06:32:27 +0100
|
|
||||||
Subject: [PATCH 11/16] test: update tag.sh, include dots in name and verify
|
|
||||||
tag in logfile
|
|
||||||
Organization: Wires
|
|
||||||
|
|
||||||
Issue #102
|
|
||||||
|
|
||||||
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
|
||||||
---
|
|
||||||
test/tag.sh | 11 +++++++++--
|
|
||||||
1 file changed, 9 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/test/tag.sh b/test/tag.sh
|
|
||||||
index 3e1c598..bfc409a 100755
|
|
||||||
--- a/test/tag.sh
|
|
||||||
+++ b/test/tag.sh
|
|
||||||
@@ -1,16 +1,20 @@
|
|
||||||
#!/bin/sh
|
|
||||||
# Verify log filtering based on ident/tag.
|
|
||||||
+#DEBUG=true
|
|
||||||
. "${srcdir:-.}/lib.sh"
|
|
||||||
|
|
||||||
TG1=pimd
|
|
||||||
TG2=mrouted
|
|
||||||
+TG3=in.tftpd
|
|
||||||
MSG="Multicast, a perfect weapon for an imperfect time."
|
|
||||||
UNX="In UNIX we trust"
|
|
||||||
+DOT="We bring 512 byte block gifts"
|
|
||||||
|
|
||||||
LOGDIR="$DIR/log"
|
|
||||||
SYSLOG="${LOGDIR}/syslog"
|
|
||||||
TG1LOG="${LOGDIR}/$TG1.log"
|
|
||||||
TG2LOG="${LOGDIR}/$TG2.log"
|
|
||||||
+TG3LOG="${LOGDIR}/$TG3.log"
|
|
||||||
|
|
||||||
setup_syslogd()
|
|
||||||
{
|
|
||||||
@@ -22,6 +26,8 @@ setup_syslogd()
|
|
||||||
*.* $TG1LOG
|
|
||||||
#!$TG2
|
|
||||||
*.* $TG2LOG
|
|
||||||
+ #!$TG3
|
|
||||||
+ *.* $TG3LOG
|
|
||||||
EOF
|
|
||||||
setup -m0
|
|
||||||
}
|
|
||||||
@@ -32,8 +38,8 @@ verify_tag()
|
|
||||||
log="$1"; shift
|
|
||||||
msg="$*"
|
|
||||||
|
|
||||||
- logger -t "$tag" "$msg"
|
|
||||||
- grep "$msg" "$log"
|
|
||||||
+ logger -ip user.debug -t "$tag" "$msg"
|
|
||||||
+ grep "$msg" "$log" |grep "$tag"
|
|
||||||
}
|
|
||||||
|
|
||||||
verify_log()
|
|
||||||
@@ -52,6 +58,7 @@ verify_not()
|
|
||||||
run_step "Set up property based filtering syslogd" setup_syslogd
|
|
||||||
run_step "Verify basic tag based filtering (1)" verify_tag "$TG1" "$TG1LOG" "$MSG"
|
|
||||||
run_step "Verify basic tag based filtering (2)" verify_tag "$TG2" "$TG2LOG" "$MSG"
|
|
||||||
+run_step "Verify basic tag based filtering (3)" verify_tag "$TG3" "$TG3LOG" "$DOT"
|
|
||||||
run_step "Verify not in syslog" verify_not "$SYSLOG" "$MSG"
|
|
||||||
|
|
||||||
run_step "Verify unfiltered tag logging" verify_tag "foo" "$SYSLOG" "$UNX"
|
|
||||||
--
|
|
||||||
2.43.0
|
|
||||||
|
|
||||||
-72
@@ -1,72 +0,0 @@
|
|||||||
From ff09758a63f100d5e611d28b1f219ea10f2ca996 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Joachim Wiberg <troglobit@gmail.com>
|
|
||||||
Date: Wed, 19 Mar 2025 06:08:45 +0100
|
|
||||||
Subject: [PATCH 12/16] test: further extend tag test to check RFC3164 code
|
|
||||||
path as well
|
|
||||||
Organization: Wires
|
|
||||||
|
|
||||||
Reproduces issue #102
|
|
||||||
|
|
||||||
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
|
||||||
---
|
|
||||||
test/tag.sh | 33 +++++++++++++++++++++++++++++----
|
|
||||||
1 file changed, 29 insertions(+), 4 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/test/tag.sh b/test/tag.sh
|
|
||||||
index bfc409a..53aa745 100755
|
|
||||||
--- a/test/tag.sh
|
|
||||||
+++ b/test/tag.sh
|
|
||||||
@@ -1,6 +1,11 @@
|
|
||||||
#!/bin/sh
|
|
||||||
-# Verify log filtering based on ident/tag.
|
|
||||||
-#DEBUG=true
|
|
||||||
+# Verify log filtering based on ident/tag for both RFC3154 (BSD)
|
|
||||||
+# and RFC5424 formatted log messages sent to syslogd. A logged
|
|
||||||
+# message can also contain a [PID], so the combinations of various
|
|
||||||
+# tags + pid are also covered.
|
|
||||||
+#
|
|
||||||
+# Regression test for issue #102.
|
|
||||||
+#
|
|
||||||
. "${srcdir:-.}/lib.sh"
|
|
||||||
|
|
||||||
TG1=pimd
|
|
||||||
@@ -32,14 +37,34 @@ setup_syslogd()
|
|
||||||
setup -m0
|
|
||||||
}
|
|
||||||
|
|
||||||
+# Verify both RFC3164 (BSD) log format and RFC5424, because
|
|
||||||
+# they have different format parsers in syslogd. Generates
|
|
||||||
+# three additional variants of the given log message: rev,
|
|
||||||
+# rot13, and alphabetically sorted.
|
|
||||||
verify_tag()
|
|
||||||
{
|
|
||||||
tag="$1"; shift
|
|
||||||
log="$1"; shift
|
|
||||||
msg="$*"
|
|
||||||
+ rev=$(echo "$msg" | rev)
|
|
||||||
+ rot=$(echo "$msg" | tr 'a-zA-Z' 'n-za-mN-ZA-M')
|
|
||||||
+ bin=$(echo "$msg" | sed 's/./&\n/g' | sort | tr -d '\n')
|
|
||||||
|
|
||||||
- logger -ip user.debug -t "$tag" "$msg"
|
|
||||||
- grep "$msg" "$log" |grep "$tag"
|
|
||||||
+ # BSD log format (with -b)
|
|
||||||
+ logger -b -ip user.debug -t "$tag" "$msg"
|
|
||||||
+ verify_log "$log" "$msg" | grep "$tag" || return 1
|
|
||||||
+
|
|
||||||
+ # RFC5424 (default)
|
|
||||||
+ logger -ip user.debug -t "$tag" "$rev"
|
|
||||||
+ verify_log "$log" "$rev" | grep "$tag" || return 1
|
|
||||||
+
|
|
||||||
+ # BSD without -p flag
|
|
||||||
+ logger -b -i -t "$tag" "$rot"
|
|
||||||
+ verify_log "$log" "$rot" | grep "$tag" || return 1
|
|
||||||
+
|
|
||||||
+ # RFC5424 without -p flag
|
|
||||||
+ logger -i -t "$tag" "$bin"
|
|
||||||
+ verify_log "$log" "$bin" | grep "$tag" || return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
verify_log()
|
|
||||||
--
|
|
||||||
2.43.0
|
|
||||||
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
From c0622119d6baf45dcaef01897f6c686f2eb92ee4 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Joachim Wiberg <troglobit@gmail.com>
|
|
||||||
Date: Wed, 19 Mar 2025 06:35:39 +0100
|
|
||||||
Subject: [PATCH 13/16] Fix #102: allow '.' in tag names, regression in v2.7.1
|
|
||||||
Organization: Wires
|
|
||||||
|
|
||||||
RFC3164 specifies; "The TAG is a string of ABNF alphanumeric characters
|
|
||||||
that MUST NOT exceed 32 characters. Any non-alphanumeric character
|
|
||||||
will terminate the TAG field and will be assumed to be the starting
|
|
||||||
character of the CONTENT field."
|
|
||||||
|
|
||||||
Strictly speaking, ABNF (Augmented Backus-Naur Form) only includes the
|
|
||||||
alphanumeric characters, meaning just be letters and digits.
|
|
||||||
|
|
||||||
However, in real-life scenarios, and per previous behavior, we should
|
|
||||||
definitely allow '.' as well. The existing argument to `strspn()` is
|
|
||||||
from FreeBSD, which for some reason do *not* allow '.', but they do
|
|
||||||
also allow '_-/' ... '/' seems like the real outlier here.
|
|
||||||
|
|
||||||
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
|
||||||
---
|
|
||||||
src/syslogd.c | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/src/syslogd.c b/src/syslogd.c
|
|
||||||
index 9128e7f..07abdf9 100644
|
|
||||||
--- a/src/syslogd.c
|
|
||||||
+++ b/src/syslogd.c
|
|
||||||
@@ -1223,7 +1223,7 @@ parsemsg_rfc3164_app_name_procid(char **msg, char **app_name, char **procid)
|
|
||||||
"abcdefghijklmnopqrstuvwxyz"
|
|
||||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
||||||
"0123456789"
|
|
||||||
- "_-/");
|
|
||||||
+ "._-/");
|
|
||||||
if (app_name_length == 0)
|
|
||||||
goto bad;
|
|
||||||
m += app_name_length;
|
|
||||||
--
|
|
||||||
2.43.0
|
|
||||||
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
From 93f9cd74856be4b9a77c72b8e4c55a49c32ce26e Mon Sep 17 00:00:00 2001
|
|
||||||
From: Joachim Wiberg <troglobit@gmail.com>
|
|
||||||
Date: Mon, 24 Mar 2025 06:01:46 +0100
|
|
||||||
Subject: [PATCH 14/16] Prepare for upcoming v2.7.2
|
|
||||||
Organization: Wires
|
|
||||||
|
|
||||||
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
|
||||||
---
|
|
||||||
ChangeLog.md | 14 +++++++++++++-
|
|
||||||
configure.ac | 2 +-
|
|
||||||
2 files changed, 14 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/ChangeLog.md b/ChangeLog.md
|
|
||||||
index da44e01..140cfc4 100644
|
|
||||||
--- a/ChangeLog.md
|
|
||||||
+++ b/ChangeLog.md
|
|
||||||
@@ -4,6 +4,17 @@ Change Log
|
|
||||||
All relevant changes to the project are documented in this file.
|
|
||||||
|
|
||||||
|
|
||||||
+[v2.7.2][UNRELEASED]
|
|
||||||
+-----------------------
|
|
||||||
+
|
|
||||||
+### Changes
|
|
||||||
+- Increased code coverage testing of tag parser
|
|
||||||
+
|
|
||||||
+### Fixes
|
|
||||||
+- Fix #102: allow `.` in tag names, regression in v2.7.1
|
|
||||||
+- Fix various typos in documentation, by Luz Paz
|
|
||||||
+
|
|
||||||
+
|
|
||||||
[v2.7.1][] - 2025-03-03
|
|
||||||
-----------------------
|
|
||||||
|
|
||||||
@@ -679,7 +690,8 @@ and a replacement for `syslog.h` to enable new features in RFC5424.
|
|
||||||
- Several bugfixes and improvements, please refer to the .c files
|
|
||||||
|
|
||||||
|
|
||||||
-[UNRELEASED]: https://github.com/troglobit/sysklogd/compare/v2.7.0...HEAD
|
|
||||||
+[UNRELEASED]: https://github.com/troglobit/sysklogd/compare/v2.7.1...HEAD
|
|
||||||
+[v2.7.2]: https://github.com/troglobit/sysklogd/compare/v2.7.1...v2.7.2
|
|
||||||
[v2.7.1]: https://github.com/troglobit/sysklogd/compare/v2.7.0...v2.7.1
|
|
||||||
[v2.7.0]: https://github.com/troglobit/sysklogd/compare/v2.6.2...v2.7.0
|
|
||||||
[v2.6.2]: https://github.com/troglobit/sysklogd/compare/v2.6.1...v2.6.2
|
|
||||||
diff --git a/configure.ac b/configure.ac
|
|
||||||
index a2cf9be..13dadfa 100644
|
|
||||||
--- a/configure.ac
|
|
||||||
+++ b/configure.ac
|
|
||||||
@@ -25,7 +25,7 @@
|
|
||||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
# SUCH DAMAGE.
|
|
||||||
|
|
||||||
-AC_INIT([sysklogd], [2.7.1],
|
|
||||||
+AC_INIT([sysklogd], [2.7.2-beta1],
|
|
||||||
[https://github.com/troglobit/sysklogd/issues],,
|
|
||||||
[https://github.com/troglobit/sysklogd])
|
|
||||||
AC_CONFIG_AUX_DIR(aux)
|
|
||||||
--
|
|
||||||
2.43.0
|
|
||||||
|
|
||||||
-57
@@ -1,57 +0,0 @@
|
|||||||
From debc8c337b3e7d8c76701991a4566714b78c1846 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Joachim Wiberg <troglobit@gmail.com>
|
|
||||||
Date: Mon, 31 Mar 2025 13:22:47 +0200
|
|
||||||
Subject: [PATCH 15/16] logger: show invalid option arguments if -p and -o
|
|
||||||
parsing fail
|
|
||||||
Organization: Wires
|
|
||||||
|
|
||||||
Instead of just showing the usage instructions, include information
|
|
||||||
about the option and its argument failing. Useful when debugging
|
|
||||||
faulty calls to the logger program deep in an operating system.
|
|
||||||
|
|
||||||
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
|
||||||
---
|
|
||||||
src/logger.c | 14 +++++++++++---
|
|
||||||
1 file changed, 11 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/logger.c b/src/logger.c
|
|
||||||
index 8fcb42a..5bf263f 100644
|
|
||||||
--- a/src/logger.c
|
|
||||||
+++ b/src/logger.c
|
|
||||||
@@ -393,13 +393,17 @@ int main(int argc, char *argv[])
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'o':
|
|
||||||
- if (parse_opts(optarg, &iface, &ttl))
|
|
||||||
+ if (parse_opts(optarg, &iface, &ttl)) {
|
|
||||||
+ printf("Invalid option argument '-%c %s'\n", c, optarg);
|
|
||||||
return usage(1);
|
|
||||||
+ }
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'p':
|
|
||||||
- if (parse_prio(optarg, &facility, &severity))
|
|
||||||
+ if (parse_prio(optarg, &facility, &severity)) {
|
|
||||||
+ printf("Invalid option argument '-%c %s'\n", c, optarg);
|
|
||||||
return usage(1);
|
|
||||||
+ }
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'P':
|
|
||||||
@@ -428,8 +432,12 @@ int main(int argc, char *argv[])
|
|
||||||
printf("%s\n", version_info);
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
- default:
|
|
||||||
+ case '?':
|
|
||||||
return usage(0);
|
|
||||||
+
|
|
||||||
+ default:
|
|
||||||
+ printf("Unsupported option '-%c'\n", c);
|
|
||||||
+ return usage(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
--
|
|
||||||
2.43.0
|
|
||||||
|
|
||||||
-47
@@ -1,47 +0,0 @@
|
|||||||
From 5fb314cb9060afa3bd4eed2f0be3200f02f729e9 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Joachim Wiberg <troglobit@gmail.com>
|
|
||||||
Date: Mon, 31 Mar 2025 13:26:13 +0200
|
|
||||||
Subject: [PATCH 16/16] Update ChangeLog and bump version for v2.7.2 release
|
|
||||||
Organization: Wires
|
|
||||||
|
|
||||||
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
|
||||||
---
|
|
||||||
ChangeLog.md | 4 +++-
|
|
||||||
configure.ac | 2 +-
|
|
||||||
2 files changed, 4 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/ChangeLog.md b/ChangeLog.md
|
|
||||||
index 140cfc4..8d8bb43 100644
|
|
||||||
--- a/ChangeLog.md
|
|
||||||
+++ b/ChangeLog.md
|
|
||||||
@@ -4,11 +4,13 @@ Change Log
|
|
||||||
All relevant changes to the project are documented in this file.
|
|
||||||
|
|
||||||
|
|
||||||
-[v2.7.2][UNRELEASED]
|
|
||||||
+[v2.7.2][] - 2025-03-31
|
|
||||||
-----------------------
|
|
||||||
|
|
||||||
### Changes
|
|
||||||
- Increased code coverage testing of tag parser
|
|
||||||
+- Improved error handling in `logger` when invalid arguments to
|
|
||||||
+ `-p` and `-o` are encountered
|
|
||||||
|
|
||||||
### Fixes
|
|
||||||
- Fix #102: allow `.` in tag names, regression in v2.7.1
|
|
||||||
diff --git a/configure.ac b/configure.ac
|
|
||||||
index 13dadfa..fe79595 100644
|
|
||||||
--- a/configure.ac
|
|
||||||
+++ b/configure.ac
|
|
||||||
@@ -25,7 +25,7 @@
|
|
||||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
# SUCH DAMAGE.
|
|
||||||
|
|
||||||
-AC_INIT([sysklogd], [2.7.2-beta1],
|
|
||||||
+AC_INIT([sysklogd], [2.7.2],
|
|
||||||
[https://github.com/troglobit/sysklogd/issues],,
|
|
||||||
[https://github.com/troglobit/sysklogd])
|
|
||||||
AC_CONFIG_AUX_DIR(aux)
|
|
||||||
--
|
|
||||||
2.43.0
|
|
||||||
|
|
||||||
+146
@@ -0,0 +1,146 @@
|
|||||||
|
From 31dfe0d16461d2852f3fc56cb82aed3a23db022f Mon Sep 17 00:00:00 2001
|
||||||
|
From: Joachim Wiberg <troglobit@gmail.com>
|
||||||
|
Date: Thu, 25 Sep 2025 16:48:31 +0200
|
||||||
|
Subject: [PATCH] syslogd: fix UTF-8 handling with -8 flag, for RFC5424
|
||||||
|
compliance
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
Organization: Wires
|
||||||
|
|
||||||
|
The -8 flag was designed to preserve 8-bit data but failed with multi-byte
|
||||||
|
UTF-8 sequences like em-dash (—). The parsemsg_remove_unsafe_characters()
|
||||||
|
function processed UTF-8 byte-by-byte, corrupting sequences even with -8.
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
- Add UTF-8 sequence detection and validation functions
|
||||||
|
- Preserve complete valid UTF-8 sequences when -8 flag is used
|
||||||
|
- Support UTF-8 BOM per RFC5424 requirements
|
||||||
|
- Maintain backward compatibility and security filtering
|
||||||
|
|
||||||
|
Fixes #105
|
||||||
|
|
||||||
|
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
||||||
|
---
|
||||||
|
src/syslogd.c | 95 +++++++++++++++++++++++++++++++++++++++++++++++++--
|
||||||
|
1 file changed, 93 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/syslogd.c b/src/syslogd.c
|
||||||
|
index 07abdf9..fa82d98 100644
|
||||||
|
--- a/src/syslogd.c
|
||||||
|
+++ b/src/syslogd.c
|
||||||
|
@@ -997,18 +997,109 @@ void untty(void)
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
+/*
|
||||||
|
+ * Returns the length of a UTF-8 sequence starting at *in, or 0 if invalid.
|
||||||
|
+ * Does not validate the entire sequence, just checks the start byte.
|
||||||
|
+ */
|
||||||
|
+static size_t
|
||||||
|
+utf8_len(const unsigned char *in)
|
||||||
|
+{
|
||||||
|
+ unsigned char c = *in;
|
||||||
|
+
|
||||||
|
+ if ((c & 0x80) == 0x00) return 1; /* ASCII: 0xxxxxxx */
|
||||||
|
+ if ((c & 0xE0) == 0xC0) return 2; /* 110xxxxx */
|
||||||
|
+ if ((c & 0xF0) == 0xE0) return 3; /* 1110xxxx */
|
||||||
|
+ if ((c & 0xF8) == 0xF0) return 4; /* 11110xxx */
|
||||||
|
+
|
||||||
|
+ return 0; /* Invalid start byte */
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
+ * Validates a complete UTF-8 sequence of given length.
|
||||||
|
+ * Returns 1 if valid, 0 if invalid.
|
||||||
|
+ */
|
||||||
|
+static int
|
||||||
|
+utf8_valid(const unsigned char *in, size_t len)
|
||||||
|
+{
|
||||||
|
+ size_t i;
|
||||||
|
+
|
||||||
|
+ switch (len) {
|
||||||
|
+ case 1:
|
||||||
|
+ if ((*in & 0x80) != 0x00)
|
||||||
|
+ return 0;
|
||||||
|
+ break;
|
||||||
|
+ case 2:
|
||||||
|
+ if ((*in & 0xE0) != 0xC0)
|
||||||
|
+ return 0;
|
||||||
|
+ if (*in < 0xC2)
|
||||||
|
+ return 0; /* Overlong encoding */
|
||||||
|
+ break;
|
||||||
|
+ case 3:
|
||||||
|
+ if ((*in & 0xF0) != 0xE0)
|
||||||
|
+ return 0;
|
||||||
|
+ break;
|
||||||
|
+ case 4:
|
||||||
|
+ if ((*in & 0xF8) != 0xF0)
|
||||||
|
+ return 0;
|
||||||
|
+ if (*in > 0xF4)
|
||||||
|
+ return 0; /* Beyond Unicode range */
|
||||||
|
+ break;
|
||||||
|
+ default:
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Check continuation bytes */
|
||||||
|
+ for (i = 1; i < len; i++) {
|
||||||
|
+ if ((in[i] & 0xC0) != 0x80)
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Check for overlong encodings and surrogates */
|
||||||
|
+ if (len == 3 && *in == 0xE0 && (in[1] & 0xE0) == 0x80) return 0;
|
||||||
|
+ if (len == 4 && *in == 0xF0 && (in[1] & 0xF0) == 0x80) return 0;
|
||||||
|
+ if (len == 3 && *in == 0xED && (in[1] & 0xE0) == 0xA0) return 0; /* Surrogates */
|
||||||
|
+
|
||||||
|
+ return 1;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/*
|
||||||
|
* Removes characters from log messages that are unsafe to display.
|
||||||
|
- * TODO: Permit UTF-8 strings that include a BOM per RFC 5424?
|
||||||
|
+ * Preserves valid UTF-8 sequences, including BOM, with -8 flag.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
parsemsg_remove_unsafe_characters(const char *in, char *out, size_t outlen)
|
||||||
|
{
|
||||||
|
+ const unsigned char *p = (const unsigned char *)in;
|
||||||
|
char *q;
|
||||||
|
int c;
|
||||||
|
|
||||||
|
q = out;
|
||||||
|
- while ((c = (unsigned char)*in++) != '\0' && q < out + outlen - 4) {
|
||||||
|
+ while (*p && q < out + outlen - 4) {
|
||||||
|
+ /* When -8 flag is used, try UTF-8 processing first */
|
||||||
|
+ if (!mask_C1 && (*p & 0x80)) {
|
||||||
|
+ size_t len = utf8_len(p);
|
||||||
|
+
|
||||||
|
+ /* Check if we have a complete UTF-8 sequence */
|
||||||
|
+ if (len > 0 && q + len < out + outlen) {
|
||||||
|
+ size_t i = 0;
|
||||||
|
+
|
||||||
|
+ /* Ensure we have enough input bytes */
|
||||||
|
+ while (i < len && p[i] != '\0')
|
||||||
|
+ i++;
|
||||||
|
+
|
||||||
|
+ if (i == len && utf8_valid(p, len)) {
|
||||||
|
+ /* Copy the entire valid UTF-8 sequence */
|
||||||
|
+ for (i = 0; i < len; i++)
|
||||||
|
+ *q++ = *p++;
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ /* Fall through to byte-by-byte processing for invalid UTF-8 */
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Byte-by-byte processing */
|
||||||
|
+ c = *p++;
|
||||||
|
+
|
||||||
|
if (mask_C1 && (c & 0x80) && c < 0xA0) {
|
||||||
|
c &= 0x7F;
|
||||||
|
*q++ = 'M';
|
||||||
|
--
|
||||||
|
2.43.0
|
||||||
|
|
||||||
@@ -398,7 +398,7 @@ err_abandon:
|
|||||||
static int cand(sr_session_ctx_t *session, uint32_t sub_id, const char *module,
|
static int cand(sr_session_ctx_t *session, uint32_t sub_id, const char *module,
|
||||||
const char *path, sr_event_t event, unsigned request_id, void *priv)
|
const char *path, sr_event_t event, unsigned request_id, void *priv)
|
||||||
{
|
{
|
||||||
const char *fmt = "/infix-dhcp-server:dhcp-server/option[id='%s']/address";
|
const char *fmt = CFG_XPATH "/option[id='%s']/address";
|
||||||
sr_val_t inferred = { .type = SR_STRING_T };
|
sr_val_t inferred = { .type = SR_STRING_T };
|
||||||
const char *opt[] = {
|
const char *opt[] = {
|
||||||
"router",
|
"router",
|
||||||
@@ -409,7 +409,7 @@ static int cand(sr_session_ctx_t *session, uint32_t sub_id, const char *module,
|
|||||||
if (event != SR_EV_UPDATE && event != SR_EV_CHANGE)
|
if (event != SR_EV_UPDATE && event != SR_EV_CHANGE)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (srx_nitems(session, &cnt, "/infix-dhcp-server:dhcp-server/option") || cnt)
|
if (srx_nitems(session, &cnt, CFG_XPATH "/option") || cnt)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (i = 0; i < NELEMS(opt); i++) {
|
for (i = 0; i < NELEMS(opt); i++) {
|
||||||
@@ -422,7 +422,7 @@ static int cand(sr_session_ctx_t *session, uint32_t sub_id, const char *module,
|
|||||||
|
|
||||||
static int clear_stats(sr_session_ctx_t *session, uint32_t sub_id, const char *xpath,
|
static int clear_stats(sr_session_ctx_t *session, uint32_t sub_id, const char *xpath,
|
||||||
const sr_val_t *input, const size_t input_cnt, sr_event_t event,
|
const sr_val_t *input, const size_t input_cnt, sr_event_t event,
|
||||||
unsigned request_id, sr_val_t **output, size_t *output_cnt, void *priv)
|
uint32_t request_id, sr_val_t **output, size_t *output_cnt, void *priv)
|
||||||
{
|
{
|
||||||
if (systemf("dbus-send --system --dest=uk.org.thekelleys.dnsmasq "
|
if (systemf("dbus-send --system --dest=uk.org.thekelleys.dnsmasq "
|
||||||
"/uk/org/thekelleys/dnsmasq uk.org.thekelleys.dnsmasq.ClearMetrics"))
|
"/uk/org/thekelleys/dnsmasq uk.org.thekelleys.dnsmasq.ClearMetrics"))
|
||||||
@@ -436,7 +436,7 @@ int infix_dhcp_server_init(struct confd *confd)
|
|||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REGISTER_CHANGE(confd->session, MODULE, CFG_XPATH, 0, change, confd, &confd->sub);
|
REGISTER_CHANGE(confd->session, MODULE, CFG_XPATH, 0, change, confd, &confd->sub);
|
||||||
REGISTER_CHANGE(confd->cand, MODULE, CFG_XPATH"//.", SR_SUBSCR_UPDATE, cand, confd, &confd->sub);
|
REGISTER_CHANGE(confd->cand, MODULE, CFG_XPATH "//.", SR_SUBSCR_UPDATE, cand, confd, &confd->sub);
|
||||||
REGISTER_RPC(confd->session, CFG_XPATH "/statistics/clear", clear_stats, NULL, &confd->sub);
|
REGISTER_RPC(confd->session, CFG_XPATH "/statistics/clear", clear_stats, NULL, &confd->sub);
|
||||||
|
|
||||||
return SR_ERR_OK;
|
return SR_ERR_OK;
|
||||||
|
|||||||
@@ -317,8 +317,7 @@
|
|||||||
<COMMAND name="software" help="Show software info">
|
<COMMAND name="software" help="Show software info">
|
||||||
<SWITCH name="optional" min="0" max="1">
|
<SWITCH name="optional" min="0" max="1">
|
||||||
<COMMAND name="name" help="Show detailed info about a partition">
|
<COMMAND name="name" help="Show detailed info about a partition">
|
||||||
<PARAM name="name" ptype="/STRING" help="Partition name">
|
<PARAM name="name" ptype="/STRING" help="Partition name" />
|
||||||
</PARAM>
|
|
||||||
</COMMAND>
|
</COMMAND>
|
||||||
</SWITCH>
|
</SWITCH>
|
||||||
<ACTION sym="script">
|
<ACTION sym="script">
|
||||||
@@ -389,8 +388,7 @@
|
|||||||
<COMMAND name="interfaces" help="Show interface info">
|
<COMMAND name="interfaces" help="Show interface info">
|
||||||
<SWITCH name="optional" min="0" max="1">
|
<SWITCH name="optional" min="0" max="1">
|
||||||
<COMMAND name="name" help="Show detailed info about NAME">
|
<COMMAND name="name" help="Show detailed info about NAME">
|
||||||
<PARAM name="name" ptype="/IFACES" help="Interface.">
|
<PARAM name="name" ptype="/IFACES" help="Interface." />
|
||||||
</PARAM>
|
|
||||||
</COMMAND>
|
</COMMAND>
|
||||||
</SWITCH>
|
</SWITCH>
|
||||||
<ACTION sym="script" in="tty" out="tty" interrupt="true">
|
<ACTION sym="script" in="tty" out="tty" interrupt="true">
|
||||||
@@ -555,6 +553,19 @@
|
|||||||
</ACTION>
|
</ACTION>
|
||||||
</COMMAND>
|
</COMMAND>
|
||||||
|
|
||||||
|
<COMMAND name="terminal" help="Control the terminal (tty)" mode="switch">
|
||||||
|
<COMMAND name="reset" help="Reset terminal settings in case they are garbled">
|
||||||
|
<ACTION sym="script" in="tty" out="tty" interrupt="true">
|
||||||
|
reset
|
||||||
|
</ACTION>
|
||||||
|
</COMMAND>
|
||||||
|
<COMMAND name="resize" help="Force detect size change after terminal resize">
|
||||||
|
<ACTION sym="script" in="tty" out="tty" interrupt="true">
|
||||||
|
resize >/dev/null
|
||||||
|
</ACTION>
|
||||||
|
</COMMAND>
|
||||||
|
</COMMAND>
|
||||||
|
|
||||||
<COMMAND name="tcpdump" help="Capture network traffic">
|
<COMMAND name="tcpdump" help="Capture network traffic">
|
||||||
<PARAM name="iface" ptype="/IFACES" help="Interrface to run capture on"/>
|
<PARAM name="iface" ptype="/IFACES" help="Interrface to run capture on"/>
|
||||||
<SWITCH name="optional" min="0" max="7">
|
<SWITCH name="optional" min="0" max="7">
|
||||||
|
|||||||
@@ -4,23 +4,19 @@ ifdef::topdoc[:imagesdir: {topdoc}../../test/case/ietf_interfaces/igmp_vlan]
|
|||||||
|
|
||||||
==== Description
|
==== Description
|
||||||
|
|
||||||
Test tagged IGMP control traffic and that VLAN separation is respected for multicast
|
Verify VLAN tagged IGMP control traffic and that VLAN separation is respected for multicast.
|
||||||
|
|
||||||
....
|
....
|
||||||
VLAN55 VLAN77 VLAN55 VLAN77
|
vlan55 10.0.1.1 vlan77 10.0.2.1 vlan55 10.0.1.2 vlan77 10.0.2.2
|
||||||
10.0.1.1 10.0.2.1 10.0.1.2 10.0.2.2
|
|
||||||
\ / \ /
|
\ / \ /
|
||||||
\--------------/ VLAN 1,2 T \---------------/
|
.--------------. VLAN 1,2 T .---------------.
|
||||||
| DUT1 +---------------------------------+ DUT2 |
|
| DUT1 link +--------------------------------+ link DUT2 |
|
||||||
| |dut1:link dut2:link| |
|
'-+----------+-' '-+-----------+-'
|
||||||
+--------------+ +-----+---------+
|
data1 | 55U 77U | data2 data1 | 55U 77U | data2
|
||||||
dut1:data1| |dut1:data2 dut2:data1| |dut2:data2
|
.-------' '---. | '-------.
|
||||||
VLAN55 U | | VLAN77 U VLAN55 U | | VLAN77 U
|
.----+--. .-+--------. .-------+--. .--+----.
|
||||||
| | | |
|
| msend | 10.0.1.11 | mreceive | 10.0.2.11 | mreceive | 10.0.1.22 | msend | 10.0.2.22
|
||||||
+-------+ | +----------+ +------------+ +--------+
|
'-------' '----------' '----------' '-------'
|
||||||
| msend +--+ | mreceive | | mreceive | | msend |
|
|
||||||
+-------+ +----------+ +------------+ +--------+
|
|
||||||
10.0.1.11 10.0.2.11 10.0.1.22 10.0.2.22
|
|
||||||
....
|
....
|
||||||
|
|
||||||
==== Topology
|
==== Topology
|
||||||
@@ -31,8 +27,7 @@ image::topology.svg[IGMP VLAN topology, align=center, scaledwidth=75%]
|
|||||||
|
|
||||||
. Set up topology and attach to target DUT
|
. Set up topology and attach to target DUT
|
||||||
. Configure device
|
. Configure device
|
||||||
. Start multicast sender on host:data11, group 224.2.2.2
|
. Start multicast senders on host:data11, group 224.2.2.2, and host:data22, group 224.1.1.1
|
||||||
. Start multicast sender on host:data22, group 224.1.1.1
|
|
||||||
. Verify group 224.2.2.2 is flooded to host:data21
|
. Verify group 224.2.2.2 is flooded to host:data21
|
||||||
. Verify group 224.1.1.1 is flooded to host:data12
|
. Verify group 224.1.1.1 is flooded to host:data12
|
||||||
. Verify group 224.2.2.2 on host:data11, 224.1.1.1 on host:data21, 224.2.2.2 on host:data12 and 224.1.1.1 on host:data22 is not received
|
. Verify group 224.2.2.2 on host:data11, 224.1.1.1 on host:data21, 224.2.2.2 on host:data12 and 224.1.1.1 on host:data22 is not received
|
||||||
|
|||||||
@@ -1,26 +1,20 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
r"""
|
r"""IGMP VLAN
|
||||||
IGMP VLAN
|
|
||||||
|
|
||||||
Test tagged IGMP control traffic and that VLAN separation is respected for multicast
|
Verify VLAN tagged IGMP control traffic and that VLAN separation is respected for multicast.
|
||||||
|
|
||||||
....
|
....
|
||||||
VLAN55 VLAN77 VLAN55 VLAN77
|
vlan55 10.0.1.1 vlan77 10.0.2.1 vlan55 10.0.1.2 vlan77 10.0.2.2
|
||||||
10.0.1.1 10.0.2.1 10.0.1.2 10.0.2.2
|
|
||||||
\ / \ /
|
\ / \ /
|
||||||
\--------------/ VLAN 1,2 T \---------------/
|
.--------------. VLAN 1,2 T .---------------.
|
||||||
| DUT1 +---------------------------------+ DUT2 |
|
| DUT1 link +--------------------------------+ link DUT2 |
|
||||||
| |dut1:link dut2:link| |
|
'-+----------+-' '-+-----------+-'
|
||||||
+--------------+ +-----+---------+
|
data1 | 55U 77U | data2 data1 | 55U 77U | data2
|
||||||
dut1:data1| |dut1:data2 dut2:data1| |dut2:data2
|
.-------' '---. | '-------.
|
||||||
VLAN55 U | | VLAN77 U VLAN55 U | | VLAN77 U
|
.----+--. .-+--------. .-------+--. .--+----.
|
||||||
| | | |
|
| msend | 10.0.1.11 | mreceive | 10.0.2.11 | mreceive | 10.0.1.22 | msend | 10.0.2.22
|
||||||
+-------+ | +----------+ +------------+ +--------+
|
'-------' '----------' '----------' '-------'
|
||||||
| msend +--+ | mreceive | | mreceive | | msend |
|
|
||||||
+-------+ +----------+ +------------+ +--------+
|
|
||||||
10.0.1.11 10.0.2.11 10.0.1.22 10.0.2.22
|
|
||||||
....
|
....
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import infamy
|
import infamy
|
||||||
@@ -262,11 +256,9 @@ with infamy.Test() as test:
|
|||||||
d2send_ns.addip("10.0.2.22")
|
d2send_ns.addip("10.0.2.22")
|
||||||
d1send_ns.must_reach("10.0.1.2")
|
d1send_ns.must_reach("10.0.1.2")
|
||||||
d1receive_ns.must_reach("10.0.2.2")
|
d1receive_ns.must_reach("10.0.2.2")
|
||||||
with test.step("Start multicast sender on host:data11, group 224.2.2.2"):
|
with test.step("Start multicast senders on host:data11, group 224.2.2.2, and host:data22, group 224.1.1.1"):
|
||||||
vlan55_sender = mcast.MCastSender(d2send_ns, "224.2.2.2")
|
vlan55_sender = mcast.MCastSender(d2send_ns, "224.2.2.2")
|
||||||
with test.step("Start multicast sender on host:data22, group 224.1.1.1"):
|
vlan77_sender = mcast.MCastSender(d1send_ns, "224.1.1.1")
|
||||||
vlan77_sender= mcast.MCastSender(d1send_ns, "224.1.1.1")
|
|
||||||
|
|
||||||
|
|
||||||
with vlan55_sender, vlan77_sender:
|
with vlan55_sender, vlan77_sender:
|
||||||
with test.step("Verify group 224.2.2.2 is flooded to host:data21"):
|
with test.step("Verify group 224.2.2.2 is flooded to host:data21"):
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""
|
"""Container Basic
|
||||||
Container basic
|
|
||||||
|
|
||||||
Verify that a simple web server container can be configured to run
|
Verify that a simple web server container can be configured to run
|
||||||
with host networking, on port 80. Operation is verified using a
|
with host networking, on port 80. Operation is verified using a
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ ifdef::topdoc[:imagesdir: {topdoc}../../test/case/infix_containers/container_fir
|
|||||||
==== Description
|
==== Description
|
||||||
|
|
||||||
Verify that an nftables container can be used for IP masquerading and
|
Verify that an nftables container can be used for IP masquerading and
|
||||||
port forwarding to another container running a basic web server.
|
port forwarding to another container.
|
||||||
|
|
||||||
....
|
....
|
||||||
<--- Docker containers --->
|
<--- Docker containers --->
|
||||||
@@ -24,10 +24,9 @@ network, using a VETH pair, serving HTTP on port 91.
|
|||||||
The firewall container sets up a port forward with IP masquerding
|
The firewall container sets up a port forward with IP masquerding
|
||||||
to/from `ext0:8080` to 10.0.0.2:91.
|
to/from `ext0:8080` to 10.0.0.2:91.
|
||||||
|
|
||||||
Correct operation is verified using HTTP GET requests for internal port
|
Operation is verified using HTTP GET requests for internal port 91 and
|
||||||
91 and external port 8080, to ensure the web page, with a known key
|
external port 8080 to ensure the web page, with a known key phrase, is
|
||||||
phrase, is only reachable from the public interface `ext0`, on
|
only reachable from the public interface `ext0`, on 192.168.0.1:8080.
|
||||||
192.168.0.1:8080.
|
|
||||||
|
|
||||||
==== Topology
|
==== Topology
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
r"""Basic Firewall Container
|
r"""Basic Firewall Container
|
||||||
|
|
||||||
Verify that an nftables container can be used for IP masquerading and
|
Verify that an nftables container can be used for IP masquerading and
|
||||||
port forwarding to another container running a basic web server.
|
port forwarding to another container.
|
||||||
|
|
||||||
....
|
....
|
||||||
<--- Docker containers --->
|
<--- Docker containers --->
|
||||||
@@ -21,11 +21,9 @@ network, using a VETH pair, serving HTTP on port 91.
|
|||||||
The firewall container sets up a port forward with IP masquerding
|
The firewall container sets up a port forward with IP masquerding
|
||||||
to/from `ext0:8080` to 10.0.0.2:91.
|
to/from `ext0:8080` to 10.0.0.2:91.
|
||||||
|
|
||||||
Correct operation is verified using HTTP GET requests for internal port
|
Operation is verified using HTTP GET requests for internal port 91 and
|
||||||
91 and external port 8080, to ensure the web page, with a known key
|
external port 8080 to ensure the web page, with a known key phrase, is
|
||||||
phrase, is only reachable from the public interface `ext0`, on
|
only reachable from the public interface `ext0`, on 192.168.0.1:8080.
|
||||||
192.168.0.1:8080.
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
import infamy
|
import infamy
|
||||||
from infamy.util import until, to_binary
|
from infamy.util import until, to_binary
|
||||||
|
|||||||
@@ -23,21 +23,25 @@ disabled_root_login()
|
|||||||
# For all defconfigs
|
# For all defconfigs
|
||||||
check()
|
check()
|
||||||
{
|
{
|
||||||
local total=$#
|
total=$#
|
||||||
local num=1
|
num=1
|
||||||
local base=
|
base=
|
||||||
|
|
||||||
echo "1..$total"
|
echo "1..$total"
|
||||||
for defconfig in "$@"; do
|
for defconfig in "$@"; do
|
||||||
|
# Skip UNIX backup files
|
||||||
|
case "$defconfig" in
|
||||||
|
*~|*.bak|'#'*'#'|.#*)
|
||||||
|
continue
|
||||||
|
;;
|
||||||
|
esac
|
||||||
base=$(basename "$defconfig")
|
base=$(basename "$defconfig")
|
||||||
if disabled_root_login "$defconfig"; then
|
if whitelist "$base"; then
|
||||||
|
echo "ok $num - $base is exempted # skip"
|
||||||
|
elif disabled_root_login "$defconfig"; then
|
||||||
echo "ok $num - $base disables root logins"
|
echo "ok $num - $base disables root logins"
|
||||||
else
|
else
|
||||||
if whitelist "$base"; then
|
echo "not ok $num - $base has not disabled root login"
|
||||||
echo "ok $num - $base is exempted # skip"
|
|
||||||
else
|
|
||||||
echo "not ok $num - $base has not disabled root login"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
num=$((num + 1))
|
num=$((num + 1))
|
||||||
done
|
done
|
||||||
|
|||||||
+3
-3
@@ -84,7 +84,7 @@ enable()
|
|||||||
{
|
{
|
||||||
local module=$1
|
local module=$1
|
||||||
local feature=$2
|
local feature=$2
|
||||||
echo "*** Enable feature $feature in $module."
|
#echo "*** Enable feature $feature in $module."
|
||||||
$SYSREPOCTL -c $module -e $feature -v2
|
$SYSREPOCTL -c $module -e $feature -v2
|
||||||
local rc=$?
|
local rc=$?
|
||||||
if [ $rc -ne 0 ]; then
|
if [ $rc -ne 0 ]; then
|
||||||
@@ -119,7 +119,7 @@ for module in "${MODULES[@]}"; do
|
|||||||
|
|
||||||
if [ -z "$SCTL_MODULE" ]; then
|
if [ -z "$SCTL_MODULE" ]; then
|
||||||
# prepare command to install module with all its features
|
# prepare command to install module with all its features
|
||||||
echo "*** Installing YANG model $name ..."
|
#echo "*** Installing YANG model $name ..."
|
||||||
install "$module"
|
install "$module"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
@@ -164,7 +164,7 @@ done
|
|||||||
|
|
||||||
# install all the new modules
|
# install all the new modules
|
||||||
if [ -n "${CMD_INSTALL}" ]; then
|
if [ -n "${CMD_INSTALL}" ]; then
|
||||||
printf "*** Installing YANG models ...\n%s" "$CMD_INSTALL"
|
printf "*** Installing YANG models from %s ...\n%s" "$(basename "$1")" "$CMD_INSTALL"
|
||||||
eval $CMD_INSTALL
|
eval $CMD_INSTALL
|
||||||
rc=$?
|
rc=$?
|
||||||
if [ $rc -ne 0 ]; then
|
if [ $rc -ne 0 ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user