Compare commits

...

No commits in common. "c8" and "c9" have entirely different histories.
c8 ... c9

2 changed files with 33 additions and 129 deletions

View File

@ -1,113 +0,0 @@
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,9 +8,8 @@
Summary: X.Org X11 developmental X transport library
Name: xorg-x11-xtrans-devel
Version: 1.4.0
Release: 4%{?dist}
Release: 8%{?dist}
License: MIT
Group: System Environment/Libraries
URL: http://www.x.org
BuildArch: noarch
@ -19,9 +18,7 @@ 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: make
BuildRequires: pkgconfig
BuildRequires: xorg-x11-util-macros
@ -29,19 +26,19 @@ BuildRequires: xorg-x11-util-macros
X.Org X11 developmental X transport library
%prep
%autosetup -S git -n xtrans-%{version}
%setup -q -n xtrans-%{version}
%patch1 -p1 -b .my-name-is-unix
%build
# yes, this looks horrible, but it's to get the .pc file in datadir
%configure --libdir=%{_datadir} --docdir=%{_pkgdocdir}
%configure --libdir=%{_datadir} --disable-docs
# Running 'make' not needed.
%install
make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p"
install -pm 644 AUTHORS ChangeLog COPYING README.md $RPM_BUILD_ROOT%{_pkgdocdir}
%files
%{_pkgdocdir}
%doc AUTHORS COPYING ChangeLog README.md
%dir %{_includedir}/X11
%dir %{_includedir}/X11/Xtrans
%{_includedir}/X11/Xtrans/Xtrans.c
@ -55,17 +52,37 @@ 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
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 1.4.0-8
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Fri May 06 2022 Ray Strode <rstrode@redhat.com> - 1.4.0-2
- Support ipv6.disable=1
Related: #2075132
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 1.4.0-7
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Tue Jun 02 2020 Adam Jackson <ajax@redhat.com> - 1.4.0-1
* Thu Jan 28 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.0-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Thu Nov 5 11:05:08 AEST 2020 Peter Hutterer <peter.hutterer@redhat.com> - 1.4.0-5
- Add BuildRequires for make
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Fri Jan 31 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Sat Jul 27 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Thu Mar 21 2019 Adam Jackson <ajax@redhat.com> - 1.4.0-1
- xtrans 1.4.0
* Sun Feb 03 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.5-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.5-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.5-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild