[tor-bugs] #8215 [Tor]: Simple Relay: random unknown UDP port in listen mode
Tor Bug Tracker & Wiki
blackhole at torproject.org
Fri Mar 1 03:24:09 UTC 2013
#8215: Simple Relay: random unknown UDP port in listen mode
----------------------------+-----------------------------------------------
Reporter: elgo | Owner:
Type: enhancement | Status: reopened
Priority: normal | Milestone: Tor: unspecified
Component: Tor | Version:
Resolution: | Keywords: tor-relay
Parent: | Points:
Actualpoints: |
----------------------------+-----------------------------------------------
Comment(by nickm):
So here's how DNS and UDP work together here.
I want to make a DNS request. I'm going to send a DNS request in a UDP
packet to a DNS server. That server is going to send me a response in
another UDP packet.
But UDP isn't like TCP: UDP deals with datagrams, not streams. If I am
going to receive any UDP response from the server, I need to have an open
socket waiting for the UDP datagram to come back.
That socket will show up as listening: That's to be expected. It's
willing to accept replies from multiple DNS servers, because it's willing
to send requests to them.
I'm attaching a simple demonstration program in C. It makes a DNS request
to one or two of Google's public nameservers, waits for an answer, then
sleeps for a while so you can run netstat or lsof before it exits. If you
run it as-is, then it uses "connect" to say that it only wants to talk to
one nameserver. If you add "#define TWO_REQUESTS" at the top of the
file, then it'll use the same socket to send a request to two nameservers,
and wait for replies from both. In the first case, the program will show
up as "connected"; in the second case, it will show up as "listening".
But it's the same code in both cases: Send a UDP request, wait for a
reply.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/8215#comment:8>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list