[tor-commits] [stem/master] Parsing descriptors with a 127.0.0.1 address as bridges
atagar at torproject.org
atagar at torproject.org
Sun May 6 01:13:58 UTC 2012
commit 477d448f5f19d9d5336e3297943b14567bb55c52
Author: Damian Johnson <atagar at torproject.org>
Date: Sat May 5 15:51:47 2012 -0700
Parsing descriptors with a 127.0.0.1 address as bridges
A prior scrubbing scheme for bridge descriptors scrubbed their addresses to be
127.0.0.1 rather than 10.x.x.x. Parsing both as bridges so we're compatible
with both schemes. Thanks to Karsten for pointing this out.
---
stem/descriptor/server_descriptor.py | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/stem/descriptor/server_descriptor.py b/stem/descriptor/server_descriptor.py
index 5a187df..6b53866 100644
--- a/stem/descriptor/server_descriptor.py
+++ b/stem/descriptor/server_descriptor.py
@@ -87,14 +87,15 @@ def parse_file(descriptor_file, validate = True):
# Handler for bridge descriptors
#
# Bridge descriptors are scrubbed so their nickname is 'Unnamed' and their
- # ip address is in the 10.x.x.x space, which is normally reserved for
- # private networks. Bride descriptors only come from metrics so a file only
- # contains a single descriptor.
+ # ip address is in the 10.x.x.x space (priorly '127.0.0.1'), which is
+ # normally reserved for private networks. Bridge descriptors only come from
+ # metrics so a file only contains a single descriptor.
first_line = descriptor_file.readline()
descriptor_file.seek(0)
- if first_line.startswith("router Unnamed 10."):
+ if first_line.startswith("router Unnamed 10.") or \
+ first_line.startswith("router Unnamed 127.0.0.1"):
yield BridgeDescriptor(descriptor_file.read())
return
More information about the tor-commits
mailing list