aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Balaev <mail@void.so>2024-03-18 14:29:34 +0300
committerSam James <sam@gentoo.org>2024-05-27 00:27:08 +0100
commita671334b7c7b64bc779f1c2bfb4ed659d97c0d19 (patch)
tree665dd403b06d92231da99865a173cccb15126575
parentprocess: make has_ipv6 a public function (diff)
downloadportage-a671334b7c7b64bc779f1c2bfb4ed659d97c0d19.tar.gz
portage-a671334b7c7b64bc779f1c2bfb4ed659d97c0d19.tar.bz2
portage-a671334b7c7b64bc779f1c2bfb4ed659d97c0d19.zip
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 <mail@void.so> Closes: https://github.com/gentoo/portage/pull/1309 Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r--lib/portage/sync/modules/rsync/rsync.py7
1 files 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 = []