Date: Tue, 28 Jan 2020 13:51:53 +0000 (UTC) From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r357202 - head/sys/compat/linux Message-ID: <202001281351.00SDprlX053805@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: trasz Date: Tue Jan 28 13:51:53 2020 New Revision: 357202 URL: https://svnweb.freebsd.org/changeset/base/357202 Log: 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. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D23234 Modified: head/sys/compat/linux/linux_mib.c head/sys/compat/linux/linux_mib.h head/sys/compat/linux/linux_socket.c head/sys/compat/linux/linux_socket.h Modified: head/sys/compat/linux/linux_mib.c ============================================================================== --- head/sys/compat/linux/linux_mib.c Tue Jan 28 13:13:41 2020 (r357201) +++ head/sys/compat/linux/linux_mib.c Tue Jan 28 13:51:53 2020 (r357202) @@ -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: head/sys/compat/linux/linux_mib.h ============================================================================== --- head/sys/compat/linux/linux_mib.h Tue Jan 28 13:13:41 2020 (r357201) +++ head/sys/compat/linux/linux_mib.h Tue Jan 28 13:51:53 2020 (r357202) @@ -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: head/sys/compat/linux/linux_socket.c ============================================================================== --- head/sys/compat/linux/linux_socket.c Tue Jan 28 13:13:41 2020 (r357201) +++ head/sys/compat/linux/linux_socket.c Tue Jan 28 13:51:53 2020 (r357202) @@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$"); #endif #include <compat/linux/linux_common.h> #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> @@ -1424,6 +1425,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: head/sys/compat/linux/linux_socket.h ============================================================================== --- head/sys/compat/linux/linux_socket.h Tue Jan 28 13:13:41 2020 (r357201) +++ head/sys/compat/linux/linux_socket.h Tue Jan 28 13:51:53 2020 (r357202) @@ -202,6 +202,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?202001281351.00SDprlX053805>