Search code examples
dht

Mainline DHT unexpected message from other nodes


It looks like part of some kind of flood prevention mechanism but i am not sure.

Query sent:

d1:t2:021:y1:q1:q4:ping1:ad2:id20:ê¹L®<꽸.å»…°H$W5ee

Query in hex:

64313A74323A3032313A79313A71313A71343A70696E67313A6164323A696432303AEAB9034C7FAE3C8DEABDB82EE5BB85B0482457356565

Recieved message:

A\0\u0006Ÿ4\u001f’t\0\0\0\0\0\u0010\0\0j{\0\0

Received message in hex:

4100069F341F927400000000001000006A7B0000

Can someone please tell me what is this message? Thank you in advance.


Solution

  • Currently all defined DHT messages are bencoded dictionaries, thus should start with a d, so this clearly is not a DHT message.

    But multiple services can operate on a DHT port as long as the protocols can be disambiguated. The looks like it might be a uTP SYN and the remote peer is simply guessing your node also speaks bittorrent-over-uTP. If you don't intend to support then you can just drop that packet and consider the actual DHT response as still pending at that point.

    A sidenote, your query is not valid bencoding. BEP 3 specifies that dictionary keys must be sorted.