From 5d977e09fbf3010e4664963b70fc56675bd95eb6 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Thu, 26 Apr 2018 00:54:48 +0200 Subject: [PATCH] AX.25 interface updates --- RNS/Interfaces/AX25KISSInterface.py | 9 +++++---- RNS/__init__.py | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/RNS/Interfaces/AX25KISSInterface.py b/RNS/Interfaces/AX25KISSInterface.py index c9dca32..7a6fc27 100644 --- a/RNS/Interfaces/AX25KISSInterface.py +++ b/RNS/Interfaces/AX25KISSInterface.py @@ -27,6 +27,7 @@ class AX25(): PID_NOLAYER3 = chr(0xF0) CTRL_UI = chr(0x03) CRC_CORRECT = chr(0xF0)+chr(0xB8) + HEADER_SIZE = 16 class AX25KISSInterface(Interface): @@ -178,8 +179,8 @@ class AX25KISSInterface(Interface): def processIncoming(self, data): - if (len(data) > 16): - self.owner.inbound(data[16:], self) + if (len(data) > AX25.HEADER_SIZE): + self.owner.inbound(data[AX25.HEADER_SIZE:], self) def processOutgoing(self,data): @@ -252,10 +253,10 @@ class AX25KISSInterface(Interface): in_frame = True command = KISS.CMD_UNKNOWN data_buffer = "" - elif (in_frame and len(data_buffer) < RNS.Reticulum.MTU): + elif (in_frame and len(data_buffer) < RNS.Reticulum.MTU+AX25.OVERHEAD): if (len(data_buffer) == 0 and command == KISS.CMD_UNKNOWN): # We only support one HDLC port for now, so - # strip off port nibble + # strip off the port nibble byte = chr(ord(byte) & 0x0F) command = byte elif (command == KISS.CMD_DATA): diff --git a/RNS/__init__.py b/RNS/__init__.py index f356758..1369200 100755 --- a/RNS/__init__.py +++ b/RNS/__init__.py @@ -47,6 +47,8 @@ def loglevelname(level): return "Verbose" if (level == LOG_DEBUG): return "Debug" + if (level == LOG_EXTREME): + return "Extra" return "Unknown"