diff options
| author | Dave Hibberd <hibby@debian.org> | 2025-11-11 21:50:49 +0000 |
|---|---|---|
| committer | Dave Hibberd <hibby@debian.org> | 2025-11-11 21:50:49 +0000 |
| commit | 1338e2c0a4d701039eff82fa838a066b37206d39 (patch) | |
| tree | cf8c0b954381212d2a69d88c071657974b38884f | |
| parent | 8dc88bc8290ea7b72ebb2fb0042d4b200a089a8e (diff) | |
| parent | 85f200a46cf5e002e59e36b11ab4fba2f0422b33 (diff) | |
Update upstream source from tag 'upstream/6.0.25.11+repack'
Update to upstream version '6.0.25.11+repack'
with Debian dir 9c0f82ee4c630b5e6c5cc6a4d1e3093259cd7a60
| -rw-r--r-- | Bpq32.c | 2 | ||||
| -rw-r--r-- | Cmd.c | 2 | ||||
| -rw-r--r-- | Events.c | 155 | ||||
| -rw-r--r-- | L4Code.c | 18 | ||||
| -rw-r--r-- | NETROMTCP.c | 23 | ||||
| -rw-r--r-- | Versions.h | 4 | ||||
| -rw-r--r-- | asmstrucs.h | 8 | ||||
| -rw-r--r-- | cMain.c | 66 | ||||
| -rw-r--r-- | config.c | 10 | ||||
| -rw-r--r-- | configstructs.h | 1 |
10 files changed, 243 insertions, 46 deletions
@@ -1298,6 +1298,8 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses // Add Paula's Netromx (allows connects to different applications using Node call) (8)
// Add Netrom over TCP (8)
// Fix FRMR caused by sending SREJ when no frames outstanding (8)
+// Fix some issues with NetromX connects and Route Selection when running INP3 and NODES routing (9)
+// Fix connecting to a netrom node with c p node command (10)
#define CKernel
@@ -2737,7 +2737,7 @@ NoPort: while (cmdCopy[i] >= '0' && cmdCopy[i]<= '9')
i++;
- if (cmdCopy[i] != ' ')
+ if (i && cmdCopy[i] != ' ') // have an all digit param = probably a service
goto Downlink;
else
{
@@ -26,6 +26,7 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses #include "asmstrucs.h"
#include "tncinfo.h"
#include "cheaders.h"
+#include "kiss.h"
VOID __cdecl Debugprintf(const char * format, ...);
@@ -44,7 +45,9 @@ void MQTTReportSession(char * Msg); extern int MQTT;
extern time_t TimeLoaded;
-int UDPSeq = 1;
+uint16_t UDPSeq = 1;
+int linkSeq = 1;
+int cctSeq = 1;
extern SOCKET NodeAPISocket;
extern SOCKADDR_IN UDPreportdest;
@@ -149,6 +152,7 @@ void hookL2SessionAccepted(int Port, char * remotecall, char * ourcall, struct _ int udplen;
L2CONNECTSIN++;
+ LINK->apiSeq = linkSeq++;
LINK->lastStatusSentTime = LINK->ConnectTime = time(NULL);
LINK->bytesTXed = LINK->bytesRXed = LINK->framesResent = LINK->framesRXed = LINK->framesTXed = 0;
@@ -161,8 +165,8 @@ void hookL2SessionAccepted(int Port, char * remotecall, char * ourcall, struct _ {
LINK->lastStatusSentTime = time(NULL);
- udplen = sprintf(UDPMsg, "{\"@type\":\"LinkUpEvent\", \"node\": \"%s\", \"id\": %d, \"direction\": \"incoming\", \"port\": \"%d\", \"remote\": \"%s\", \"local\": \"%s\"}",
- NODECALLLOPPED, UDPSeq++, LINK->LINKPORT->PORTNUMBER, LINK->callingCall, LINK->receivingCall);
+ udplen = sprintf(UDPMsg, "{\"@type\":\"LinkUpEvent\", \"node\": \"%s\", \"id\": %d, \"direction\": \"incoming\", \"port\": \"%d\", \"remote\": \"%s\", \"local\": \"%s\", \"isRF\": %s}",
+ NODECALLLOPPED, LINK->apiSeq, LINK->LINKPORT->PORTNUMBER, LINK->callingCall, LINK->receivingCall, (LINK->LINKPORT->isRF)?"true":"false");
// Debugprintf(UDPMsg);
@@ -238,13 +242,14 @@ void hookL2SessionConnected(struct _LINKTABLE * LINK) int udplen;
L2CONNECTSOUT++;
+ LINK->apiSeq = linkSeq++;
if (NodeAPISocket)
{
LINK->lastStatusSentTime = time(NULL);
- udplen = sprintf(UDPMsg, "{\"@type\":\"LinkUpEvent\", \"node\": \"%s\", \"id\": %d, \"direction\": \"outgoing\", \"port\": \"%d\", \"remote\": \"%s\", \"local\": \"%s\"}",
- NODECALLLOPPED, UDPSeq++, LINK->LINKPORT->PORTNUMBER, LINK->callingCall, LINK->receivingCall);
+ udplen = sprintf(UDPMsg, "{\"@type\":\"LinkUpEvent\", \"node\": \"%s\", \"id\": %d, \"direction\": \"outgoing\", \"port\": \"%d\", \"remote\": \"%s\", \"local\": \"%s\", \"isRF\": %s}",
+ NODECALLLOPPED, LINK->apiSeq, LINK->LINKPORT->PORTNUMBER, LINK->callingCall, LINK->receivingCall, (LINK->LINKPORT->isRF)?"true":"false");
// Debugprintf(UDPMsg);
@@ -268,20 +273,19 @@ void hookL2SessionClosed(struct _LINKTABLE * LINK, char * Reason, char * Directi if (strcmp(Direction, "Out") == 0)
udplen = sprintf(UDPMsg, "{\"@type\":\"LinkDownEvent\", \"node\": \"%s\", \"id\": %d, \"direction\": \"outgoing\", \"port\": \"%d\", \"remote\": \"%s\", \"local\": \"%s\","
"\"bytesSent\": %d, \"bytesRcvd\": %d, \"frmsSent\": %d, \"frmsRcvd\": %d, \"frmsQueued\": %d, \"frmsResent\": %d, \"reason\": \"%s\","
- " \"time\": %d, \"upForSecs\": %d, \"frmsQdPeak\": %d}",
- NODECALLLOPPED, UDPSeq++, LINK->LINKPORT->PORTNUMBER, LINK->receivingCall, LINK->callingCall,
+ " \"time\": %d, \"upForSecs\": %d, \"frmsQdPeak\": %d, \"isRF\": %s}",
+ NODECALLLOPPED, LINK->apiSeq, LINK->LINKPORT->PORTNUMBER, LINK->receivingCall, LINK->callingCall,
LINK->bytesTXed , LINK->bytesRXed, LINK->framesTXed, LINK->framesRXed, COUNT_AT_L2(LINK), LINK->framesResent, Reason,
- (int)Now, (int)Now - LINK->ConnectTime, LINK->maxQueued);
+ (int)Now, (int)Now - LINK->ConnectTime, LINK->maxQueued, (LINK->LINKPORT->isRF)?"true":"false");
else
udplen = sprintf(UDPMsg, "{\"@type\":\"LinkDownEvent\", \"node\": \"%s\", \"id\": %d, \"direction\": \"incoming\", \"port\": \"%d\", \"remote\": \"%s\", \"local\": \"%s\","
"\"bytesSent\": %d, \"bytesRcvd\": %d, \"frmsSent\": %d, \"frmsRcvd\": %d, \"frmsQueued\": %d, \"frmsResent\": %d, \"reason\": \"%s\","
- " \"time\": %d, \"upForSecs\": %d, \"frmsQdPeak\": %d}",
- NODECALLLOPPED, UDPSeq++, LINK->LINKPORT->PORTNUMBER, LINK->callingCall, LINK->receivingCall,
+ " \"time\": %d, \"upForSecs\": %d, \"frmsQdPeak\": %d, \"isRF\": %s}",
+ NODECALLLOPPED, LINK->apiSeq, LINK->LINKPORT->PORTNUMBER, LINK->callingCall, LINK->receivingCall,
LINK->bytesTXed , LINK->bytesRXed, LINK->framesTXed, LINK->framesRXed, COUNT_AT_L2(LINK), LINK->framesResent, Reason,
- (int)Now, (int)Now - LINK->ConnectTime, LINK->maxQueued);
+ (int)Now, (int)Now - LINK->ConnectTime, LINK->maxQueued, (LINK->LINKPORT->isRF)?"true":"false");
-
- Debugprintf(UDPMsg);
+// Debugprintf(UDPMsg);
sendto(NodeAPISocket, UDPMsg, udplen, 0, (struct sockaddr *)&UDPreportdest, sizeof(UDPreportdest));
}
@@ -309,22 +313,21 @@ void hookL2SessionStatus(struct _LINKTABLE * LINK) if (strcmp(LINK->Direction, "Out") == 0)
udplen = sprintf(UDPMsg, "{\"@type\":\"LinkStatus\", \"node\": \"%s\", \"id\": %d, \"direction\": \"outgoing\", \"port\": \"%d\", \"remote\": \"%s\", \"local\": \"%s\","
"\"bytesSent\": %d, \"bytesRcvd\": %d, \"frmsSent\": %d, \"frmsRcvd\": %d, \"frmsQueued\": %d, \"frmsResent\": %d,"
- "\"upForSecs\": %d, \"frmsQdPeak\": %d, \"bpsTxMean\": %d, \"bpsRxMean\": %d, \"frmQMax\": %d, \"l2rttMs\": %d}",
- NODECALLLOPPED, UDPSeq++, LINK->LINKPORT->PORTNUMBER, LINK->receivingCall, LINK->callingCall,
+ "\"upForSecs\": %d, \"frmsQdPeak\": %d, \"bpsTxMean\": %d, \"bpsRxMean\": %d, \"frmQMax\": %d, \"l2rttMs\": %d, \"isRF\": %s}",
+ NODECALLLOPPED, LINK->apiSeq, LINK->LINKPORT->PORTNUMBER, LINK->receivingCall, LINK->callingCall,
LINK->bytesTXed, LINK->bytesRXed, LINK->framesTXed, LINK->framesRXed, 0, LINK->framesResent,
- (int)Now - LINK->ConnectTime, LINK->maxQueued, bpsTx, bpsRx, LINK->intervalMaxQueued, LINK->RTT);
+ (int)Now - LINK->ConnectTime, LINK->maxQueued, bpsTx, bpsRx, LINK->intervalMaxQueued, LINK->RTT, (LINK->LINKPORT->isRF)?"true":"false");
else
udplen = sprintf(UDPMsg, "{\"@type\":\"LinkStatus\", \"node\": \"%s\", \"id\": %d, \"direction\": \"incoming\", \"port\": \"%d\", \"remote\": \"%s\", \"local\": \"%s\","
"\"bytesSent\": %d, \"bytesRcvd\": %d, \"frmsSent\": %d, \"frmsRcvd\": %d, \"frmsQueued\": %d, \"frmsResent\": %d,"
- "\"upForSecs\": %d, \"frmsQdPeak\": %d, \"bpsTxMean\": %d, \"bpsRxMean\": %d, \"frmQMax\": %d, \"l2rttMs\": %d}",
- NODECALLLOPPED, UDPSeq++, LINK->LINKPORT->PORTNUMBER, LINK->callingCall, LINK->receivingCall,
+ "\"upForSecs\": %d, \"frmsQdPeak\": %d, \"bpsTxMean\": %d, \"bpsRxMean\": %d, \"frmQMax\": %d, \"l2rttMs\": %d, \"isRF\": %s}",
+ NODECALLLOPPED, LINK->apiSeq, LINK->LINKPORT->PORTNUMBER, LINK->callingCall, LINK->receivingCall,
LINK->bytesTXed, LINK->bytesRXed, LINK->framesTXed, LINK->framesRXed, 0, LINK->framesResent,
- (int)Now - LINK->ConnectTime, LINK->maxQueued, bpsTx, bpsRx, LINK->intervalMaxQueued, LINK->RTT);
+ (int)Now - LINK->ConnectTime, LINK->maxQueued, bpsTx, bpsRx, LINK->intervalMaxQueued, LINK->RTT, (LINK->LINKPORT->isRF)?"true":"false");
LINK->intervalMaxQueued = 0;
- Debugprintf(UDPMsg);
-
+// Debugprintf(UDPMsg);
sendto(NodeAPISocket, UDPMsg, udplen, 0, (struct sockaddr *)&UDPreportdest, sizeof(UDPreportdest));
}
}
@@ -485,11 +488,17 @@ void IncomingL4ConnectionEvent(TRANSPORTENTRY * L4) char remotecall[64];
char ourcall[64];
char circuitinfo[32];
+ int Service = L4->Service;
// CACK sent to CREQ
+ L4->apiSeq = cctSeq++;
+ strcpy(L4->Direction, "incoming");
+
if (NodeAPISocket)
{
+ L4->lastStatusSentTime = time(NULL);
+
remotecall[ConvFromAX25(L4->L4TARGET.DEST->DEST_CALL, remotecall)] = 0;
// remotecall[ConvFromAX25(L4->L4USER, remotecall)] = 0;
ourcall[ConvFromAX25(L4->L4MYCALL, ourcall)] = 0;
@@ -499,10 +508,16 @@ void IncomingL4ConnectionEvent(TRANSPORTENTRY * L4) sprintf(circuitinfo, ":%02x%02x", L4->CIRCUITINDEX, L4->CIRCUITID);
strcat(ourcall, circuitinfo);
-
- udplen = sprintf(UDPMsg, "{\"@type\": \"CircuitUpEvent\", \"node\": \"%s\", \"id\": %d, \"direction\": \"incoming\","
+
+ if (Service == -1)
+ udplen = sprintf(UDPMsg, "{\"@type\": \"CircuitUpEvent\", \"node\": \"%s\", \"id\": %d, \"direction\": \"incoming\", "
+ "\"remote\": \"%s\", \"local\": \"%s\"}",
+ NODECALLLOPPED, L4->apiSeq, remotecall, ourcall);
+ else
+ udplen = sprintf(UDPMsg, "{\"@type\": \"CircuitUpEvent\", \"node\": \"%s\", \"id\": %d, \"direction\": \"incoming\", "
"\"service\": %d, \"remote\": \"%s\", \"local\": \"%s\"}",
- NODECALLLOPPED, UDPSeq++, L4->Service, remotecall, ourcall);
+ NODECALLLOPPED, L4->apiSeq, Service, remotecall, ourcall);
+
// Debugprintf(UDPMsg);
sendto(NodeAPISocket, UDPMsg, udplen, 0, (struct sockaddr *)&UDPreportdest, sizeof(UDPreportdest));
@@ -517,11 +532,18 @@ void OutgoingL4ConnectionEvent(TRANSPORTENTRY * L4) char remotecall[64];
char ourcall[64];
char circuitinfo[32];
+ int Service = L4->Service;
// CACK received
+ strcpy(L4->Direction, "outgoing");
+
+ L4->apiSeq = cctSeq++;
+
if (NodeAPISocket)
{
+ L4->lastStatusSentTime = time(NULL);
+
remotecall[ConvFromAX25(L4->L4TARGET.DEST->DEST_CALL, remotecall)] = 0;
// remotecall[ConvFromAX25(L4->L4USER, remotecall)] = 0;
ourcall[ConvFromAX25(L4->L4MYCALL, ourcall)] = 0;
@@ -532,9 +554,14 @@ void OutgoingL4ConnectionEvent(TRANSPORTENTRY * L4) sprintf(circuitinfo, ":%02x%02x", L4->CIRCUITID, L4->CIRCUITINDEX);
strcat(ourcall, circuitinfo);
- udplen = sprintf(UDPMsg, "{\"@type\": \"CircuitUpEvent\", \"node\": \"%s\", \"id\": %d, \"direction\": \"outgoing\","
+ if (Service == -1)
+ udplen = sprintf(UDPMsg, "{\"@type\": \"CircuitUpEvent\", \"node\": \"%s\", \"id\": %d, \"direction\": \"outgoing\", "
+ "\"remote\": \"%s\", \"local\": \"%s\"}",
+ NODECALLLOPPED, L4->apiSeq, remotecall, ourcall);
+ else
+ udplen = sprintf(UDPMsg, "{\"@type\": \"CircuitUpEvent\", \"node\": \"%s\", \"id\": %d, \"direction\": \"outgoing\", "
"\"service\": %d, \"remote\": \"%s\", \"local\": \"%s\"}",
- NODECALLLOPPED, UDPSeq++, L4->Service, remotecall, ourcall);
+ NODECALLLOPPED, L4->apiSeq, Service, remotecall, ourcall);
// Debugprintf(UDPMsg);
sendto(NodeAPISocket, UDPMsg, udplen, 0, (struct sockaddr *)&UDPreportdest, sizeof(UDPreportdest));
@@ -592,7 +619,7 @@ void L4DisconnectEvent(TRANSPORTENTRY * L4, char * Direction, char * Reason) udplen = sprintf(UDPMsg, "{\"@type\": \"CircuitDownEvent\", \"node\": \"%s\", \"id\": %d, \"direction\": \"%s\","
"\"service\": %d, \"remote\": \"%s\", \"local\": \"%s\", \"segsSent\": %d, \"segsRcvd\": %d, \"segsResent\": %d, \"segsQueued\": %d, \"reason\": \"%s\"}",
- NODECALLLOPPED, UDPSeq++, Direction, 0, remotecall, ourcall,L4->segsSent, L4->segsRcvd, L4->segsResent, Count, Reason);
+ NODECALLLOPPED, L4->apiSeq, Direction, 0, remotecall, ourcall,L4->segsSent, L4->segsRcvd, L4->segsResent, Count, Reason);
// Debugprintf(UDPMsg);
sendto(NodeAPISocket, UDPMsg, udplen, 0, (struct sockaddr *)&UDPreportdest, sizeof(UDPreportdest));
@@ -608,11 +635,16 @@ void L4StatusSeport(TRANSPORTENTRY * L4) char nodecall[16];
char circuitinfo[32];
int Count;
+ time_t Now = time(NULL);
+ int Service = L4->Service;
- // CACK received
+
+
+ // Regular Status reports
if (NodeAPISocket)
{
+ L4->lastStatusSentTime = Now;
nodecall[ConvFromAX25(L4->L4TARGET.DEST->DEST_CALL, nodecall)] = 0;
remotecall[ConvFromAX25(L4->L4USER, remotecall)] = 0;
ourcall[ConvFromAX25(L4->L4MYCALL, ourcall)] = 0;
@@ -628,10 +660,15 @@ void L4StatusSeport(TRANSPORTENTRY * L4) Count = CountFramesQueuedOnSession(L4->L4CROSSLINK);
else
Count = CountFramesQueuedOnSession(L4);
-
- udplen = sprintf(UDPMsg, "{\"@type\": \"CircuitStatus\", \"node\": \"%s\", \"id\": %d, \"direction\": \"outgoing\","
- "\"service\": %d, \"remote\": %s, \"local\": \"%s\", \"segsSent\": %d, \"segsRcvd\": %d, \"segsResent\": %d, \"segsQueued\": %d}",
- NODECALLLOPPED, UDPSeq++, 0, remotecall, ourcall,L4->segsSent, L4->segsRcvd, L4->segsResent, Count);
+
+ if (Service == -1)
+ udplen = sprintf(UDPMsg, "{\"@type\": \"CircuitStatus\", \"node\": \"%s\", \"id\": %d, \"direction\": \"%s\","
+ "\"upForSecs\": %d,\"remote\": \"%s\", \"local\": \"%s\", \"segsSent\": %d, \"segsRcvd\": %d, \"segsResent\": %d, \"segsQueued\": %d}",
+ NODECALLLOPPED, L4->apiSeq, L4->Direction, Now - L4->ConnectTime, remotecall, ourcall,L4->segsSent, L4->segsRcvd, L4->segsResent, Count);
+ else
+ udplen = sprintf(UDPMsg, "{\"@type\": \"CircuitStatus\", \"node\": \"%s\", \"id\": %d, \"direction\": \"%s\","
+ "\"upForSecs\": %d, \"service\": %d, \"remote\": \"%s\", \"local\": \"%s\", \"segsSent\": %d, \"segsRcvd\": %d, \"segsResent\": %d, \"segsQueued\": %d}",
+ NODECALLLOPPED, L4->apiSeq, L4->Direction, Now - L4->ConnectTime, Service, remotecall, ourcall,L4->segsSent, L4->segsRcvd, L4->segsResent, Count);
// Debugprintf(UDPMsg);
sendto(NodeAPISocket, UDPMsg, udplen, 0, (struct sockaddr *)&UDPreportdest, sizeof(UDPreportdest));
@@ -713,7 +750,12 @@ void APIL2Trace(struct _MESSAGE * Message, char * Dirn) int UFlag = 0;
int NS;
int NR;
+ struct PORTCONTROL * PORT = GetPortTableEntryFromPortNum(Message->PORT);
+ time_t Now = time(NULL);
+
+ if (PORT == 0)
+ return;
if ((Message->ORIGIN[6] & 1) == 0) // Digis
return;
@@ -734,7 +776,6 @@ void APIL2Trace(struct _MESSAGE * Message, char * Dirn) if ((Message->ORIGIN[6] & 1) == 0) // Digis - ignore for now
return;
-
if ((Message->DEST[6] & 0x80) == 0 && (Message->ORIGIN[6] & 0x80) == 0)
strcpy(CR, "V1");
else if ((Message->DEST[6] & 0x80))
@@ -857,9 +898,9 @@ void APIL2Trace(struct _MESSAGE * Message, char * Dirn) // Common to all frame types
udplen = snprintf(UDPMsg, 2048,
- "{\"@type\": \"L2Trace\", \"dirn\": \"%s\", \"reportFrom\": \"%s\", \"port\": \"%d\", \"srce\": \"%s\", \"dest\": \"%s\", \"ctrl\": %d,"
+ "{\"@type\": \"L2Trace\", \"serial\": %d, \"time\": %d, \"dirn\": \"%s\", \"isRF\": %s, \"reportFrom\": \"%s\", \"port\": \"%d\", \"srce\": \"%s\", \"dest\": \"%s\", \"ctrl\": %d,"
"\"l2Type\": \"%s\", \"modulo\": 8, \"cr\": \"%s\"",
- Dirn, NODECALLLOPPED, Message->PORT, srcecall, destcall, Message->CTL, Type, CR);
+ UDPSeq++, (int)Now, Dirn, (PORT->isRF)?"true":"false", NODECALLLOPPED, Message->PORT, srcecall, destcall, Message->CTL, Type, CR);
if (UIFlag)
{
@@ -917,6 +958,48 @@ void APIL2Trace(struct _MESSAGE * Message, char * Dirn) }
+ //"@type" = @L3Trace, reportFrom, time, dirn,
+
+void NetromTCPTrace(struct _MESSAGE * Message, char * Dirn)
+{
+ char UDPMsg[2048];
+ int udplen;
+ time_t Now = time(NULL);
+ int iLen = Message->LENGTH - (15 + MSGHDDRLEN);
+ int isRF = 0;
+
+
+ udplen = snprintf(UDPMsg, 2048,
+ "{\"@type\": \"L3Trace\", \"serial\": %d, \"time\": %d, \"dirn\": \"%s\", \"isRF\": %s, \"reportFrom\": \"%s\", \"port\": %d",
+ UDPSeq++, (int)Now, Dirn, (isRF)?"true":"false", NODECALLLOPPED, Message->PORT);
+
+
+ udplen += snprintf(&UDPMsg[udplen], 2048 - udplen,
+ ", \"ilen\": %d, \"pid\": %d, \"ptcl\": \"%s\"",
+ iLen, Message->PID, PIDtoText(Message->PID));
+
+ if (Message->PID == NETROM_PID)
+ {
+ int n = decodeNETROMIFrame(Message->L2DATA, iLen, &UDPMsg[udplen], 2048 - udplen);
+
+ if (n == 0)
+ return; // Can't decode so don't trace anything;
+
+ udplen += n;
+ }
+
+
+
+ UDPMsg[udplen++] = '}';
+ UDPMsg[udplen] = 0;
+// Debugprintf(UDPMsg);
+ sendto(NodeAPISocket, UDPMsg, udplen, 0, (struct sockaddr *)&UDPreportdest, sizeof(UDPreportdest));
+
+}
+
+
+
+
int decodeNETROMUIMsg(unsigned char * Msg, int iLen, char * Buffer, int BufferLen)
{
int Len = 0;
@@ -943,7 +1026,7 @@ int decodeNETROMUIMsg(unsigned char * Msg, int iLen, char * Buffer, int BufferLe Msg += 7; // to first field
- Len = snprintf(Buffer, BufferLen, ", \"l3Type\": \"Routing info\", \"type\": \"NODES\", \"nodes\": [");
+ Len = snprintf(Buffer, BufferLen, ", \"l3Type\": \"Routing info\", \"type\": \"NODES\", \"fromAlias\": \"%s\", \"nodes\": [", Alias);
iLen -= 7; //Header, mnemonic and signature length
@@ -73,6 +73,7 @@ void OutgoingL4ConnectionEvent(TRANSPORTENTRY * L4); void IncomingL4ConnectionEvent(TRANSPORTENTRY * L4);
void L4DisconnectEvent(TRANSPORTENTRY * L4, char * Direction, char * Reason);
VOID TCPNETROMSend(struct ROUTE * Route, struct _L3MESSAGEBUFFER * Frame);
+void L4StatusSeport(TRANSPORTENTRY * L4);
static UINT APPLMASK;
@@ -89,6 +90,8 @@ extern int L2Compress; extern int L2CompMaxframe;
extern int L2CompPaclen;
+int sessionStatusInterval = 300; // 5 mins
+
// L4 Flags Values
#define DISCPENDING 8 // SEND DISC WHEN ALL DATA ACK'ED
@@ -1128,6 +1131,7 @@ VOID L4TimerProc() TRANSPORTENTRY * L4 = L4TABLE;
TRANSPORTENTRY * Partner;
int MaxLinks = MAXLINKS;
+ time_t Now = time(NULL);
while (n--)
{
@@ -1136,6 +1140,12 @@ VOID L4TimerProc() L4++;
continue;
}
+
+ // Check for Status report time
+
+ if (L4->lastStatusSentTime && (Now - L4->lastStatusSentTime) > sessionStatusInterval)
+ L4StatusSeport(L4);
+
// CHECK FOR L4BUSY SET AND NO LONGER BUSY
@@ -2261,6 +2271,14 @@ VOID FRAMEFORUS(struct _LINKTABLE * LINK, L3MESSAGEBUFFER * L3MSG, int ApplMask, return;
}
+ // if connect to service don't send connected to node messsage as service will send own message
+
+// if (L4->Service)
+// {
+// ReleaseBuffer(L3MSG);
+// return;
+// }
+
Msg = (PDATAMESSAGE)L3MSG; // reuse input buffer
Msg->PID = 0xf0;
diff --git a/NETROMTCP.c b/NETROMTCP.c index 63c0494..f756621 100644 --- a/NETROMTCP.c +++ b/NETROMTCP.c @@ -59,6 +59,9 @@ BOOL FindNeighbour(UCHAR * Call, int Port, struct ROUTE ** REQROUTE); VOID NETROMMSG(struct _LINKTABLE * LINK, L3MESSAGEBUFFER * L3MSG);
int BPQTRACE(MESSAGE * Msg, BOOL TOAPRS);
VOID L3LINKCLOSED(struct _LINKTABLE * LINK, int Reason);
+void NetromTCPTrace(struct _MESSAGE * Message, char * Dirn);
+
+extern SOCKET NodeAPISocket;
struct NRTCPMsg
{
@@ -210,8 +213,11 @@ int NETROMOpenConnection(struct ROUTE * Route) {
struct NRTCPSTRUCT * Info;
struct ConnectionInfo * sockptr;
+ char farCall[10];
+
+ farCall[ConvFromAX25(Route->NEIGHBOUR_CALL, farCall)] = 0;
- Debugprintf("Opening NRTCP Connection");
+ Debugprintf("Opening NRTCP Connection to %s", farCall);
if (Route->TCPSession)
{
@@ -232,7 +238,7 @@ int NETROMOpenConnection(struct ROUTE * Route) return 0;
Info = Route->TCPSession = NRTCPInfo[sockptr->Number];
- memcpy(Info->Call, MYNETROMCALL, 10);
+ memcpy(Info->Call, farCall, 10);
Route->NEIGHBOUR_LINK = Info->LINK;
Info->Route = Route;
@@ -455,6 +461,7 @@ checkLen: if (memcmp(Info->Call, Msg->Call, 10) != 0)
{
+ Debugprintf("Mismatch");
// something wrong - maybe connection reused
}
@@ -491,6 +498,10 @@ checkLen: time(&Buffer->Timestamp);
BPQTRACE(Buffer, FALSE);
+
+ if(NodeAPISocket)
+ NetromTCPTrace(Buffer, "rcvd");
+
ReleaseBuffer(Buffer);
}
@@ -535,7 +546,7 @@ VOID TCPNETROMSend(struct ROUTE * Route, struct _L3MESSAGEBUFFER * Frame) {
Buffer->CHAIN = 0;
Buffer->CTL = 0;
- Buffer->PORT = Route->NEIGHBOUR_PORT | 128; // TX Flag
+ Buffer->PORT = Route->NEIGHBOUR_PORT;
ConvToAX25(Route->TCPSession->Call, Buffer->DEST);
ConvToAX25(MYNETROMCALL, Buffer->ORIGIN);
@@ -546,7 +557,13 @@ VOID TCPNETROMSend(struct ROUTE * Route, struct _L3MESSAGEBUFFER * Frame) Buffer->LENGTH = DataLen + 15 + MSGHDDRLEN;
time(&Buffer->Timestamp);
+ if(NodeAPISocket)
+ NetromTCPTrace(Buffer, "sent");
+
+ Buffer->PORT = Route->NEIGHBOUR_PORT | 128; // TX Flag
BPQTRACE(Buffer, FALSE);
+
+
ReleaseBuffer(Buffer);
}
@@ -10,8 +10,8 @@ #endif
-#define KVers 6,0,25,9
-#define KVerstring "6.0.25.9\0"
+#define KVers 6,0,25,11
+#define KVerstring "6.0.25.11\0"
#ifdef CKernel
diff --git a/asmstrucs.h b/asmstrucs.h index 89e5277..439b6f9 100644 --- a/asmstrucs.h +++ b/asmstrucs.h @@ -184,7 +184,13 @@ typedef struct _TRANSPORTENTRY int NRRID;
time_t NRRTime;
+ time_t ConnectTime;
+ char Direction[16]; // In or Out
+
int Service; // For Paula's Connnect to Service
+ int apiSeq; // for OARC event reporting
+ time_t lastStatusSentTime;
+
} TRANSPORTENTRY;
@@ -737,6 +743,7 @@ typedef struct PORTCONTROL UCHAR * BUSY; // % Active (Normally DCD active or TX)
int Hardware; // TNC H_TYPE. Copied here for access from application context
+ int isRF; // For API reporting. -1 is unspecified
} PORTCONTROLX, *PPORTCONTROL;
@@ -1004,6 +1011,7 @@ typedef struct _LINKTABLE char ApplName[16];
time_t lastStatusSentTime;
+ int apiSeq; // for OARC event reporting
} LINKTABLE;
@@ -38,6 +38,7 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses #include "cheaders.h"
#include "tncinfo.h"
#include "mqtt.h"
+#include "kiss.h"
VOID L2Routine(struct PORTCONTROL * PORT, PMESSAGE Buffer);
VOID ProcessIframe(struct _LINKTABLE * LINK, PDATAMESSAGE Buffer);
@@ -1017,6 +1018,7 @@ BOOL Start() PORT->INP3ONLY = PortRec->INP3ONLY;
PORT->ALLOWINP3 = PortRec->AllowINP3;
PORT->ENABLEINP3 = PortRec->EnableINP3;
+ PORT->isRF = PortRec->isRF;
PORT->PORTWINDOW = (UCHAR)PortRec->MAXFRAME;
@@ -2768,6 +2770,7 @@ VOID INITIALISEPORTS() {
char INITMSG[80];
struct PORTCONTROL * PORT = PORTTABLE;
+ struct PORTCONTROL * SAVEPORT;
while (PORT)
{
@@ -2775,7 +2778,68 @@ VOID INITIALISEPORTS() WritetoConsoleLocal(INITMSG);
PORT->PORTINITCODE(PORT);
- PORT = PORT->PORTPOINTER;
+ SAVEPORT=PORT;
+
+ // See if it is an RF port
+
+ if (PORT->isRF == -1) // Not set
+ {
+ // Try to determine if RF
+
+ if (PORT->PORTTYPE == 0)
+ {
+ struct KISSINFO * KISS = (struct KISSINFO *)PORT;
+ NPASYINFO Port;
+
+ if (KISS->FIRSTPORT && KISS->FIRSTPORT != KISS)
+ {
+ // Not first port on device
+
+ PORT = (struct PORTCONTROL *)KISS->FIRSTPORT;
+ }
+
+ Port = KISSInfo[PORT->PORTNUMBER];
+
+ if (Port)
+ {
+ // KISS like
+
+ if (PORT->PORTIPADDR.s_addr || PORT->KISSSLAVE)
+ {
+ // KISS over UDP or TCP
+
+ if (PORT->KISSTCP)
+ PORT->isRF = 1; // Assume TCP is RF (software modem)
+ else
+ PORT->isRF = 0; // Assuem UDP is Internet
+ }
+ else
+ PORT->isRF = 1; // Serial port
+ }
+ }
+ else if (PORT->PORTTYPE == 14) // Loopback
+ PORT->isRF = 0;
+
+ else if (PORT->PORTTYPE == 16) // External
+ {
+ if (PORT->PROTOCOL == 10) // 'HF' Port
+ {
+ struct TNCINFO * TNC = TNCInfo[PORT->PORTNUMBER];
+
+ if (TNC && TNC->Hardware == H_TELNET)
+ PORT->isRF = 0;
+ else
+ PORT->isRF = 1; // ARDOP etc
+ }
+ else
+ {
+ // External but not HF - AXIP, BPQETHER VKISS, ??
+
+ PORT->isRF = 0;
+ }
+ }
+ }
+ PORT = SAVEPORT->PORTPOINTER;
}
}
@@ -379,7 +379,8 @@ static char *pkeywords[] = "BCALL", "DIGIMASK", "NOKEEPALIVES", "COMPORT", "DRIVER", "WL2KREPORT", "UIONLY",
"UDPPORT", "IPADDR", "I2CBUS", "I2CDEVICE", "UDPTXPORT", "UDPRXPORT", "NONORMALIZE",
"IGNOREUNLOCKEDROUTES", "INP3ONLY", "TCPPORT", "RIGPORT", "PERMITTEDAPPLS", "HIDE",
-"SMARTID", "KISSCOMMAND", "SendtoM0LTEMap", "PortFreq", "M0LTEMapInfo", "QTSMPort", "ALLOWINP3", "ENABLEINP3"}; /* parameter keywords */
+"SMARTID", "KISSCOMMAND", "SendtoM0LTEMap", "PortFreq", "M0LTEMapInfo", "QTSMPort",
+"ALLOWINP3", "ENABLEINP3", "isRF"}; /* parameter keywords */
static void * poffset[] =
{
@@ -393,7 +394,8 @@ static void * poffset[] = &xxp.BCALL, &xxp.DIGIMASK, &xxp.DefaultNoKeepAlives, &xxp.IOADDR, &xxp.DLLNAME, &xxp.WL2K, &xxp.UIONLY,
&xxp.IOADDR, &xxp.IPADDR, &xxp.INTLEVEL, &xxp.IOADDR, &xxp.IOADDR, &xxp.ListenPort, &xxp.NoNormalize,
&xxp.IGNOREUNLOCKED, &xxp.INP3ONLY, &xxp.TCPPORT, &xxp.RIGPORT, &xxp.PERMITTEDAPPLS, &xxp.Hide,
-&xxp.SmartID, &xxp.KissParams, &xxp.SendtoM0LTEMap, &xxp.PortFreq, &xxp.M0LTEMapInfo, &xxp.QtSMPort, &xxp.AllowINP3, &xxp.EnableINP3}; /* offset for corresponding data in config file */
+&xxp.SmartID, &xxp.KissParams, &xxp.SendtoM0LTEMap, &xxp.PortFreq, &xxp.M0LTEMapInfo, &xxp.QtSMPort,
+&xxp.AllowINP3, &xxp.EnableINP3, &xxp.isRF}; /* offset for corresponding data in config file */
static int proutine[] =
{
@@ -407,7 +409,8 @@ static int proutine[] = 0, 1, 2, 18, 15, 16, 2,
1, 17, 1, 1, 1, 1, 2,
2, 2, 1, 1, 19, 2,
-1, 20, 1, 21, 22, 1, 1, 1}; /* routine to process parameter */
+1, 20, 1, 21, 22, 1,
+1, 1, 1}; /* routine to process parameter */
int PPARAMLIM = sizeof(proutine)/sizeof(int);
@@ -1820,6 +1823,7 @@ int ports(int i) }
xxp.SendtoM0LTEMap = 1; // Default to enabled
+ xxp.isRF = -1; // Default to undefined
while (endport == 0 && !feof(fp1))
{
diff --git a/configstructs.h b/configstructs.h index 013d725..fae9d30 100644 --- a/configstructs.h +++ b/configstructs.h @@ -83,6 +83,7 @@ struct PORTCONFIG int QtSMPort;
int AllowINP3;
int EnableINP3;
+ short isRF;
};
struct ROUTECONFIG
|
