Update upstream source from tag 'upstream/6.0.25.12+repack'

Update to upstream version '6.0.25.12+repack'
with Debian dir 0b59d86e0b
This commit is contained in:
Hibby 2025-11-22 15:09:25 +00:00
commit 944fdfc524
10 changed files with 253 additions and 114 deletions

View file

@ -35,8 +35,6 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses
#include <fcntl.h> #include <fcntl.h>
//#include "vmm.h" //#include "vmm.h"
uint64_t INP3timeLoadedMS = 0;
extern int DEBUGINP3; extern int DEBUGINP3;
VOID SendNegativeInfo(); VOID SendNegativeInfo();
@ -64,11 +62,16 @@ static VOID SendNetFrame(struct ROUTE * Route, struct _L3MESSAGEBUFFER * Frame)
typedef struct _RTTMSG typedef struct _RTTMSG
{ {
UCHAR ID[7]; UCHAR ID[6];
UCHAR TXTIME[11]; UCHAR Space1;
UCHAR SMOOTHEDRTT[11]; UCHAR TXTIME[10];
UCHAR LASTRTT[11]; UCHAR Space2;
UCHAR POINTER[11]; UCHAR SMOOTHEDRTT[10];
UCHAR Space3;
UCHAR LASTRTT[10];
UCHAR Space4;
UCHAR RTTID[10];
UCHAR Space5;
UCHAR ALIAS[7]; UCHAR ALIAS[7];
UCHAR VERSION[12]; UCHAR VERSION[12];
UCHAR SWVERSION[9]; UCHAR SWVERSION[9];
@ -110,6 +113,8 @@ extern int RTTInterval; // 4 Minutes
int RTTRetries = 2; int RTTRetries = 2;
int RTTTimeout = 6; // 1 Min (Horizon is 1 min) int RTTTimeout = 6; // 1 Min (Horizon is 1 min)
uint32_t RTTID = 1;
VOID InitialiseRTT() VOID InitialiseRTT()
{ {
UCHAR temp[256] = ""; UCHAR temp[256] = "";
@ -161,6 +166,7 @@ VOID DeleteINP3Routes(struct ROUTE * Route)
Route->BCTimer = 0; Route->BCTimer = 0;
Route->Status = 0; Route->Status = 0;
Route->Timeout = 0; Route->Timeout = 0;
Route->NeighbourSRTT = 0;
Dest--; Dest--;
@ -340,8 +346,8 @@ VOID TellINP3LinkSetupFailed(struct ROUTE * Route)
VOID ProcessRTTReply(struct ROUTE * Route, struct _L3MESSAGEBUFFER * Buff) VOID ProcessRTTReply(struct ROUTE * Route, struct _L3MESSAGEBUFFER * Buff)
{ {
int RTT; uint32_t RTT;
unsigned int OrigTime; uint32_t OrigTime;
char Normcall[10]; char Normcall[10];
@ -349,10 +355,10 @@ VOID ProcessRTTReply(struct ROUTE * Route, struct _L3MESSAGEBUFFER * Buff)
Route->Timeout = 0; // Got Response Route->Timeout = 0; // Got Response
sscanf(&Buff->L4DATA[6], "%d", &OrigTime); sscanf(&Buff->L4DATA[6], "%u", &OrigTime);
RTT = (int)((GetTickCount() - INP3timeLoadedMS) / 10 - (OrigTime)); // We work internally in mS RTT = GetTickCountINP3() - OrigTime; // We work internally in mS
if (RTT > 60000) if (RTT > 60000 || RTT < 0)
return; // Ignore if more than 60 secs (why ??) return; // Ignore if more than 60 secs (why ??)
Route->RTT = RTT; Route->RTT = RTT;
@ -890,8 +896,8 @@ VOID UpdateRoute(struct DEST_LIST * Dest, struct INP3_DEST_ROUTE_ENTRY * ROUTEPT
VOID ProcessRTTMsg(struct ROUTE * Route, struct _L3MESSAGEBUFFER * Buff, int Len, int Port) VOID ProcessRTTMsg(struct ROUTE * Route, struct _L3MESSAGEBUFFER * Buff, int Len, int Port)
{ {
int OtherRTT; uint32_t OtherRTT;
int Dummy; uint32_t Dummy;
char * ptr; char * ptr;
struct _RTTMSG * RTTMsg = (struct _RTTMSG *)&Buff->L4DATA[0]; struct _RTTMSG * RTTMsg = (struct _RTTMSG *)&Buff->L4DATA[0];
char Normcall[10]; char Normcall[10];
@ -920,18 +926,28 @@ VOID ProcessRTTMsg(struct ROUTE * Route, struct _L3MESSAGEBUFFER * Buff, int Len
return; // We don't want to use INP3 return; // We don't want to use INP3
} }
// Extract other end's SRTT // Basic Validation - look for spaces in the right place
// Get SWVERSION to see if other end is old (Buggy) BPQ if ((RTTMsg->Space1 | RTTMsg->Space2 | RTTMsg->Space3 | RTTMsg->Space4 | RTTMsg->Space5) != ' ')
{
if (memcmp(RTTMsg->SWVERSION, "BPQ32001 ", 9) == 0) Debugprintf("Corrupt INP3 RTT Message %s", &Buff->L4DATA[0]);
Route->OldBPQ = 1; }
else else
Route->OldBPQ = 0; {
// Extract other end's SRTT
sscanf(&Buff->L4DATA[6], "%d %d", &Dummy, &OtherRTT); // Get SWVERSION to see if other end is old (Buggy) BPQ
Route->NeighbourSRTT = OtherRTT; if (memcmp(RTTMsg->SWVERSION, "BPQ32001 ", 9) == 0)
Route->OldBPQ = 1;
else
Route->OldBPQ = 0;
sscanf(&Buff->L4DATA[6], "%u %u", &Dummy, &OtherRTT);
if (OtherRTT < 60000) // Don't save suspect values
Route->NeighbourSRTT = OtherRTT;
}
// Look for $M and $H (MAXRTT MAXHOPS) // Look for $M and $H (MAXRTT MAXHOPS)
@ -945,6 +961,8 @@ VOID ProcessRTTMsg(struct ROUTE * Route, struct _L3MESSAGEBUFFER * Buff, int Len
if (ptr) if (ptr)
Route->RemoteMAXHOPS = atoi(ptr + 2); Route->RemoteMAXHOPS = atoi(ptr + 2);
// Echo Back to sender // Echo Back to sender
SendNetFrame(Route, Buff); SendNetFrame(Route, Buff);
@ -965,7 +983,8 @@ VOID SendRTTMsg(struct ROUTE * Route)
char Stamp[50]; char Stamp[50];
char Normcall[10]; char Normcall[10];
unsigned char temp[256]; unsigned char temp[256];
uint64_t sendTime; uint32_t sendTime;
int n;
Normcall[ConvFromAX25(Route->NEIGHBOUR_CALL, Normcall)] = 0; Normcall[ConvFromAX25(Route->NEIGHBOUR_CALL, Normcall)] = 0;
@ -985,14 +1004,21 @@ VOID SendRTTMsg(struct ROUTE * Route)
Msg->L4TXNO = 0; Msg->L4TXNO = 0;
Msg->L4FLAGS = L4INFO; Msg->L4FLAGS = L4INFO;
// The timestamp can possibly exceed 10 digits. INP3 only works on differece between send and received, so base can be reset safely. // Windows GetTickCount wraps every 54 days or so. INP3 doesn't care, so long as the edge
// case where timer wraps between sending msg and getting response is ignored
// For platform independence use GetTickCountINP3() and map as appropriate
sendTime = ((uint64_t)GetTickCount() - INP3timeLoadedMS) / 10; // 10mS units sendTime = GetTickCountINP3(); // 10mS units
if (sendTime > 9999999999) sprintf(Stamp, "%10u %10d %10d %10d ", sendTime, Route->SRTT, Route->RTT, RTTID++);
sendTime = INP3timeLoadedMS = 0;
sprintf(Stamp, "%10llu %10d %10d %10d ", sendTime, Route->SRTT, Route->RTT, 0); n = strlen(Stamp);
if (n != 44)
{
Debugprintf("Trying to send corrupt RTT message %s", Stamp);
return;
}
memcpy(RTTMsg.TXTIME, Stamp, 44); memcpy(RTTMsg.TXTIME, Stamp, 44);
@ -1209,6 +1235,7 @@ int SendRIPTimer()
} }
L2SETUPCROSSLINKEX(Route, 2); // Only try SABM twice L2SETUPCROSSLINKEX(Route, 2); // Only try SABM twice
Route->NeighbourSRTT = 0; // just in case!
Route->LastConnectAttempt = REALTIMETICKS; Route->LastConnectAttempt = REALTIMETICKS;

View file

@ -1300,6 +1300,8 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses
// Fix FRMR caused by sending SREJ when no frames outstanding (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 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) // Fix connecting to a netrom node with c p node command (10)
// Add validation of INP3 RTT messages and various INP3 fixes (12)
// Change NetromX connect syntax to Service@Node to fix passing commands to local applications (12)
#define CKernel #define CKernel
@ -1540,7 +1542,6 @@ extern char ReportDest[7];
extern UCHAR ConfigDirectory[260]; extern UCHAR ConfigDirectory[260];
extern uint64_t INP3timeLoadedMS;
VOID __cdecl Debugprintf(const char * format, ...); VOID __cdecl Debugprintf(const char * format, ...);
VOID __cdecl Consoleprintf(const char * format, ...); VOID __cdecl Consoleprintf(const char * format, ...);
@ -2481,8 +2482,6 @@ FirstInit()
EnumProcessesPtr = (FARPROCX)GetProcAddress(ExtDriver,"EnumProcesses"); EnumProcessesPtr = (FARPROCX)GetProcAddress(ExtDriver,"EnumProcesses");
} }
INP3timeLoadedMS = GetTickCount();
srand(time(NULL)); srand(time(NULL));
INITIALISEPORTS(); INITIALISEPORTS();

184
Cmd.c
View file

@ -838,13 +838,14 @@ BOOL cATTACHTOBBS(TRANSPORTENTRY * Session, UINT Mask, int Paclen, int * AnySess
return FALSE; return FALSE;
} }
void ConnecttoService(TRANSPORTENTRY * Session, char * Bufferptr, int ServiceIndex, char * Node, int Stay) void ConnecttoService(TRANSPORTENTRY * Session, char * Bufferptr, int Service, char * Node, int Stay)
{ {
struct DEST_LIST * Dest = DESTS; struct DEST_LIST * Dest = DESTS;
int n = MAXDESTS; int n = MAXDESTS;
int gotDest = 0; int gotDest = 0;
unsigned char axcall[7]; unsigned char axcall[7];
int Service = -1; char cmdName[80];
int i;
// Make Sure Node is Known // Make Sure Node is Known
@ -889,9 +890,20 @@ void ConnecttoService(TRANSPORTENTRY * Session, char * Bufferptr, int ServiceInd
Session->STAYFLAG = Stay; Session->STAYFLAG = Stay;
Service = SERVICES[ServiceIndex].ServiceNo; // Get command name if a named command
Bufferptr = Cmdprintf(Session, Bufferptr, "Connecting to Service %s on Node %s \r", SERVICES[ServiceIndex].ServiceName, Node); sprintf(cmdName, "%d", Service); // default to number
for (i = 0; i < NUMBEROFSSERVICES; i++)
{
if (SERVICES[i].ServiceNo == Service)
{
strcpy(cmdName, SERVICES[i].ServiceName);
break;
}
}
Bufferptr = Cmdprintf(Session, Bufferptr, "Connecting to Service %s on Node %s \r", cmdName, Node);
DoNetromConnect(Session, Bufferptr, Dest, 0, Service); DoNetromConnect(Session, Bufferptr, Dest, 0, Service);
@ -930,7 +942,7 @@ int checkifService(TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTail, s
{ {
if (strcmp(APPName, SERVICES[i].ServiceName) == 0) if (strcmp(APPName, SERVICES[i].ServiceName) == 0)
{ {
ConnecttoService(Session, Bufferptr, i, ptr, Stay); ConnecttoService(Session, Bufferptr, SERVICES[i].ServiceNo, ptr, Stay);
return 1; return 1;
} }
} }
@ -948,7 +960,6 @@ VOID APPLCMD(TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTail, struct
char * ptr1, *ptr2; char * ptr1, *ptr2;
int n = 12; int n = 12;
BOOL Stay = FALSE; BOOL Stay = FALSE;
char * ptr, *Context;
// Copy Appl and Null Terminate // Copy Appl and Null Terminate
@ -967,14 +978,17 @@ VOID APPLCMD(TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTail, struct
return; return;
} }
ptr = strtok_s(CmdTail, " ", &Context);
// ptr is first param. Context is rest of string; if (CmdTail[0] == 'S')
Stay = TRUE;
// could be Node for NETROMX connect or S flag
// We now use service@node, so can't get here
/*
if (ptr) if (ptr)
{ {
// could be Node for NETROMX connect or S flag
int i; int i;
if (strlen(ptr) > 1) if (strlen(ptr) > 1)
@ -984,6 +998,8 @@ VOID APPLCMD(TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTail, struct
// See if APPL is one of Paula's service // See if APPL is one of Paula's service
for (i = 0; i < NUMBEROFSSERVICES; i++) for (i = 0; i < NUMBEROFSSERVICES; i++)
{ {
if (strcmp(APPName, SERVICES[i].ServiceName) == 0) if (strcmp(APPName, SERVICES[i].ServiceName) == 0)
@ -1003,7 +1019,7 @@ VOID APPLCMD(TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTail, struct
else if (ptr[0] == 'S') else if (ptr[0] == 'S')
Session->STAYFLAG = Stay; Session->STAYFLAG = Stay;
} }
*/
memcpy(Session->APPL, CMD->String, 12); memcpy(Session->APPL, CMD->String, 12);
// SEE IF THERE IS AN ALIAS DEFINDED FOR THIS COMMAND // SEE IF THERE IS AN ALIAS DEFINDED FOR THIS COMMAND
@ -2572,6 +2588,56 @@ VOID CMDC00(TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTail, struct C
return; return;
} }
// See if NETROMX connect c service@node
if (strchr(ptr, '@'))
{
// We now use service@node, unlike xr
char * Context1;
char * Cmd = strtok_s(ptr, "@", &Context1);
char * Node = strtok_s(NULL, " ", &Context1);
int i;
int Stay = 0;
if (Context1 && Context1[0] == 'S')
Session->STAYFLAG = Stay;
for (i = 0; i < NUMBEROFSSERVICES; i++)
{
if (strcmp(Cmd, SERVICES[i].ServiceName) == 0)
{
if (Node)
{
ConnecttoService(Session, Bufferptr, SERVICES[i].ServiceNo, Node, Stay);
return;
}
}
}
// May be numeric service
for (i = 0; i < strlen(Cmd); i++)
{
if (!isdigit(Cmd[i]))
break;
}
if (i == strlen(Cmd))
{
if (Node)
{
ConnecttoService(Session, Bufferptr, atoi(Cmd), Node, Stay);
return;
}
}
Bufferptr = Cmdprintf(Session, Bufferptr, "Invalid NetromX command\r");
SendCommandReply(Session, REPLYBUFFER, (int)(Bufferptr - (char *)REPLYBUFFER));
return;
}
Port = atoi(ptr); Port = atoi(ptr);
if (Port) if (Port)
@ -2671,7 +2737,6 @@ NoPort:
// SEE IF CALL TO ANY OF OUR HOST SESSIONS - UNLESS DIGIS SPECIFIED // SEE IF CALL TO ANY OF OUR HOST SESSIONS - UNLESS DIGIS SPECIFIED
// if (axcalls[7] == 0 && axcalls[9])
if (axcalls[7] == 0) if (axcalls[7] == 0)
{ {
// If this connect is as a result of a command alias, don't check appls or we will loop // If this connect is as a result of a command alias, don't check appls or we will loop
@ -2723,33 +2788,7 @@ NoPort:
} }
} }
// if no digis see if connect to known node. if (axcalls[7] == 0)
// But now could have a single numeric param as a service number (Paula's Netromx)
// cmdCopy is command tail (after call)
// Make sure field is numeric
if (cmdCopy[0] != ' ')
{
i = 0;
while (cmdCopy[i] >= '0' && cmdCopy[i]<= '9')
i++;
if (i && cmdCopy[i] != ' ') // have an all digit param = probably a service
goto Downlink;
else
{
if (i > 0) // Some digits
{
haveService = 1;
Service = atoi(cmdCopy);
}
}
}
if (axcalls[7] == 0 || haveService)
{ {
// SEE IF CALL TO ANOTHER NODE // SEE IF CALL TO ANOTHER NODE
@ -2792,9 +2831,6 @@ Downlink:
// L2 NEEDS PORT NUMBER // L2 NEEDS PORT NUMBER
Bufferptr = Cmdprintf(Session, Bufferptr, "Downlink connect needs port number - C P CALLSIGN\r"); Bufferptr = Cmdprintf(Session, Bufferptr, "Downlink connect needs port number - C P CALLSIGN\r");
// Send Port List
SendCommandReply(Session, REPLYBUFFER, (int)(Bufferptr - (char *)REPLYBUFFER)); SendCommandReply(Session, REPLYBUFFER, (int)(Bufferptr - (char *)REPLYBUFFER));
return; return;
} }
@ -5082,6 +5118,7 @@ VOID DoTheCommand(TRANSPORTENTRY * Session)
int n; int n;
int i, Service = -1; int i, Service = -1;
char * Cmd, *Node, *Context; char * Cmd, *Node, *Context;
int Stay = 0;
ptr1 = &COMMANDBUFFER[0]; // ptr1 = &COMMANDBUFFER[0]; //
@ -5176,28 +5213,47 @@ VOID DoTheCommand(TRANSPORTENTRY * Session)
// See if a NETROMX Service // See if a NETROMX Service
Cmd = strtok_s(ptr1, " ", &Context); // We now use service@node, unlike xr
Node = strtok_s(NULL, " ", &Context);
for (i = 0; i < NUMBEROFSSERVICES; i++) if (strchr(ptr1, '@'))
{ {
if (strcmp(Cmd, SERVICES[i].ServiceName) == 0) Cmd = strtok_s(ptr1, "@", &Context);
{ Node = strtok_s(NULL, " ", &Context);
int Stay = 0;
if (Cmd && Node)
{
if (Context && Context[0] == 'S') if (Context && Context[0] == 'S')
Session->STAYFLAG = Stay; Session->STAYFLAG = Stay;
if (Node) for (i = 0; i < NUMBEROFSSERVICES; i++)
{ {
ConnecttoService(Session, ReplyPointer, i, Node, Stay); if (strcmp(Cmd, SERVICES[i].ServiceName) == 0)
return; {
ConnecttoService(Session, ReplyPointer, SERVICES[i].ServiceNo, Node, Stay);
return;
}
} }
// Connecting to service on local node - msy be possible sometime // May be numeric service
}
}
for (i = 0; i < strlen(Cmd); i++)
{
if (!isdigit(Cmd[i]))
break;
}
if (i == strlen(Cmd))
{
ConnecttoService(Session, ReplyPointer, atoi(Cmd), Node, Stay);
return;
}
}
ReplyPointer = Cmdprintf(Session, ReplyPointer, "Invalid NetromX command\r");
SendCommandReply(Session, REPLYBUFFER, (int)(ReplyPointer - (char *)REPLYBUFFER));
return;
}
Session->BADCOMMANDS++; Session->BADCOMMANDS++;
if (Session->BADCOMMANDS > 6) // TOO MANY ERRORS if (Session->BADCOMMANDS > 6) // TOO MANY ERRORS
@ -5214,19 +5270,19 @@ VOID DoTheCommand(TRANSPORTENTRY * Session)
ptr1 += CMDERRLEN; ptr1 += CMDERRLEN;
SendCommandReply(Session, Buffer, (int)(ptr1 - (char *)Buffer)); SendCommandReply(Session, Buffer, (int)(ptr1 - (char *)Buffer));
} }
VOID StatsTimer() VOID StatsTimer()
{
struct PORTCONTROL * PORT = PORTTABLE;
uint64_t sum, sum2;
// Interval is 60 secs
while(PORT)
{ {
int index = PORT->StatsPointer++; struct PORTCONTROL * PORT = PORTTABLE;
uint64_t sum, sum2;
// Interval is 60 secs
while(PORT)
{
int index = PORT->StatsPointer++;
if (index == 1439) if (index == 1439)
PORT->StatsPointer = 0; // Cyclic through 24 hours (1440 Mins) PORT->StatsPointer = 0; // Cyclic through 24 hours (1440 Mins)

View file

@ -944,9 +944,9 @@ void APIL2Trace(struct _MESSAGE * Message, char * Dirn)
// supervisory // supervisory
if (PF[0]) if (PF[0])
udplen += snprintf(&UDPMsg[udplen], 2048 - udplen, ", \"pf\": \"%s\", \"rseq\": %d, \"tseq\": %d", PF, NR, NS); udplen += snprintf(&UDPMsg[udplen], 2048 - udplen, ", \"pf\": \"%s\", \"rseq\": %d", PF, NR);
else else
udplen += snprintf(&UDPMsg[udplen], 2048 - udplen, ", \"rseq\": %d, \"tseq\": %d", NR, NS); udplen += snprintf(&UDPMsg[udplen], 2048 - udplen, ", \"rseq\": %d", NR);
} }

View file

@ -1929,19 +1929,34 @@ void L3SWAPADDRESSES(L3MESSAGEBUFFER * L3MSG)
void SendConNAK(struct _LINKTABLE * LINK, L3MESSAGEBUFFER * L3MSG) void SendConNAK(struct _LINKTABLE * LINK, L3MESSAGEBUFFER * L3MSG)
{ {
struct TNCINFO * TNC;
L3MSG->L4FLAGS = L4CACK | L4BUSY; // REJECT L3MSG->L4FLAGS = L4CACK | L4BUSY; // REJECT
L3MSG->L4DATA[0] = 0; // WINDOW L3MSG->L4DATA[0] = 0; // WINDOW
L3SWAPADDRESSES(L3MSG); L3SWAPADDRESSES(L3MSG);
L3MSG->L3TTL = L3LIVES; L3MSG->L3TTL = L3LIVES;
C_Q_ADD(&LINK->TX_Q, L3MSG); TNC = LINK->LINKPORT->TNC;
if (LINK->NEIGHBOUR && LINK->NEIGHBOUR->TCPPort)
{
TCPNETROMSend(LINK->NEIGHBOUR, L3MSG);
ReleaseBuffer(L3MSG);
}
else if (TNC && TNC->NetRomMode)
SendVARANetromMsg(TNC, L3MSG);
else
C_Q_ADD(&LINK->TX_Q, L3MSG);
} }
VOID SendL4RESET(struct _LINKTABLE * LINK, L3MESSAGEBUFFER * L3MSG) VOID SendL4RESET(struct _LINKTABLE * LINK, L3MESSAGEBUFFER * L3MSG)
{ {
// Paula's extension // Paula's extension
struct TNCINFO * TNC;
L3MSG->L4RXNO = L3MSG->L4ID; L3MSG->L4RXNO = L3MSG->L4ID;
L3MSG->L4TXNO = L3MSG->L4INDEX; L3MSG->L4TXNO = L3MSG->L4INDEX;
@ -1951,7 +1966,19 @@ VOID SendL4RESET(struct _LINKTABLE * LINK, L3MESSAGEBUFFER * L3MSG)
L3MSG->L3TTL = L3LIVES; L3MSG->L3TTL = L3LIVES;
L3MSG->LENGTH = (int)(&L3MSG->L4DATA[0] - (UCHAR *)L3MSG); L3MSG->LENGTH = (int)(&L3MSG->L4DATA[0] - (UCHAR *)L3MSG);
C_Q_ADD(&LINK->TX_Q, L3MSG);
TNC = LINK->LINKPORT->TNC;
if (LINK->NEIGHBOUR && LINK->NEIGHBOUR->TCPPort)
{
TCPNETROMSend(LINK->NEIGHBOUR, L3MSG);
ReleaseBuffer(L3MSG);
}
else if (TNC && TNC->NetRomMode)
SendVARANetromMsg(TNC, L3MSG);
else
C_Q_ADD(&LINK->TX_Q, L3MSG);
} }

View file

@ -87,8 +87,6 @@ void CloseAllLinks();
void hookNodeClosing(char * Reason); void hookNodeClosing(char * Reason);
void NETROMTCPResolve(); void NETROMTCPResolve();
extern uint64_t INP3timeLoadedMS;
BOOL IncludesMail = FALSE; BOOL IncludesMail = FALSE;
BOOL IncludesChat = FALSE; BOOL IncludesChat = FALSE;
@ -861,8 +859,6 @@ int main(int argc, char * argv[])
if (!isatty(STDOUT_FILENO) || !isatty(STDIN_FILENO)) if (!isatty(STDOUT_FILENO) || !isatty(STDIN_FILENO))
Redirected = 1; Redirected = 1;
INP3timeLoadedMS = GetTickCount();
#endif #endif
printf("G8BPQ AX25 Packet Switch System Version %s %s\n", TextVerstring, Datestring); printf("G8BPQ AX25 Packet Switch System Version %s %s\n", TextVerstring, Datestring);

View file

@ -110,7 +110,7 @@ struct ConnectionInfo * AllocateNRTCPRec()
sockptr->SocketActive = TRUE; sockptr->SocketActive = TRUE;
sockptr->ConnectTime = sockptr->LastSendTime = time(NULL); sockptr->ConnectTime = sockptr->LastSendTime = time(NULL);
Debugprintf("NRTCP Allocated %d", i); // Debugprintf("NRTCP Allocated %d", i);
return sockptr; return sockptr;
} }
} }
@ -217,7 +217,7 @@ int NETROMOpenConnection(struct ROUTE * Route)
farCall[ConvFromAX25(Route->NEIGHBOUR_CALL, farCall)] = 0; farCall[ConvFromAX25(Route->NEIGHBOUR_CALL, farCall)] = 0;
Debugprintf("Opening NRTCP Connection to %s", farCall); // Debugprintf("Opening NRTCP Connection to %s", farCall);
if (Route->TCPSession) if (Route->TCPSession)
{ {
@ -366,14 +366,14 @@ void NETROMConnectionAccepted(struct ConnectionInfo * sockptr)
// Not sure we can do much here until first message arrives with callsign // Not sure we can do much here until first message arrives with callsign
sockptr->Connected = TRUE; sockptr->Connected = TRUE;
Debugprintf("NRTCP Connection Accepted"); // Debugprintf("NRTCP Connection Accepted");
} }
void NETROMConnected(struct ConnectionInfo * sockptr, SOCKET sock, struct NRTCPSTRUCT * Info) void NETROMConnected(struct ConnectionInfo * sockptr, SOCKET sock, struct NRTCPSTRUCT * Info)
{ {
// Connection Complete // Connection Complete
Debugprintf("NRTCP Connected"); // Debugprintf("NRTCP Connected");
sockptr->Connecting = FALSE; sockptr->Connecting = FALSE;
sockptr->Connected = TRUE; sockptr->Connected = TRUE;
@ -428,7 +428,7 @@ checkLen:
// This must be an incoming connection as Call is set before calling so need to find route record and set things up. // This must be an incoming connection as Call is set before calling so need to find route record and set things up.
Debugprintf("New NRTCP Connection from %s", Msg->Call); // Debugprintf("New NRTCP Connection from %s", Msg->Call);
memcpy(Info->Call, Msg->Call, 10); memcpy(Info->Call, Msg->Call, 10);
@ -461,8 +461,13 @@ checkLen:
if (memcmp(Info->Call, Msg->Call, 10) != 0) if (memcmp(Info->Call, Msg->Call, 10) != 0)
{ {
Debugprintf("Mismatch"); Debugprintf("NRTCP Mismatch - closing connection");
// something wrong - maybe connection reused
closesocket(sockptr->socket);
sockptr->SocketActive = FALSE;
memset(sockptr, 0, sizeof(struct ConnectionInfo));
Info->Call[0] = 0;
return 0;
} }
// Format as if come from an ax.25 link // Format as if come from an ax.25 link
@ -593,6 +598,7 @@ void NETROMConnectionLost(struct ConnectionInfo * sockptr)
Route->TCPSession = 0; Route->TCPSession = 0;
Info->Call[0] = 0; Info->Call[0] = 0;
Info->LINK->L2STATE = 0;
} }
sockptr->SocketActive = FALSE; sockptr->SocketActive = FALSE;

View file

@ -10,8 +10,8 @@
#endif #endif
#define KVers 6,0,25,11 #define KVers 6,0,25,12
#define KVerstring "6.0.25.11\0" #define KVerstring "6.0.25.12\0"
#ifdef CKernel #ifdef CKernel

View file

@ -25,6 +25,8 @@ Stuff to make compiling on WINDOWS and LINUX easier
#ifdef WIN32 #ifdef WIN32
#include <windows.h>
typedef unsigned int uint32_t; typedef unsigned int uint32_t;
#define pthread_t uint32_t #define pthread_t uint32_t
@ -41,6 +43,7 @@ int pthread_equal(pthread_t T1, pthread_t T2)
#include <syslog.h> #include <syslog.h>
#include <stdarg.h> #include <stdarg.h>
#include <unistd.h> #include <unistd.h>
#include <stdint.h>
#define BOOL int #define BOOL int
@ -188,3 +191,27 @@ void closesocket(int sock)
} }
#endif #endif
#ifdef WIN32
uint32_t GetTickCountINP3()
{
// Returns system uptime in 10 mS, lower 20 bits only
return (GetTickCount() / 10) & 0xfffff;
}
#else
uint64_t GetTickCount();
uint32_t GetTickCountINP3()
{
uint64_t Ticks = GetTickCount();
// Returns system uptime in 10 mS, lower 20 bits only
return (Ticks / 10) & 0xfffff;
}
#endif

View file

@ -24,6 +24,7 @@ Stuff to make compiling on WINDOWS and LINUX easier
#define strtoll _strtoi64 #define strtoll _strtoi64
#ifdef _WIN64 #ifdef _WIN64
#include "stdint.h" #include "stdint.h"
#else #else
@ -219,7 +220,7 @@ typedef struct tagRECT
#endif #endif
uint32_t GetTickCountINP3();
#ifdef LINBPQ #ifdef LINBPQ