Compare commits

..

No commits in common. "a7b85e125fd7279575c14fe3ed662272ba33c14d" and "54abb9c1216bc7076f78007c3f7fdeed319ee00e" have entirely different histories.

5 changed files with 90 additions and 75 deletions

View File

@ -0,0 +1,31 @@
diff -urN a/libknet/host.c b/libknet/host.c
--- a/libknet/host.c 2021-08-04 10:17:01.912099056 +0800
+++ b/libknet/host.c 2021-08-04 10:17:55.708739020 +0800
@@ -77,7 +77,7 @@
/*
* set default host->name to host_id for logging
*/
- snprintf(host->name, KNET_MAX_HOST_LEN - 1, "%u", host_id);
+ snprintf(host->name, KNET_MAX_HOST_LEN, "%u", host_id);
/*
* initialize links internal data
@@ -226,7 +226,7 @@
}
for (host = knet_h->host_head; host != NULL; host = host->next) {
- if (!strncmp(host->name, name, KNET_MAX_HOST_LEN - 1)) {
+ if (!strncmp(host->name, name, KNET_MAX_HOST_LEN)) {
err = -1;
savederrno = EEXIST;
log_err(knet_h, KNET_SUB_HOST, "Duplicated name found on host_id %u",
@@ -235,7 +235,7 @@
}
}
- snprintf(knet_h->host_index[host_id]->name, KNET_MAX_HOST_LEN - 1, "%s", name);
+ snprintf(knet_h->host_index[host_id]->name, KNET_MAX_HOST_LEN, "%s", name);
exit_unlock:
pthread_rwlock_unlock(&knet_h->global_rwlock);

BIN
kronosnet-1.13.tar.xz Normal file

Binary file not shown.

Binary file not shown.

View File

@ -7,28 +7,26 @@
%bcond_without lzma
%bcond_without bzip2
%bcond_without zstd
%bcond_with kronosnetd
%bcond_without libnozzle
%bcond_with runautogen
%bcond_with rpmdebuginfo
%bcond_with overriderpmdebuginfo
%bcond_without buildman
%bcond_with installtests
%if %{with overriderpmdebuginfo}
%undefine _enable_debug_packages
%endif
Name: kronosnet
Summary: Multipoint-to-Multipoint VPN daemon
Version: 1.28
Release: 2
Version: 1.13
Release: 3
License: GPLv2+ and LGPLv2+
URL: https://kronosnet.org
Source0: https://kronosnet.org/releases/%{name}-%{version}.tar.xz
Patch0: libknet-tests-fix-potential-overflow-with-sprintf.patch
BuildRequires: gcc chrpath make libqb-devel
BuildRequires: gcc
%if %{with buildman}
BuildRequires: libxml2-devel doxygen doxygen2man
BuildRequires: libqb-devel libxml2-devel doxygen
%endif
%if %{with sctp}
BuildRequires: lksctp-tools-devel
@ -57,6 +55,9 @@ BuildRequires: bzip2-devel
%if %{with zstd}
BuildRequires: libzstd-devel
%endif
%if %{with kronosnetd}
BuildRequires: pam-devel
%endif
%if %{with libnozzle}
BuildRequires: libnl3-devel
%endif
@ -64,8 +65,10 @@ BuildRequires: libnl3-devel
BuildRequires: autoconf automake libtool
%endif
Patch0001: backport-kronosnet-fix-format-truncation.patch
%prep
%autosetup -n %{name}-%{version} -p1
%autosetup -n kronosnet-%{version} -p1
%build
%if %{with runautogen}
@ -127,6 +130,11 @@ BuildRequires: autoconf automake libtool
%else
--disable-compress-zstd \
%endif
%if %{with kronosnetd}
--enable-kronosnetd \
%else
--disable-kronosnetd \
%endif
%if %{with libnozzle}
--enable-libnozzle \
%else
@ -143,21 +151,48 @@ find %{buildroot} -name "*.a" -exec rm {} \;
find %{buildroot} -name "*.la" -exec rm {} \;
rm -rf %{buildroot}/etc/init.d
rm -rf %{buildroot}/usr/share/doc/kronosnet
file `find %{buildroot}/%{_libdir} -type f` | grep -w ELF | awk -F: '{print $1}' | xargs chrpath -d
mkdir -p %{buildroot}/etc/ld.so.conf.d
echo "%{_libdir}/%{name}" > %{buildroot}/etc/ld.so.conf.d/%{name}-%{_arch}.conf
pushd %{buildroot}%{_prefix}/lib64/kronosnet
ls *.so | awk '{print $1}' | for line in `xargs`;do
%{__ln_s} %{_prefix}/lib64/kronosnet/$line %{buildroot}%{_prefix}/lib64/kronosnet/lib$line
done
popd
%description
The kronosnet source
%if %{with kronosnetd}
%package -n kronosnetd
Summary: Multipoint-to-Multipoint VPN daemon
License: GPLv2+
Requires(post): systemd-sysv
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
Requires(post): shadow-utils
Requires(preun): shadow-utils
Requires: pam, /etc/pam.d/passwd
%description -n kronosnetd
The kronosnet daemon is a bridge between kronosnet switching engine
and kernel network tap devices, to create and administer a
distributed LAN over multipoint-to-multipoint VPNs.
The daemon does a poor attempt to provide a configure UI similar
to other known network devices/tools (Cisco, quagga).
Beside looking horrific, it allows runtime changes and
reconfiguration of the kronosnet(s) without daemon reload
or service disruption.
%post -n kronosnetd
%systemd_post kronosnetd.service
getent group kronosnetadm >/dev/null || groupadd --force --system kronosnetadm
%preun -n kronosnetd
%systemd_preun kronosnetd.service
%files -n kronosnetd
%license COPYING.* COPYRIGHT
%dir %{_sysconfdir}/kronosnet
%dir %{_sysconfdir}/kronosnet/*
%config(noreplace) %{_sysconfdir}/sysconfig/kronosnetd
%config(noreplace) %{_sysconfdir}/pam.d/kronosnetd
%config(noreplace) %{_sysconfdir}/logrotate.d/kronosnetd
%{_unitdir}/kronosnetd.service
%{_sbindir}/*
%{_mandir}/man8/*
%endif
%if %{with libnozzle}
%package -n libnozzle1
@ -171,11 +206,12 @@ License: LGPLv2+
%files -n libnozzle1
%license COPYING.* COPYRIGHT
%{_libdir}/libnozzle.so.*
%config(noreplace) /etc/ld.so.conf.d/*
%if 0%{?ldconfig_scriptlets}
%ldconfig_scriptlets -n libnozzle1
%else
%post -n libnozzle1 -p /sbin/ldconfig
%postun -n libnozzle1 -p /sbin/ldconfig
%endif
@ -213,7 +249,9 @@ License: LGPLv2+
%if 0%{?ldconfig_scriptlets}
%ldconfig_scriptlets -n libknet1
%else
%post -n libknet1 -p /sbin/ldconfig
%postun -n libknet1 -p /sbin/ldconfig
%endif
@ -245,7 +283,6 @@ Requires: libknet1%{_isa} = %{version}-%{release}
%files -n libknet1-crypto-nss-plugin
%{_libdir}/kronosnet/crypto_nss.so
%{_prefix}/lib64/kronosnet/libcrypto_nss.so
%endif
%if %{with openssl}
@ -258,7 +295,6 @@ Requires: libknet1%{_isa} = %{version}-%{release}
%files -n libknet1-crypto-openssl-plugin
%{_libdir}/kronosnet/crypto_openssl.so
%{_prefix}/lib64/kronosnet/libcrypto_openssl.so
%endif
%if %{with zlib}
@ -271,7 +307,6 @@ Requires: libknet1%{_isa} = %{version}-%{release}
%files -n libknet1-compress-zlib-plugin
%{_libdir}/kronosnet/compress_zlib.so
%{_libdir}/kronosnet/libcompress_zlib.so
%endif
%if %{with lz4}
@ -285,8 +320,6 @@ Requires: libknet1%{_isa} = %{version}-%{release}
%files -n libknet1-compress-lz4-plugin
%{_libdir}/kronosnet/compress_lz4.so
%{_libdir}/kronosnet/compress_lz4hc.so
%{_libdir}/kronosnet/libcompress_lz4.so
%{_libdir}/kronosnet/libcompress_lz4hc.so
%endif
%if %{with lzo2}
@ -299,7 +332,6 @@ Requires: libknet1%{_isa} = %{version}-%{release}
%files -n libknet1-compress-lzo2-plugin
%{_libdir}/kronosnet/compress_lzo2.so
%{_libdir}/kronosnet/libcompress_lzo2.so
%endif
%if %{with lzma}
@ -312,7 +344,6 @@ Requires: libknet1%{_isa} = %{version}-%{release}
%files -n libknet1-compress-lzma-plugin
%{_libdir}/kronosnet/compress_lzma.so
%{_libdir}/kronosnet/libcompress_lzma.so
%endif
%if %{with bzip2}
@ -325,7 +356,6 @@ Requires: libknet1%{_isa} = %{version}-%{release}
%files -n libknet1-compress-bzip2-plugin
%{_libdir}/kronosnet/compress_bzip2.so
%{_libdir}/kronosnet/libcompress_bzip2.so
%endif
%if %{with zstd}
@ -338,7 +368,6 @@ Requires: libknet1%{_isa} = %{version}-%{release}
%files -n libknet1-compress-zstd-plugin
%{_libdir}/kronosnet/compress_zstd.so
%{_libdir}/kronosnet/libcompress_zstd.so
%endif
%package -n libknet1-crypto-plugins-all
@ -402,27 +431,11 @@ Requires: libknet1%{_isa} = %{version}-%{release}
%files -n kronosnet-tests
%{_libdir}/kronosnet/tests/*
%endif
%if %{with rpmdebuginfo}
%debug_package
%endif
%changelog
* Tue Mar 05 2024 zouzhimin <zouzhimin@kylinos.cn> - 1.28-2
- fix potential overflow with sprintf
* Thu Oct 26 2023 xu_ping <707078654@qq.com> - 1.28-1
- Update package to version 1.28
* Thu Jun 01 2023 zouzhimin <zouzhimin@kylinos.cn> - 1.24-1
- Update package to version 1.24
* Thu Feb 02 2023 jiangxinyu <jiangxinyu@kylinos.cn> - 1.22-1
- Update package to version 1.22
* Tue Nov 15 2022 Ge Wang <wangge20@h-partners.com> - 1.13-4
- fix epoll event size to scope with extra event on send to link
* Wed Aug 04 2021 Liu Yinsi <liuyinsi@163.com> - 1.13-3
- fix format-truncation to support gcc 10

View File

@ -1,29 +0,0 @@
From c8ef1946266f8ab4f4cdfb9675aad780087420c4 Mon Sep 17 00:00:00 2001
From: cglosner <cglosner@gmail.com>
Date: Sun, 26 Nov 2023 11:17:17 -0500
Subject: [PATCH] libknet/tests: fix potential overflow with sprintf
---
libknet/tests/knet_bench.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libknet/tests/knet_bench.c b/libknet/tests/knet_bench.c
index d9b9deea..674febb3 100644
--- a/libknet/tests/knet_bench.c
+++ b/libknet/tests/knet_bench.c
@@ -129,10 +129,10 @@ static void parse_nodes(char *nodesinfo[MAX_NODES], int onidx, int port, struct
{
int i;
char *temp = NULL;
- char port_str[10];
+ char port_str[11];
memset(port_str, 0, sizeof(port_str));
- sprintf(port_str, "%d", port);
+ snprintf(port_str, sizeof(port_str), "%d", port);
for (i = 0; i < onidx; i++) {
nodes[i].nodeid = atoi(strtok(nodesinfo[i], ","));
--
2.25.1