From aefd29ced51580f57e487d48e71d7ce8f17bf081 Mon Sep 17 00:00:00 2001 From: Cameron Dale Date: Thu, 1 May 2008 13:04:46 -0700 Subject: [PATCH] Fix the broken local IP regexes. --- apt_p2p/util.py | 4 +++- apt_p2p_Khashmir/khashmir.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apt_p2p/util.py b/apt_p2p/util.py index 51582f7..345ab9a 100644 --- a/apt_p2p/util.py +++ b/apt_p2p/util.py @@ -12,7 +12,9 @@ from twisted.trial import unittest isLocal = re.compile('^(192\.168\.[0-9]{1,3}\.[0-9]{1,3})|'+ '(10\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})|'+ - '(172\.0?([1][6-9])|([2][0-9])|([3][0-1])\.[0-9]{1,3}\.[0-9]{1,3})|'+ + '(172\.0?1[6-9]\.[0-9]{1,3}\.[0-9]{1,3})|'+ + '(172\.0?2[0-9]\.[0-9]{1,3}\.[0-9]{1,3})|'+ + '(172\.0?3[0-1]\.[0-9]{1,3}\.[0-9]{1,3})|'+ '(127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})$') def findMyIPAddr(addrs, intended_port, local_ok = False): diff --git a/apt_p2p_Khashmir/khashmir.py b/apt_p2p_Khashmir/khashmir.py index 408a7e9..9509ce6 100644 --- a/apt_p2p_Khashmir/khashmir.py +++ b/apt_p2p_Khashmir/khashmir.py @@ -29,7 +29,9 @@ import krpc isLocal = re.compile('^(192\.168\.[0-9]{1,3}\.[0-9]{1,3})|'+ '(10\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})|'+ - '(172\.0?([1][6-9])|([2][0-9])|([3][0-1])\.[0-9]{1,3}\.[0-9]{1,3})|'+ + '(172\.0?1[6-9]\.[0-9]{1,3}\.[0-9]{1,3})|'+ + '(172\.0?2[0-9]\.[0-9]{1,3}\.[0-9]{1,3})|'+ + '(172\.0?3[0-1]\.[0-9]{1,3}\.[0-9]{1,3})|'+ '(127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})$') class KhashmirBase(protocol.Factory): -- 2.39.5