[tor-bugs] #18079 [Stem]: Improve (IPv6) parsing of "connection resolvers"

Tor Bug Tracker & Wiki blackhole at torproject.org
Mon Jan 25 19:47:19 UTC 2016


#18079: Improve (IPv6) parsing of "connection resolvers"
--------------------+--------------------------
 Reporter:  toralf  |          Owner:  atagar
     Type:  defect  |         Status:  reopened
 Priority:  Medium  |      Milestone:
Component:  Stem    |        Version:
 Severity:  Normal  |     Resolution:
 Keywords:  ipv6    |  Actual Points:
Parent ID:          |         Points:
  Sponsor:          |
--------------------+--------------------------

Comment (by yawning):

 Replying to [comment:22 atagar]:
 > Apologies but having trouble groking how we convert this proc content
 into its address...
 >
 > {{{
 > proc:        'F804012A4A5190010000000002000000'
 > proc bin:
 '11111000000001000000000100101010010010100101000110010000000000000000000000000000000000000000000000000000000000000000000000000000
 > address bin:
 '00101010000000010000010011111000000000011001000001010001010010100000000000000000000000000000000000000000000000000000000000000010'
 > address:     '2a01:4f8:190:514a::2'
 > }}}
 >
 > Hints welcome.

 > > You need to do the byte reversal word-wise, where word means 32 bits.

 How about https://en.wikipedia.org/wiki/File:Little-Endian.svg

 > proc: 'F804012A4A5190010000000002000000'

  1. Separate into 32 bit words: `F804012A` `4A519001` `00000000`
 `02000000`

  2. Byte reversal:
     `F804012A` -> `2A0104F8`
     `4A519001` -> `0190514A`
     `00000000` -> `00000000`
     `02000000` -> `00000002`

  3. Stick it back together, insert strategic colons:
 `2A01:04F8:0190:514A:0000:0000:0000:0002`

 I assume (and as far as I can tell from skimming the code linked) Big
 Endian systems won't require the conversion.  HTH, HAND.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/18079#comment:24>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list