import xorg-x11-xtrans-devel-1.4.0-4.el8

This commit is contained in:
CentOS Sources 2022-09-27 17:24:35 -04:00 committed by Stepan Oksanichenko
parent bbddcd0ebf
commit 6ffbf1dee9
2 changed files with 126 additions and 3 deletions

View File

@ -0,0 +1,113 @@
From 8302f576f8b41f9aa95b091a9ef001ab5ddc2ef5 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Fri, 6 May 2022 14:23:59 -0400
Subject: [PATCH] Automatically disable inet6 transport if ipv6 is disabled on
machine
If a machine is booted with ipv6.disable=1, trying to bind to an
AF_INET6 socket will fail with AFNOSUPPORT.
The tcp transport automatically falls back to ipv4 in this case, but
the more specific inet6 transport just fails.
This failure leads to MakeAllCOTSServerListeners returning a partial
success.
Unfortunately, the X server can't really contiue with partial successes
from this function if -displayfd is in use, since that would, in other
cases, potentially lead to the -displayfd electing a display number that
is potentially partially in use by a rogue program.
This commit addresses the issue by automatically disabling transports
when they fail with AFNOSUPPORT, leading them to get ignored, rather than
proceeding and ultimately returning from MakeAllCOTSServerListerns with
partial=TRUE.
---
Xtranssock.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/Xtranssock.c b/Xtranssock.c
index 632c1b5..2c80a5c 100644
--- a/Xtranssock.c
+++ b/Xtranssock.c
@@ -584,66 +584,73 @@ TRANS(SocketOpenCOTSClient) (Xtransport *thistrans, const char *protocol,
const char *host, const char *port)
{
return TRANS(SocketOpenCOTSClientBase)(
thistrans->TransName, protocol, host, port, -1);
}
#endif /* TRANS_CLIENT */
#ifdef TRANS_SERVER
static XtransConnInfo
TRANS(SocketOpenCOTSServer) (Xtransport *thistrans, const char *protocol,
const char *host, const char *port)
{
XtransConnInfo ciptr;
int i = -1;
prmsg (2,"SocketOpenCOTSServer(%s,%s,%s)\n", protocol, host, port);
SocketInitOnce();
while ((i = TRANS(SocketSelectFamily) (i, thistrans->TransName)) >= 0) {
if ((ciptr = TRANS(SocketOpen) (
i, Sockettrans2devtab[i].devcotsname)) != NULL)
break;
}
if (i < 0) {
- if (i == -1)
- prmsg (1,"SocketOpenCOTSServer: Unable to open socket for %s\n",
- thistrans->TransName);
- else
+ if (i == -1) {
+ if (errno == EAFNOSUPPORT) {
+ thistrans->flags |= TRANS_NOLISTEN;
+ prmsg (1,"SocketOpenCOTSServer: Socket for %s unsupported on this system.\n",
+ thistrans->TransName);
+ } else {
+ prmsg (1,"SocketOpenCOTSServer: Unable to open socket for %s\n",
+ thistrans->TransName);
+ }
+ } else {
prmsg (1,"SocketOpenCOTSServer: Unable to determine socket type for %s\n",
thistrans->TransName);
+ }
return NULL;
}
/*
* Using this prevents the bind() check for an existing server listening
* on the same port, but it is required for other reasons.
*/
#ifdef SO_REUSEADDR
/*
* SO_REUSEADDR only applied to AF_INET && AF_INET6
*/
if (Sockettrans2devtab[i].family == AF_INET
#if defined(IPv6) && defined(AF_INET6)
|| Sockettrans2devtab[i].family == AF_INET6
#endif
)
{
int one = 1;
setsockopt (ciptr->fd, SOL_SOCKET, SO_REUSEADDR,
(char *) &one, sizeof (int));
}
#endif
#ifdef IPV6_V6ONLY
if (Sockettrans2devtab[i].family == AF_INET6)
{
int one = 1;
setsockopt(ciptr->fd, IPPROTO_IPV6, IPV6_V6ONLY, &one, sizeof(int));
}
--
2.35.1

View File

@ -8,7 +8,7 @@
Summary: X.Org X11 developmental X transport library
Name: xorg-x11-xtrans-devel
Version: 1.4.0
Release: 1%{?dist}
Release: 4%{?dist}
License: MIT
Group: System Environment/Libraries
URL: http://www.x.org
@ -19,6 +19,9 @@ Source0: https://xorg.freedesktop.org/archive/individual/lib/xtrans-%{version}.t
# Fedora specific patch
Patch1: xtrans-1.0.3-avoid-gethostname.patch
Patch2: 0001-Automatically-disable-inet6-transport-if-ipv6-is-dis.patch
BuildRequires: git
BuildRequires: pkgconfig
BuildRequires: xorg-x11-util-macros
@ -26,8 +29,7 @@ BuildRequires: xorg-x11-util-macros
X.Org X11 developmental X transport library
%prep
%setup -q -n xtrans-%{version}
%patch1 -p1 -b .my-name-is-unix
%autosetup -S git -n xtrans-%{version}
%build
# yes, this looks horrible, but it's to get the .pc file in datadir
@ -53,6 +55,14 @@ install -pm 644 AUTHORS ChangeLog COPYING README.md $RPM_BUILD_ROOT%{_pkgdocdir}
%{_datadir}/pkgconfig/xtrans.pc
%changelog
* Thu Jun 09 2022 Ray Strode <rstrode@redhat.com> - 1.4.0-4
- Actually apply the ipv6.disable support
Related: #2075132
* Fri May 06 2022 Ray Strode <rstrode@redhat.com> - 1.4.0-2
- Support ipv6.disable=1
Related: #2075132
* Tue Jun 02 2020 Adam Jackson <ajax@redhat.com> - 1.4.0-1
- xtrans 1.4.0