Client connection under NAT (with empty addr list in adnl packet) drops
Requests to the node from clients that are behind NAT (with an empty addr list in adnl packets) are dropped by the node. Because of this, it is impossible to build custom applications on the ADNL protocol using this library.
I can forward the address from the received packet (Socket::recv_from returns it) and use it if the addr_list is empty. Is it some kind of defined/expected behavior of ADNL?
https://github.com/andreypfau/adnl-rs/commit/d733fad0acac3cf9dbe0e31558bb0a65494eead4
I fixed it in my fork. TON vanilla behavior - if the list is empty (not null), then use the sender address from the socket
Can you please check if this branch https://github.com/broxus/everscale-network/tree/feature/use-packet-addr works for you (with use_packet_source_addr explicitly set to true)?And if everything is ok then I can publish it
Can you please check if this branch https://github.com/broxus/everscale-network/tree/feature/use-packet-addr works for you (with
use_packet_source_addrexplicitly set totrue)?And if everything is ok then I can publish it
Not exactly, because in TON for resolving address by socket it MUST provide AdnlAddrList, but with empty list in schema itself. This piece of code from my fork satisfies the requirement. (It's not exactly pretty, but it's a working example):
let addr = match parse_address_list(list, self.options.clock_tolerance_sec) {
Ok(addr) => addr,
Err(e) => {
if let AdnlAddressListError::ListIsEmpty = e {
match raw_packet.socket_addr() {
SocketAddr::V4(addr) => addr,
SocketAddr::V6(_) => {
// IPv6 is not supported
return Err(e.into())
}
}
} else {
return Err(e.into());
}
}
};
AddressList must provide reinit_date, expire_at but with empty address field.
This will make the code compatible with TON if the use_packet_source_addr option is enabled.