Reapply annobin fixes for CRIU

Resolves: rhbz#2033446

Signed-off-by: Adrian Reber <areber@redhat.com>
This commit is contained in:
Adrian Reber 2022-05-09 16:32:07 +02:00
parent f139c55e98
commit d329a25a16
No known key found for this signature in database
GPG Key ID: 82C9378ED3C4906A
2 changed files with 6 additions and 67 deletions

View File

@ -1,64 +0,0 @@
From b9ae48172fff77d41b5cf19d334ccbe002ac0686 Mon Sep 17 00:00:00 2001
From: Adrian Reber <areber@redhat.com>
Date: Tue, 7 Dec 2021 09:10:14 +0000
Subject: [PATCH] util: make page-server IPv6 safe
The function run_tcp_server() was the last place CRIU was still using
the IPv4 only function inet_ntoa(). It was only used during a print, so
that it did not really break anything, but with this commit the output
is now no longer:
Accepted connection from 0.0.0.0:58396
but correctly displaying the IPv6 address
Accepted connection from ::1:58398
if connecting via IPv6.
Signed-off-by: Adrian Reber <areber@redhat.com>
---
criu/util.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/criu/util.c b/criu/util.c
index 2917102fd..822822186 100644
--- a/criu/util.c
+++ b/criu/util.c
@@ -1098,7 +1098,7 @@ out:
int run_tcp_server(bool daemon_mode, int *ask, int cfd, int sk)
{
int ret;
- struct sockaddr_in caddr;
+ struct sockaddr_storage caddr;
socklen_t clen = sizeof(caddr);
if (daemon_mode) {
@@ -1126,14 +1126,20 @@ int run_tcp_server(bool daemon_mode, int *ask, int cfd, int sk)
return -1;
if (sk >= 0) {
+ char port[6];
+ char address[INET6_ADDRSTRLEN];
*ask = accept(sk, (struct sockaddr *)&caddr, &clen);
if (*ask < 0) {
pr_perror("Can't accept connection to server");
goto err;
- } else
- pr_info("Accepted connection from %s:%u\n",
- inet_ntoa(caddr.sin_addr),
- (int)ntohs(caddr.sin_port));
+ }
+ ret = getnameinfo((struct sockaddr *)&caddr, clen, address, sizeof(address), port, sizeof(port),
+ NI_NUMERICHOST | NI_NUMERICSERV);
+ if (ret) {
+ pr_err("Failed converting address: %s\n", gai_strerror(ret));
+ goto err;
+ }
+ pr_info("Accepted connection from %s:%s\n", address, port);
close(sk);
}
--
2.34.1

View File

@ -7,7 +7,7 @@
Name: criu
Version: 3.17
Release: 1%{?dist}
Release: 2%{?dist}
Provides: crtools = %{version}-%{release}
Obsoletes: crtools <= 1.0-2
Summary: Tool for Checkpoint/Restore in User-space
@ -27,6 +27,8 @@ BuildRequires: make
# Checkpointing containers with a tmpfs requires tar
Recommends: tar
Patch0: 0001-Fix-building-with-annobin.patch
# user-space and kernel changes are only available for x86_64, arm,
# ppc64le, aarch64 and s390x
# https://bugzilla.redhat.com/show_bug.cgi?id=902875
@ -71,6 +73,7 @@ their content in human-readable form.
%prep
%setup -q
%patch0 -p1
%build
# %{?_smp_mflags} does not work
@ -121,9 +124,9 @@ rm $RPM_BUILD_ROOT%{_mandir}/man1/criu-ns.1*
%doc %{_mandir}/man1/crit.1*
%changelog
* Mon May 09 2022 Adrian Reber <areber@redhat.com> - 3.17-1
* Mon May 09 2022 Adrian Reber <areber@redhat.com> - 3.17-2
- Update to 3.17
- Drop upstreamed patches
- Drop upstreamed patch
- Remove compel man-page
* Mon Jan 31 2022 Adrian Reber <areber@redhat.com> - 3.15-13