From 52e35f45b4cfefc21707b42883dd1afa142ac7d4 Mon Sep 17 00:00:00 2001 From: Dave Hibberd Date: Sat, 22 Nov 2025 15:09:21 +0000 Subject: New upstream version 6.0.25.12+repack --- cMain.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 73 insertions(+), 6 deletions(-) (limited to 'cMain.c') diff --git a/cMain.c b/cMain.c index 74b6bc6..d592ecb 100644 --- a/cMain.c +++ b/cMain.c @@ -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); @@ -57,7 +58,7 @@ VOID L2SENDCOMMAND(struct _LINKTABLE * LINK, int CMD); void WritePacketLogThread(void * param); void hookNodeStarted(); void hookNodeRunning(); -void APIL2Trace(struct _MESSAGE * Message, char Dirn); +void APIL2Trace(struct _MESSAGE * Message, char * Dirn); #include "configstructs.h" @@ -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; @@ -1416,12 +1418,15 @@ BOOL Start() { ROUTE->TCPHost = Rcfg->tcphost; ROUTE->TCPPort = Rcfg->tcpport; + + ROUTE->TCPAddress = (struct addrinfo *)zalloc(sizeof(struct addrinfo)); + ROUTE->TCPAddress->ai_addr = (struct sockaddr *) zalloc(sizeof(struct sockaddr)); } Rcfg++; ROUTE++; } - + // SET UP INFO MESSAGE ptr2 = &cfg->C_INFOMSG[0]; @@ -2028,7 +2033,7 @@ VOID ReadNodes() ptr = strtok_s(NULL, seps, &Context); // INP3 if (ptr == NULL) continue; - if (ROUTE->NEIGHBOUR_FLAG == 0 || ROUTE->OtherendLocked == 0); // Not LOCKED ROUTE + if (ROUTE->NEIGHBOUR_FLAG == 0 || ROUTE->OtherendLocked == 0) // Not LOCKED ROUTE ROUTE->OtherendsRouteQual = atoi(ptr); ptr = strtok_s(NULL, seps, &Context); // INP3 @@ -2279,7 +2284,7 @@ VOID TIMERINTERRUPT() Message = (struct _MESSAGE *)Buffer; if(NodeAPISocket) - APIL2Trace(Message, 'T'); + APIL2Trace(Message, "sent"); Message->PORT |= 0x80; // Set TX Bit @@ -2394,7 +2399,7 @@ L2Packet: MQTTKISSRX(Buffer); if(NodeAPISocket &&PORT->PROTOCOL == 0) - APIL2Trace(Message, 'R'); + APIL2Trace(Message, "rcvd"); // Bridge if requested @@ -2765,6 +2770,7 @@ VOID INITIALISEPORTS() { char INITMSG[80]; struct PORTCONTROL * PORT = PORTTABLE; + struct PORTCONTROL * SAVEPORT; while (PORT) { @@ -2772,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; } } -- cgit v1.2.3