mirror of
https://github.com/markqvist/Reticulum.git
synced 2024-11-26 15:30:18 +00:00
Prevent answering path requests on roaming-mode interfaces for next-hop instances on same roaming-mode interface
This commit is contained in:
parent
8803dd5b65
commit
2439761529
@ -2046,41 +2046,45 @@ class Transport:
|
|||||||
packet = Transport.destination_table[destination_hash][6]
|
packet = Transport.destination_table[destination_hash][6]
|
||||||
next_hop = Transport.destination_table[destination_hash][1]
|
next_hop = Transport.destination_table[destination_hash][1]
|
||||||
received_from = Transport.destination_table[destination_hash][5]
|
received_from = Transport.destination_table[destination_hash][5]
|
||||||
|
|
||||||
if requestor_transport_id != None and next_hop == requestor_transport_id:
|
if attached_interface.mode == RNS.Interfaces.Interface.Interface.MODE_ROAMING and attached_interface == received_from:
|
||||||
# TODO: Find a bandwidth efficient way to invalidate our
|
RNS.log("Not answering path request on roaming-mode interface, since next hop is on same roaming-mode interface", RNS.LOG_DEBUG)
|
||||||
# known path on this signal. The obvious way of signing
|
|
||||||
# path requests with transport instance keys is quite
|
|
||||||
# inefficient. There is probably a better way. Doing
|
|
||||||
# path invalidation here would decrease the network
|
|
||||||
# convergence time. Maybe just drop it?
|
|
||||||
RNS.log("Not answering path request for "+RNS.prettyhexrep(destination_hash)+interface_str+", since next hop is the requestor", RNS.LOG_DEBUG)
|
|
||||||
else:
|
else:
|
||||||
RNS.log("Answering path request for "+RNS.prettyhexrep(destination_hash)+interface_str+", path is known", RNS.LOG_DEBUG)
|
if requestor_transport_id != None and next_hop == requestor_transport_id:
|
||||||
|
# TODO: Find a bandwidth efficient way to invalidate our
|
||||||
now = time.time()
|
# known path on this signal. The obvious way of signing
|
||||||
retries = Transport.PATHFINDER_R
|
# path requests with transport instance keys is quite
|
||||||
local_rebroadcasts = 0
|
# inefficient. There is probably a better way. Doing
|
||||||
block_rebroadcasts = True
|
# path invalidation here would decrease the network
|
||||||
announce_hops = packet.hops
|
# convergence time. Maybe just drop it?
|
||||||
|
RNS.log("Not answering path request for "+RNS.prettyhexrep(destination_hash)+interface_str+", since next hop is the requestor", RNS.LOG_DEBUG)
|
||||||
if is_from_local_client:
|
|
||||||
retransmit_timeout = now
|
|
||||||
else:
|
else:
|
||||||
# TODO: Look at this timing
|
RNS.log("Answering path request for "+RNS.prettyhexrep(destination_hash)+interface_str+", path is known", RNS.LOG_DEBUG)
|
||||||
retransmit_timeout = now + Transport.PATH_REQUEST_GRACE # + (RNS.rand() * Transport.PATHFINDER_RW)
|
|
||||||
|
|
||||||
# This handles an edge case where a peer sends a past
|
now = time.time()
|
||||||
# request for a destination just after an announce for
|
retries = Transport.PATHFINDER_R
|
||||||
# said destination has arrived, but before it has been
|
local_rebroadcasts = 0
|
||||||
# rebroadcast locally. In such a case the actual announce
|
block_rebroadcasts = True
|
||||||
# is temporarily held, and then reinserted when the path
|
announce_hops = packet.hops
|
||||||
# request has been served to the peer.
|
|
||||||
if packet.destination_hash in Transport.announce_table:
|
if is_from_local_client:
|
||||||
held_entry = Transport.announce_table[packet.destination_hash]
|
retransmit_timeout = now
|
||||||
Transport.held_announces[packet.destination_hash] = held_entry
|
else:
|
||||||
|
# TODO: Look at this timing
|
||||||
Transport.announce_table[packet.destination_hash] = [now, retransmit_timeout, retries, received_from, announce_hops, packet, local_rebroadcasts, block_rebroadcasts, attached_interface]
|
retransmit_timeout = now + Transport.PATH_REQUEST_GRACE # + (RNS.rand() * Transport.PATHFINDER_RW)
|
||||||
|
|
||||||
|
# This handles an edge case where a peer sends a past
|
||||||
|
# request for a destination just after an announce for
|
||||||
|
# said destination has arrived, but before it has been
|
||||||
|
# rebroadcast locally. In such a case the actual announce
|
||||||
|
# is temporarily held, and then reinserted when the path
|
||||||
|
# request has been served to the peer.
|
||||||
|
if packet.destination_hash in Transport.announce_table:
|
||||||
|
held_entry = Transport.announce_table[packet.destination_hash]
|
||||||
|
Transport.held_announces[packet.destination_hash] = held_entry
|
||||||
|
|
||||||
|
Transport.announce_table[packet.destination_hash] = [now, retransmit_timeout, retries, received_from, announce_hops, packet, local_rebroadcasts, block_rebroadcasts, attached_interface]
|
||||||
|
|
||||||
elif is_from_local_client:
|
elif is_from_local_client:
|
||||||
# Forward path request on all interfaces
|
# Forward path request on all interfaces
|
||||||
|
Loading…
Reference in New Issue
Block a user