!30 update iputils to 20210722

Merge pull request !30 from haochen/openEuler-22.03-LTS-Next
This commit is contained in:
openeuler-ci-bot 2021-12-14 07:44:32 +00:00 committed by Gitee
commit 6fd2cc725c
8 changed files with 128 additions and 233 deletions

View File

@ -1,34 +0,0 @@
diff --git a/ping/ping.c b/ping/ping.c
index e277697..d96298e 100644
--- a/ping/ping.c
+++ b/ping/ping.c
@@ -1314,8 +1314,11 @@ int ping4_receive_error_msg(struct ping_rts *rts, socket_st *sock)
msg.msg_controllen = sizeof(cbuf);
res = recvmsg(sock->fd, &msg, MSG_ERRQUEUE | MSG_DONTWAIT);
- if (res < 0)
+ if (res < 0) {
+ if (errno == EAGAIN || errno == EINTR)
+ local_errors++;
goto out;
+ }
e = NULL;
for (cmsgh = CMSG_FIRSTHDR(&msg); cmsgh; cmsgh = CMSG_NXTHDR(&msg, cmsgh)) {
diff --git a/ping/ping6_common.c b/ping/ping6_common.c
index 279c533..459f63e 100644
--- a/ping/ping6_common.c
+++ b/ping/ping6_common.c
@@ -481,8 +481,11 @@ int ping6_receive_error_msg(struct ping_rts *rts, socket_st *sock)
msg.msg_controllen = sizeof(cbuf);
res = recvmsg(sock->fd, &msg, MSG_ERRQUEUE | MSG_DONTWAIT);
- if (res < 0)
+ if (res < 0) {
+ if (errno == EAGAIN || errno == EINTR)
+ local_errors++;
goto out;
+ }
e = NULL;
for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) {

View File

@ -1,69 +0,0 @@
diff --git a/meson.build b/meson.build
index aff75a2..7281ccb 100644
--- a/meson.build
+++ b/meson.build
@@ -40,8 +40,10 @@ localedir = join_paths(prefix, get_option('localedir'))
sbindir = join_paths(prefix, get_option('sbindir'))
systemd = dependency('systemd', required : false)
+install_systemd_units = systemd.found() or get_option('INSTALL_SYSTEMD_UNITS')
+
systemdunitdir = get_option('systemdunitdir')
-if systemdunitdir == '' and systemd.found()
+if systemdunitdir == '' and install_systemd_units
systemdunitdir = systemd.get_pkgconfig_variable('systemdsystemunitdir')
endif
@@ -280,7 +282,7 @@ if build_rdisc == true
install_dir: sbindir,
link_with : [libcommon],
install: true)
- if systemd.found()
+ if install_systemd_units
subs = configuration_data()
subs.set('sbindir', sbindir)
unit_file = configure_file(
@@ -316,7 +318,7 @@ if build_rarpd == true
install_dir: sbindir,
link_with : [libcommon],
install: true)
- if systemd.found()
+ if install_systemd_units
subs = configuration_data()
subs.set('sbindir', sbindir)
unit_file = configure_file(
@@ -359,7 +361,7 @@ output += '\nCONFIGURATION\n'
output += 'Capatiblity (with libcap): ' + cap.to_string() + '\n'
output += 'IDN (with libidn2): ' + idn.to_string() + '\n'
output += 'I18N (with gettext): ' + gettext.to_string() + '\n'
-output += 'systemd: ' + systemd.found().to_string() + '\n'
+output += 'systemd: ' + install_systemd_units.to_string() + '\n'
output += '\nSYSTEM PATHS\n'
output += 'prefix: ' + prefix + '\n'
diff --git a/meson_options.txt b/meson_options.txt
index aade675..c806d80 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -64,5 +64,8 @@ option('ARPING_DEFAULT_DEVICE', type : 'string', value : '',
option('systemdunitdir', type: 'string', value: '',
description: 'Directory for systemd units')
+option('INSTALL_SYSTEMD_UNITS', type: 'boolean', value: false,
+ description: 'Install generated systemd unit files')
+
option('USE_GETTEXT', type: 'boolean', value: true,
description: 'Enable I18N')
diff --git a/ninfod/meson.build b/ninfod/meson.build
index 80b0a44..770169a 100644
--- a/ninfod/meson.build
+++ b/ninfod/meson.build
@@ -18,7 +18,7 @@ executable('ninfod', [ninfod_sources, git_version_h],
conf_data = configuration_data()
conf_data.set('prefix', prefix)
-if systemd.found()
+if install_systemd_units
subs = configuration_data()
subs.set('sbindir', sbindir)
unit_file = configure_file(

View File

@ -1,77 +0,0 @@
From 86ed08936d49e2c81ef49dfbd02aca1c74d0c098 Mon Sep 17 00:00:00 2001
From: lac-0073 <61903197+lac-0073@users.noreply.github.com>
Date: Mon, 26 Oct 2020 09:45:42 +0800
Subject: [PATCH] arpping: make update neighbours work again
The arping is using inconsistent sender_ip_addr and target_ip_addr in
messages. This causes the client receiving the arp message not to update
the arp table entries.
The specific performance is as follows:
There is a machine 2 with IP 10.20.30.3 configured on eth0:0 that is in the
same IP subnet as eth0. This IP was originally used on another machine 1,
and th IP needs to be changed back to the machine 1. When using the arping
command to announce what ethernet address has IP 10.20.30.3, the arp table
on machine 3 is not updated.
Machine 3 original arp table:
10.20.30.3 machine 2 eth0:0 00:00:00:00:00:02
10.20.30.2 machine 2 eth0 00:00:00:00:00:02
10.20.30.1 machine 1 eth0 00:00:00:00:00:01
Create interface eth0:0 on machine 1, and use the arping command to send arp
packets. Expected outcome on machine 3:
10.20.30.3 machine 1 eth0:0 00:00:00:00:00:01
10.20.30.2 machine 2 eth0 00:00:00:00:00:02
10.20.30.1 machine 1 eth0 00:00:00:00:00:01
Actual results on machine 3:
10.20.30.3 machine 2 eth0:0 00:00:00:00:00:02
10.20.30.2 machine 2 eth0 00:00:00:00:00:02
10.20.30.1 machine 1 eth0 00:00:00:00:00:01
Fixes: https://github.com/iputils/iputils/issues/298
Fixes: 68f12fc4a0dbef4ae4c404da24040d22c5a14339
Signed-off-by: Aichun Li <liaichun@huawei.com>
---
arping.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/arping.c b/arping.c
index a002786..53fdbb4 100644
--- a/arping.c
+++ b/arping.c
@@ -968,7 +968,7 @@ int main(int argc, char **argv)
}
memset(&saddr, 0, sizeof(saddr));
saddr.sin_family = AF_INET;
- if (!ctl.unsolicited && (ctl.source || ctl.gsrc.s_addr)) {
+ if (ctl.source || ctl.gsrc.s_addr) {
saddr.sin_addr = ctl.gsrc;
if (bind(probe_fd, (struct sockaddr *)&saddr, sizeof(saddr)) == -1)
error(2, errno, "bind");
@@ -979,12 +979,14 @@ int main(int argc, char **argv)
saddr.sin_port = htons(1025);
saddr.sin_addr = ctl.gdst;
- if (setsockopt(probe_fd, SOL_SOCKET, SO_DONTROUTE, (char *)&on, sizeof(on)) == -1)
- error(0, errno, _("WARNING: setsockopt(SO_DONTROUTE)"));
- if (connect(probe_fd, (struct sockaddr *)&saddr, sizeof(saddr)) == -1)
- error(2, errno, "connect");
- if (getsockname(probe_fd, (struct sockaddr *)&saddr, &alen) == -1)
- error(2, errno, "getsockname");
+ if (!ctl.unsolicited) {
+ if (setsockopt(probe_fd, SOL_SOCKET, SO_DONTROUTE, (char *)&on, sizeof(on)) == -1)
+ error(0, errno, _("WARNING: setsockopt(SO_DONTROUTE)"));
+ if (connect(probe_fd, (struct sockaddr *)&saddr, sizeof(saddr)) == -1)
+ error(2, errno, "connect");
+ if (getsockname(probe_fd, (struct sockaddr *)&saddr, &alen) == -1)
+ error(2, errno, "getsockname");
+ }
ctl.gsrc = saddr.sin_addr;
}
close(probe_fd);

View File

@ -1,37 +0,0 @@
From 21d0826711b750367edaf01645aac1d03b3b7611 Mon Sep 17 00:00:00 2001
From: Sami Kerola <kerolasa@iki.fi>
Date: Wed, 3 Mar 2021 20:51:18 +0000
Subject: [PATCH] rdisc: remove PrivateUsers=yes from systemd service file
Quoting systemd.exec(5) manual page 'Specifically this means that the
process will have zero process capabilities on the host's user namespace'.
That does not combine will with CAP_NET_RAW that needs to take effect host's
namespace.
Secondly add CapabilityBoundingSet that is will ensure capabilities are
limited to the one and only capability it needs.
Fixes: https://github.com/iputils/iputils/issues/314
Reference: https://www.freedesktop.org/software/systemd/man/systemd.exec.html#PrivateUsers=
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
systemd/rdisc.service.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/systemd/rdisc.service.in b/systemd/rdisc.service.in
index 4e2a1ec..6ef7fc3 100644
--- a/systemd/rdisc.service.in
+++ b/systemd/rdisc.service.in
@@ -9,8 +9,8 @@ EnvironmentFile=-/etc/sysconfig/rdisc
ExecStart=@sbindir@/rdisc -f -t $OPTIONS $SEND_ADDRESS $RECEIVE_ADDRESS
AmbientCapabilities=CAP_NET_RAW
+CapabilityBoundingSet=CAP_NET_RAW
PrivateTmp=yes
-PrivateUsers=yes
ProtectSystem=strict
ProtectHome=yes
ProtectControlGroups=yes
--
2.23.0

View File

@ -0,0 +1,87 @@
From a38091c8eb0c515441080806975856ee09d2edc7 Mon Sep 17 00:00:00 2001
From: Jan Macku <jamacku@redhat.com>
Date: Tue, 23 Mar 2021 08:10:10 +0100
Subject: [PATCH] ifenslave: fix CWE-170: Improper Null Termination
---
ifenslave.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/ifenslave.c b/ifenslave.c
index ddd82ec..1efe4f1 100644
--- a/ifenslave.c
+++ b/ifenslave.c
@@ -509,21 +509,24 @@ static int if_getconfig(char *ifname)
struct sockaddr dstaddr, broadaddr, netmask;
unsigned char *hwaddr;
- strcpy(ifr.ifr_name, ifname);
+ memset(&ifr, 0, sizeof(ifr));
+ strncpy(ifr.ifr_name, ifname, IFNAMSIZ - 1);
if (ioctl(skfd, SIOCGIFFLAGS, &ifr) < 0)
return -1;
mif_flags = ifr.ifr_flags;
printf("The result of SIOCGIFFLAGS on %s is %x.\n",
ifname, ifr.ifr_flags);
- strcpy(ifr.ifr_name, ifname);
+ memset(&ifr, 0, sizeof(ifr));
+ strncpy(ifr.ifr_name, ifname, IFNAMSIZ - 1);
if (ioctl(skfd, SIOCGIFADDR, &ifr) < 0)
return -1;
printf("The result of SIOCGIFADDR is %2.2x.%2.2x.%2.2x.%2.2x.\n",
ifr.ifr_addr.sa_data[2], ifr.ifr_addr.sa_data[3],
ifr.ifr_addr.sa_data[4], ifr.ifr_addr.sa_data[5]);
- strcpy(ifr.ifr_name, ifname);
+ memset(&ifr, 0, sizeof(ifr));
+ strncpy(ifr.ifr_name, ifname, IFNAMSIZ - 1);
if (ioctl(skfd, SIOCGIFHWADDR, &ifr) < 0)
return -1;
@@ -534,33 +537,38 @@ static int if_getconfig(char *ifname)
ifr.ifr_hwaddr.sa_family, hwaddr[0], hwaddr[1],
hwaddr[2], hwaddr[3], hwaddr[4], hwaddr[5]);
- strcpy(ifr.ifr_name, ifname);
+ memset(&ifr, 0, sizeof(ifr));
+ strncpy(ifr.ifr_name, ifname, IFNAMSIZ - 1);
if (ioctl(skfd, SIOCGIFMETRIC, &ifr) < 0) {
metric = 0;
} else
metric = ifr.ifr_metric;
printf("The result of SIOCGIFMETRIC is %d\n", metric);
- strcpy(ifr.ifr_name, ifname);
+ memset(&ifr, 0, sizeof(ifr));
+ strncpy(ifr.ifr_name, ifname, IFNAMSIZ - 1);
if (ioctl(skfd, SIOCGIFMTU, &ifr) < 0)
mtu = 0;
else
mtu = ifr.ifr_mtu;
printf("The result of SIOCGIFMTU is %d\n", mtu);
- strcpy(ifr.ifr_name, ifname);
+ memset(&ifr, 0, sizeof(ifr));
+ strncpy(ifr.ifr_name, ifname, IFNAMSIZ - 1);
if (ioctl(skfd, SIOCGIFDSTADDR, &ifr) < 0) {
memset(&dstaddr, 0, sizeof(struct sockaddr));
} else
dstaddr = ifr.ifr_dstaddr;
- strcpy(ifr.ifr_name, ifname);
+ memset(&ifr, 0, sizeof(ifr));
+ strncpy(ifr.ifr_name, ifname, IFNAMSIZ - 1);
if (ioctl(skfd, SIOCGIFBRDADDR, &ifr) < 0) {
memset(&broadaddr, 0, sizeof(struct sockaddr));
} else
broadaddr = ifr.ifr_broadaddr;
- strcpy(ifr.ifr_name, ifname);
+ memset(&ifr, 0, sizeof(ifr));
+ strncpy(ifr.ifr_name, ifname, IFNAMSIZ - 1);
if (ioctl(skfd, SIOCGIFNETMASK, &ifr) < 0) {
memset(&netmask, 0, sizeof(struct sockaddr));
} else
--
2.29.2

Binary file not shown.

BIN
iputils-s20210722.tar.gz Normal file

Binary file not shown.

View File

@ -1,6 +1,6 @@
Name: iputils Name: iputils
Version: 20200821 Version: 20210722
Release: 2 Release: 1
Summary: Network monitoring tools including ping Summary: Network monitoring tools including ping
License: BSD and GPLv2+ License: BSD and GPLv2+
URL: https://github.com/iputils/iputils URL: https://github.com/iputils/iputils
@ -14,18 +14,12 @@ Source5: https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
Patch0000: iputils-ifenslave.patch Patch0000: iputils-ifenslave.patch
Patch0001: bugfix-arping-w-does-not-take-effect.patch Patch0001: bugfix-arping-w-does-not-take-effect.patch
Patch0002: bugfix-arpping-make-update-neighbours-work-again.patch Patch0002: iputils-ifenslave-CWE-170.patch
Patch6000: 2583fb77dd57c5183998177a3fa13a680b573005.patch
Patch6001: 950d36f8ba5a669cbc34a7972db611b675725fb5.patch
Patch6002: bugfix-rdisc-remove-PrivateUsers=yes-from-systemd-service-file.patch
BuildRequires: gcc meson libidn2-devel openssl-devel libcap-devel libxslt BuildRequires: gcc meson libidn2-devel openssl-devel libcap-devel libxslt
BuildRequires: docbook5-style-xsl systemd glibc-kernheaders gettext BuildRequires: docbook5-style-xsl systemd iproute glibc-kernheaders gettext
%{?systemd_ordering} %{?systemd_ordering}
Provides: /bin/ping /bin/ping6 /sbin/arping /sbin/rdisc Provides: /bin/ping /bin/ping6 /sbin/arping /sbin/rdisc
Provides: %{name}-ninfod
Obsoletes: %{name}-ninfod
Provides: %{_sbindir}/ninfod
%description %description
The iputils package contains basic utilities for monitoring a network, The iputils package contains basic utilities for monitoring a network,
@ -35,8 +29,17 @@ the target machine is alive and receiving network traffic.
%package_help %package_help
%package ninfod
Summary: Node Information Query Daemon
Requires: %{name} = %{version}-%{release}
Provides: %{_sbindir}/ninfod
%description ninfod
Node Information Query (RFC4620) daemon. Responds to IPv6 Node Information
Queries.
%prep %prep
%setup -q -a 1 -n %{name}-s%{version} %setup -q -a 1 -n %{name}-%{version}
cp %{SOURCE4} %{SOURCE5} . cp %{SOURCE4} %{SOURCE5} .
%autopatch -p1 %autopatch -p1
@ -47,7 +50,7 @@ cp %{SOURCE4} %{SOURCE5} .
%meson -DBUILD_TFTPD=false %meson -DBUILD_TFTPD=false
%meson_build %meson_build
gcc -Wall $RPM_OPT_FLAGS $CFLAGS $LDFLAGS ifenslave.c -o ifenslave gcc -Wall $RPM_OPT_FLAGS $CFLAGS $RPM_LD_FLAGS $LDFLAGS ifenslave.c -o ifenslave
%install %install
%meson_install %meson_install
@ -65,14 +68,20 @@ install -cp ifenslave.8 ${RPM_BUILD_ROOT}%{_mandir}/man8/
%post %post
%systemd_post rdisc.service %systemd_post rdisc.service
%systemd_post ninfod.service
%preun %preun
%systemd_preun rdisc.service %systemd_preun rdisc.service
%systemd_preun ninfod.service
%postun %postun
%systemd_postun_with_restart rdisc.service %systemd_postun_with_restart rdisc.service
%post ninfod
%systemd_post ninfod.service
%preun ninfod
%systemd_preun ninfod.service
%postun ninfod
%systemd_postun_with_restart ninfod.service %systemd_postun_with_restart ninfod.service
%files %files
@ -83,17 +92,33 @@ install -cp ifenslave.8 ${RPM_BUILD_ROOT}%{_mandir}/man8/
%attr(0755,root,root) %caps(cap_net_raw=p cap_net_admin=p) %{_bindir}/ping %attr(0755,root,root) %caps(cap_net_raw=p cap_net_admin=p) %{_bindir}/ping
%attr(0755,root,root) %caps(cap_net_raw=ep) %{_sbindir}/ninfod %attr(0755,root,root) %caps(cap_net_raw=ep) %{_sbindir}/ninfod
%{_datadir}/locale/* %{_datadir}/locale/*
%{_sbindir}/* %{_sbindir}/ifenslave
%{_sbindir}/rdisc
%{_bindir}/tracepath
%{_sbindir}/ping
%{_sbindir}/ping6
%{_sbindir}/tracepath
%{_sbindir}/tracepath6
%{_sbindir}/arping
%{_bindir}/tracepath %{_bindir}/tracepath
%{_unitdir}/rdisc.service %{_unitdir}/rdisc.service
%{_unitdir}/ninfod.service
%files help %files help
%defattr(-,root,root) %defattr(-,root,root)
%doc README.bonding %doc README.bonding
%{_mandir}/man8/*.8.gz %{_mandir}/man8/*.8.gz
%files ninfod
%attr(0755,root,root) %caps(cap_net_raw=ep) %{_sbindir}/ninfod
%{_unitdir}/ninfod.service
%changelog %changelog
* Tue Dec 07 2021 xihaochen <xihaochen@huawei.com> - 20210722-1
- Type:requirements
- ID:NA
- SUG:NA
- DESC: update iputils to 20210722
* Mon Mar 8 2021 xuxiaolong <xuxiaolong23@huawei.com> - 20200821-2 * Mon Mar 8 2021 xuxiaolong <xuxiaolong23@huawei.com> - 20200821-2
- Type:bugfix - Type:bugfix
- ID:NA - ID:NA