From 4eebf0b685322c9240d07e545fb5585e4dfcc16d Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Fri, 28 Aug 2026 21:47:24 +0200 Subject: [PATCH] Guard empty keepalive frames --- RNS/Interfaces/I2PInterface.py | 1 + RNS/Interfaces/KISSInterface.py | 1 + RNS/Interfaces/PipeInterface.py | 1 + RNS/Interfaces/RNodeInterface.py | 1 + RNS/Interfaces/RNodeMultiInterface.py | 1 + RNS/Interfaces/SerialInterface.py | 1 + RNS/Interfaces/TCPInterface.py | 1 + RNS/Interfaces/UDPInterface.py | 1 + 8 files changed, 8 insertions(+) diff --git a/RNS/Interfaces/I2PInterface.py b/RNS/Interfaces/I2PInterface.py index f8a562c6..0561829d 100644 --- a/RNS/Interfaces/I2PInterface.py +++ b/RNS/Interfaces/I2PInterface.py @@ -537,6 +537,7 @@ class I2PInterfacePeer(Interface): raise IOError("Attempt to reconnect on a non-initiator I2P interface") def process_incoming(self, data): + if not data: return self.rxb += len(data) if hasattr(self, "parent_interface") and self.parent_interface != None and self.parent_count: self.parent_interface.rxb += len(data) diff --git a/RNS/Interfaces/KISSInterface.py b/RNS/Interfaces/KISSInterface.py index 036904e4..298e20f7 100644 --- a/RNS/Interfaces/KISSInterface.py +++ b/RNS/Interfaces/KISSInterface.py @@ -246,6 +246,7 @@ class KISSInterface(Interface): def process_incoming(self, data): + if not data: return self.rxb += len(data) self.owner.inbound(data, self) diff --git a/RNS/Interfaces/PipeInterface.py b/RNS/Interfaces/PipeInterface.py index 6b420aa5..eca88b5c 100644 --- a/RNS/Interfaces/PipeInterface.py +++ b/RNS/Interfaces/PipeInterface.py @@ -120,6 +120,7 @@ class PipeInterface(Interface): def process_incoming(self, data): + if not data: return self.rxb += len(data) self.owner.inbound(data, self) diff --git a/RNS/Interfaces/RNodeInterface.py b/RNS/Interfaces/RNodeInterface.py index 42524bff..6b2d7708 100644 --- a/RNS/Interfaces/RNodeInterface.py +++ b/RNS/Interfaces/RNodeInterface.py @@ -702,6 +702,7 @@ class RNodeInterface(Interface): self.bitrate = 0 def process_incoming(self, data): + if not data: return self.rxb += len(data) self.owner.inbound(data, self) diff --git a/RNS/Interfaces/RNodeMultiInterface.py b/RNS/Interfaces/RNodeMultiInterface.py index 97b74abd..8f48ba78 100644 --- a/RNS/Interfaces/RNodeMultiInterface.py +++ b/RNS/Interfaces/RNodeMultiInterface.py @@ -1128,6 +1128,7 @@ class RNodeSubInterface(Interface): self.bitrate = 0 def process_incoming(self, data): + if not data: return self.rxb += len(data) self.owner.inbound(data, self) diff --git a/RNS/Interfaces/SerialInterface.py b/RNS/Interfaces/SerialInterface.py index 0bce146f..e03cb1f0 100755 --- a/RNS/Interfaces/SerialInterface.py +++ b/RNS/Interfaces/SerialInterface.py @@ -143,6 +143,7 @@ class SerialInterface(Interface): def process_incoming(self, data): + if not data: return self.rxb += len(data) self.owner.inbound(data, self) diff --git a/RNS/Interfaces/TCPInterface.py b/RNS/Interfaces/TCPInterface.py index c0b66ba1..cb83fd3a 100644 --- a/RNS/Interfaces/TCPInterface.py +++ b/RNS/Interfaces/TCPInterface.py @@ -302,6 +302,7 @@ class TCPClientInterface(Interface): raise IOError("Attempt to reconnect on a non-initiator TCP interface") def process_incoming(self, data): + if not data: return if self.online and not self.detached: self.rxb += len(data) if hasattr(self, "parent_interface") and self.parent_interface != None: diff --git a/RNS/Interfaces/UDPInterface.py b/RNS/Interfaces/UDPInterface.py index 8dd9c78e..43411466 100644 --- a/RNS/Interfaces/UDPInterface.py +++ b/RNS/Interfaces/UDPInterface.py @@ -115,6 +115,7 @@ class UDPInterface(Interface): def process_incoming(self, data): + if not data: return self.rxb += len(data) self.owner.inbound(data, self)