Opened 4 years ago

Closed 4 years ago

#9181 closed defect (fixed)

"ProtocolError: Target location's port is invalid" when STREAM event target is IPv6 address

Reported by: soult Owned by: atagar
Priority: Medium Milestone:
Component: Core Tor/Stem Version:
Severity: Keywords: ipv6
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

david@hotdog:~/scm/git/stem$ ./stream-ipv6.py 
Exception in thread Event Notifier:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 505, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/david/scm/git/stem/stem/control.py", line 609, in _event_loop
    self._handle_event(event_message)
  File "/home/david/scm/git/stem/stem/control.py", line 2303, in _handle_event
    stem.response.convert("EVENT", event_message, arrived_at = time.time())
  File "/home/david/scm/git/stem/stem/response/__init__.py", line 128, in convert
    message._parse_message(**kwargs)
  File "/home/david/scm/git/stem/stem/response/events.py", line 66, in _parse_message
    self._parse()
  File "/home/david/scm/git/stem/stem/response/events.py", line 828, in _parse
    raise stem.ProtocolError("Target location's port is invalid: %s" % self)
ProtocolError: Target location's port is invalid: STREAM 105 NEWRESOLVE 0 2001:db8::1:0 PURPOSE=DNS_REQUEST

Child Tickets

Attachments (1)

stream-ipv6.py (316 bytes) - added by soult 4 years ago.
Triggers the bug by creating a reverse DNS request for an IPv6 address

Download all attachments as: .zip

Change History (3)

Changed 4 years ago by soult

Triggers the bug by creating a reverse DNS request for an IPv6 address

comment:1 Changed 4 years ago by soult

  • Status changed from new to needs_review

Since Tor does not normally have an IPv6 address as stream target, this bug is (afaik) only triggered when doing reverse DNS resolution. From the control spec it is clear that the target will always end with ":" Port, so the fix is to only split on the last colon using rsplit.

A patch can be found in the branch bug-9181 of my stem repository clone[1]. (Diff[2]).

1: https://github.com/soult/stem/
2: https://github.com/soult/stem/compare/master...bug-9181

comment:2 Changed 4 years ago by atagar

  • Resolution set to fixed
  • Status changed from needs_review to closed
Note: See TracTickets for help on using tickets.