From 9c9226dced67b0e18fbc67cd31ccda585f39b322 Mon Sep 17 00:00:00 2001 From: onefang Date: Wed, 1 Jan 2020 19:03:15 +1000 Subject: Curl will try IPv4 as a backup if IPv6 fails, and we don't want that. Tell it not to. Also detect if IPv6 is even available. --- apt-panopticommon.lua | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'apt-panopticommon.lua') diff --git a/apt-panopticommon.lua b/apt-panopticommon.lua index e40ec0a..7664297 100644 --- a/apt-panopticommon.lua +++ b/apt-panopticommon.lua @@ -23,6 +23,7 @@ APT.verbosity = -1 APT.origin = false APT.redir = false APT.keep = false +APT.IPv46 = '' APT.options = { @@ -119,6 +120,10 @@ APT.parseArgs = function(args) APT.args = args local arg = {} local sendArgs = "" + -- A special test to disable IPv6 tests if IPv6 isn't available. + if 1 == APT.exe('ip -6 addr | grep inet6 | grep " global"'):Do().status then + table.insert(args, '--tests=-IPv6') + end if 0 ~= #(args) then local option = "" for i, a in pairs(args) do @@ -132,6 +137,9 @@ APT.parseArgs = function(args) elseif "-q" == a then APT.verbosity = -1 sendArgs = sendArgs .. a .. " " + elseif ("-4" == a) or ("-6" == a) then + APT.IPv46 = a + sendArgs = sendArgs .. a .. " " elseif "-k" == a then APT.keep = true sendArgs = sendArgs .. a .. " " -- cgit v1.1