From d827b4d5af46b552395a2673f8c86d07958cc6de Mon Sep 17 00:00:00 2001 From: Antonio Quartulli Date: Tue, 31 Oct 2017 10:26:26 +0800 Subject: [PATCH] platform ip: ensure daemon retrieves IPv4 address only When contacting jsonip.com to retrieve the node external IP, the connection might be established with IPv6 and thus return an address belonging to that family. This address is then used to initialize the external_ip member of Daemon session, but unfortunately IPv6 is not yet handled well. Using an IPv6 as external IP is currently breaking parts of the Daemon resulting in no peer connectivity at all. We should stick to IPv4 for time being. http://jsonip.com/about says "ipv4-only":"https://ipv4.jsonip.com" therefore, change the IP retrieval URL to ipv4.jsonip.com to make sure the connection is established only using an IPv4 address. Closes: https://github.com/lbryio/lbry/issues/971 Signed-off-by: Antonio Quartulli --- CHANGELOG.md | 1 + lbrynet/core/system_info.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fbac72659..767faee64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ at anytime. ### Fixed * Fixed amount of close nodes to add to list in case of extension to neighbouring k-buckets + * Fixed external IP detection via jsonip.com (avoid detecting IPv6) * ### Deprecated diff --git a/lbrynet/core/system_info.py b/lbrynet/core/system_info.py index 79187f722..86fb72ec4 100644 --- a/lbrynet/core/system_info.py +++ b/lbrynet/core/system_info.py @@ -39,7 +39,7 @@ def get_platform(get_ip=True): if get_ip: try: - p['ip'] = json.load(urlopen('http://jsonip.com'))['ip'] + p['ip'] = json.load(urlopen('http://ipv4.jsonip.com'))['ip'] except: p['ip'] = "Could not determine IP"