summaryrefslogtreecommitdiffstats
path: root/libc
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-04-22 13:44:50 -0700
committerElliott Hughes <enh@google.com>2013-04-22 13:44:50 -0700
commit21da42ea91d45c43372d027f72467ecd66a33b29 (patch)
tree69c4bfd5a78d1f1961589cde3dea2c77b6854069 /libc
parent2c60c18c505491631a07380f80438fafa80d39f0 (diff)
downloadbionic-21da42ea91d45c43372d027f72467ecd66a33b29.zip
bionic-21da42ea91d45c43372d027f72467ecd66a33b29.tar.gz
bionic-21da42ea91d45c43372d027f72467ecd66a33b29.tar.bz2
Disable IPv6 when looking for tzdata updates.
My problems connecting to ftp.iana.org are only via IPv6. Change-Id: I42e4bae7981ec4b64822f745a7a15544d77ef22d
Diffstat (limited to 'libc')
-rwxr-xr-xlibc/tools/zoneinfo/update-tzdata.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/libc/tools/zoneinfo/update-tzdata.py b/libc/tools/zoneinfo/update-tzdata.py
index 2b30c15..f06dac3 100755
--- a/libc/tools/zoneinfo/update-tzdata.py
+++ b/libc/tools/zoneinfo/update-tzdata.py
@@ -6,6 +6,7 @@ import ftplib
import httplib
import os
import re
+import socket
import subprocess
import sys
import tarfile
@@ -32,6 +33,14 @@ regions = ['africa', 'antarctica', 'asia', 'australasia', 'backward',
'etcetera', 'europe', 'northamerica', 'southamerica']
+def DisableIpv6():
+ """Replaces socket.getaddrinfo with a version that only requests IPv4 addresses."""
+ __real_getaddrinfo = socket.getaddrinfo
+ def __ipv4_getaddrinfo(host, port, family=0, socktype=0, proto=0, flags=0):
+ return __real_getaddrinfo(host, port, socket.AF_INET, socktype, proto, flags)
+ socket.getaddrinfo = __ipv4_getaddrinfo
+
+
def GetCurrentTzDataVersion():
return open('%s/tzdata' % bionic_libc_zoneinfo_dir).read().split('\x00', 1)[0]
@@ -148,9 +157,9 @@ def main():
tzdata_filenames = []
# The FTP server lets you download intermediate releases, and also lets you
- # download the signatures for verification, so it's your best choice. It's
- # also less reliable than the HTTP server, so we support that too as a backup.
+ # download the signatures for verification, so it's your best choice.
use_ftp = True
+ DisableIpv6() # I've been unable to talk to the FTP server over IPv6 (2013-04).
if use_ftp:
ftp = ftplib.FTP('ftp.iana.org')