diff --git a/RNS/Interfaces/Interface.py b/RNS/Interfaces/Interface.py index 619f32da..137f92cd 100755 --- a/RNS/Interfaces/Interface.py +++ b/RNS/Interfaces/Interface.py @@ -159,6 +159,7 @@ class Interface: self.protocol_violations = 0 self.ifac_violations = 0 self.packet_filter_hits = 0 + self.hop_limiter_hits = 0 self.dp_ingress_tcount = 0 self.dp_ingress_bytes = 0 self.dp_ingress_packets = 0 @@ -338,6 +339,10 @@ class Interface: self.packet_filter_hits += 1 return None + def hop_limiter_hit(self): + self.hop_limiter_hits += 1 + return None + @property def ic_burst_count(self): return None diff --git a/RNS/Transport.py b/RNS/Transport.py index 72caa410..ac54c69d 100755 --- a/RNS/Transport.py +++ b/RNS/Transport.py @@ -202,6 +202,7 @@ class Transport: PR_VALUE = 19 # Default target stamp value for emitted path requests LR_COST = 11 # Default required link request cost if not explicitly announced or configured LINK_STAMP_TIMEOUT = 15 # TODO: Provisional, set sensible default and wire to config + HOP_LIMITER = PATHFINDER_M # TODO: Locally configurable hop limiter, wire to config STAMPER_PR_QUEUE_LENGTH = 32 # TODO: Provisional, wire to config handling STAMPER_AN_QUEUE_LENGTH = 32 # TODO: Provisional, wire to config handling @@ -1996,6 +1997,7 @@ class Transport: packet = RNS.Packet(None, raw) if not packet.unpack(): return interface.protocol_violation(f"Malformed packet ({len(raw)} bytes)") if interface else None + if not packet.hops < Transport.HOP_LIMITER: return interface.hop_limiter_hit() if not Transport.packet_filter(packet): return interface.packet_filter_hit() traffic_class = tc or Transport.TC_DATA