Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Aug 2020 12:35:02 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r364663 - stable/12/sys/compat/linux
Message-ID:  <202008241235.07OCZ2Ck028244@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Mon Aug 24 12:35:02 2020
New Revision: 364663
URL: https://svnweb.freebsd.org/changeset/base/364663

Log:
  MFC r357202:
  
  Add compat.linux.ignore_ip_recverr sysctl.  This is a workaround
  for missing IP_RECVERR setsockopt(2) support. Without it, DNS
  resolution is broken for glibc >= 2.30 (glibc BZ #24047).
  
  From the user point of view this fixes "yum update" on recent
  CentOS 8.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  stable/12/sys/compat/linux/linux_mib.c
  stable/12/sys/compat/linux/linux_mib.h
  stable/12/sys/compat/linux/linux_socket.c
  stable/12/sys/compat/linux/linux_socket.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/compat/linux/linux_mib.c
==============================================================================
--- stable/12/sys/compat/linux/linux_mib.c	Mon Aug 24 12:33:42 2020	(r364662)
+++ stable/12/sys/compat/linux/linux_mib.c	Mon Aug 24 12:35:02 2020	(r364663)
@@ -62,6 +62,10 @@ static unsigned linux_osd_jail_slot;
 
 SYSCTL_NODE(_compat, OID_AUTO, linux, CTLFLAG_RW, 0, "Linux mode");
 
+int linux_ignore_ip_recverr = 1;
+SYSCTL_INT(_compat_linux, OID_AUTO, ignore_ip_recverr, CTLFLAG_RWTUN,
+    &linux_ignore_ip_recverr, 0, "Ignore enabling IP_RECVERR");
+
 int linux_preserve_vstatus = 0;
 SYSCTL_INT(_compat_linux, OID_AUTO, preserve_vstatus, CTLFLAG_RWTUN,
     &linux_preserve_vstatus, 0, "Preserve VSTATUS termios(4) flag");

Modified: stable/12/sys/compat/linux/linux_mib.h
==============================================================================
--- stable/12/sys/compat/linux/linux_mib.h	Mon Aug 24 12:33:42 2020	(r364662)
+++ stable/12/sys/compat/linux/linux_mib.h	Mon Aug 24 12:35:02 2020	(r364663)
@@ -62,6 +62,7 @@ int	linux_kernver(struct thread *td);
 
 #define	linux_use26(t)		(linux_kernver(t) >= LINUX_KERNVER_2006000)
 
+extern int linux_ignore_ip_recverr;
 extern int linux_preserve_vstatus;
 
 #endif /* _LINUX_MIB_H_ */

Modified: stable/12/sys/compat/linux/linux_socket.c
==============================================================================
--- stable/12/sys/compat/linux/linux_socket.c	Mon Aug 24 12:33:42 2020	(r364662)
+++ stable/12/sys/compat/linux/linux_socket.c	Mon Aug 24 12:35:02 2020	(r364663)
@@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$");
 #include <machine/../linux/linux_proto.h>
 #endif
 #include <compat/linux/linux_file.h>
+#include <compat/linux/linux_mib.h>
 #include <compat/linux/linux_socket.h>
 #include <compat/linux/linux_timer.h>
 #include <compat/linux/linux_util.h>
@@ -1569,6 +1570,14 @@ linux_setsockopt(struct thread *td, struct linux_setso
 		}
 		break;
 	case IPPROTO_IP:
+		if (args->optname == LINUX_IP_RECVERR &&
+		    linux_ignore_ip_recverr) {
+			/*
+			 * XXX: This is a hack to unbreak DNS resolution
+			 *	with glibc 2.30 and above.
+			 */
+			return (0);
+		}
 		name = linux_to_bsd_ip_sockopt(args->optname);
 		break;
 	case IPPROTO_IPV6:

Modified: stable/12/sys/compat/linux/linux_socket.h
==============================================================================
--- stable/12/sys/compat/linux/linux_socket.h	Mon Aug 24 12:33:42 2020	(r364662)
+++ stable/12/sys/compat/linux/linux_socket.h	Mon Aug 24 12:35:02 2020	(r364663)
@@ -215,6 +215,7 @@ int linux_accept(struct thread *td, struct linux_accep
 #define	LINUX_IP_TTL		2
 #define	LINUX_IP_HDRINCL	3
 #define	LINUX_IP_OPTIONS	4
+#define	LINUX_IP_RECVERR	11
 
 #define	LINUX_IP_MULTICAST_IF		32
 #define	LINUX_IP_MULTICAST_TTL		33



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202008241235.07OCZ2Ck028244>