-
Notifications
You must be signed in to change notification settings - Fork 21.4k
Description
While working on an independent peer implementation in ethereumjs, I've came across this weird issue. This is a decoded ping message in DHT (redacted some fields and received a similar from many nodes):
{ version: <Buffer 04>,
address: '::',
udpPort: 30303,
tcpPort: 30303,
dstAddress: '42.42.42.42', // changed this, obviously
dstUdpPort: 30304,
dstTcpPort: 0,
expiration: 1452565204,
id: <Buffer a9 79 fb 57 54 95 b8 d6 db ... >,
port: 30303 }
The address field (from address) is actually the '::' (any/unspecified) encoded in IPv6 over the wire.
The relevant pieces of code in geth are:
https://github.com/ethereum/go-ethereum/blob/master/p2p/discover/udp.go#L216-L227
and
https://github.com/ethereum/go-ethereum/blob/master/p2p/discover/udp.go#L246
The above code does a NAT discovery for the public IP.
Is it possible the node had NAT discovery turned off? Is there some other bug there stopping the lookup from working? Shouldn't such an address (unspecified IPv4 or IPv6) be rejected in the protocol? Should IPv4 and IPv6 addresses be mixed in one ping?