From a671334b7c7b64bc779f1c2bfb4ed659d97c0d19 Mon Sep 17 00:00:00 2001 From: Pavel Balaev Date: Mon, 18 Mar 2024 14:29:34 +0300 Subject: sync: don't use ipv6 for rsync when it's disabled socket.has_ipv6 gives a false result: $ sysctl net.ipv6.conf.all.disable_ipv6=1 net.ipv6.conf.all.disable_ipv6 = 1 $ python Python 3.11.8 (main, Feb 24 2024, 17:10:38) [GCC 13.2.1 20240210] on linux >>> import socket >>> socket.has_ipv6 True This patch uses the portage.process.has_ipv6() function, which returns the correct result. Bug: https://bugs.gentoo.org/927241 Signed-off-by: Pavel Balaev Closes: https://github.com/gentoo/portage/pull/1309 Signed-off-by: Sam James --- lib/portage/sync/modules/rsync/rsync.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/portage/sync/modules/rsync/rsync.py b/lib/portage/sync/modules/rsync/rsync.py index 15c3eb4da..e89221ebc 100644 --- a/lib/portage/sync/modules/rsync/rsync.py +++ b/lib/portage/sync/modules/rsync/rsync.py @@ -19,6 +19,7 @@ from portage import _unicode_decode from portage import os from portage.const import VCS_DIRS, TIMESTAMP_FORMAT, RSYNC_PACKAGE_ATOM from portage.output import create_color_func, yellow, blue, bold +from portage.process import has_ipv6 from portage.sync.getaddrinfo_validate import getaddrinfo_validate from portage.sync.syncbase import NewBase from portage.util import writemsg, writemsg_level, writemsg_stdout @@ -252,9 +253,7 @@ class RsyncSync(NewBase): family = socket.AF_UNSPEC if "-4" in all_rsync_opts or "--ipv4" in all_rsync_opts: family = socket.AF_INET - elif socket.has_ipv6 and ( - "-6" in all_rsync_opts or "--ipv6" in all_rsync_opts - ): + elif has_ipv6() and ("-6" in all_rsync_opts or "--ipv6" in all_rsync_opts): family = socket.AF_INET6 addrinfos = None @@ -278,7 +277,7 @@ class RsyncSync(NewBase): if addrinfos: AF_INET = socket.AF_INET AF_INET6 = None - if socket.has_ipv6: + if has_ipv6(): AF_INET6 = socket.AF_INET6 ips_v4 = [] -- cgit v1.2.3-65-gdbad