0

Occasionally trackers, DHT nodes, and PEX peers offer peer addresses with a port of 0. What does this mean? In the context of submitting one's own port to a tracker, or in DHT, sending a port of 0 means that the recipient should use the sender's apparent port, due to NAT or similar. But when receiving a list of possible peers for a torrent, how do you interpret a port of 0 then?

Matt Joiner
  • 112,946
  • 110
  • 377
  • 526

2 Answers2

0

In the context of submitting one's own port to a tracker, or in DHT, sending a port of 0 means that the recipient should use the sender's apparent port

I am curious from which specification you're deriving that.

But when receiving a list of possible peers for a torrent, how do you interpret a port of 0 then?

Have you considered that it simply might be bogus data, not sanitized by the sender?

Rejecting port zero is not a requirement, since it's technically a valid port (although in practice not really usable) and even if it were you cannot rely on others to sanitize data for you.

the8472
  • 40,999
  • 5
  • 70
  • 122
0

I suspect you've stumbled on a bug in your tracker or other. You will not be able to connect to a peer's port 0 so reject those peers as not actually legit.

sandymac
  • 21
  • 4
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient [reputation](http://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](http://stackoverflow.com/help/privileges/comment). - [From Review](/review/low-quality-posts/10141776) – worldofjr Nov 10 '15 at 02:02
  • How is this not an answer? The questioner asks how to interpret a message to connect to an address and port of 0. I advise to interpret as something he cannot make use of and reject said peer address. When you open a socket for listening with port 0, the operating system picks a random port for you. Guessing random ports to connect to will not be fruitful most of the time. – sandymac Nov 16 '15 at 21:05