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

Update to upstream version '6.0.25.9+repack'
with Debian dir 15e3115d6f
This commit is contained in:
Hibby 2025-11-09 22:34:23 +00:00
commit 3c2c1cf9f8
28 changed files with 1202 additions and 900 deletions

16
ARDOP.c
View file

@ -519,7 +519,7 @@ static int ProcessLine(char * buf, int Port)
if ((_memicmp(buf, "CAPTURE", 7) == 0) || (_memicmp(buf, "PLAYBACK", 8) == 0))
{} // Ignore
else
/*
/*
if (_memicmp(buf, "PATH", 4) == 0)
{
char * Context;
@ -527,7 +527,7 @@ static int ProcessLine(char * buf, int Port)
if (p_cmd) TNC->ProgramPath = _strdup(p_cmd);
}
else
*/
*/
if (_memicmp(buf, "PACKETCHANNELS", 14) == 0) // Packet Channels
TNC->PacketChannels = atoi(&buf[14]);
@ -558,12 +558,12 @@ static int ProcessLine(char * buf, int Port)
// AddVirtualKISSPort(TNC, Port, buf);
}
// else if (_memicmp(buf, "PAC ", 4) == 0 && _memicmp(buf, "PAC MODE", 8) != 0)
// {
// else if (_memicmp(buf, "PAC ", 4) == 0 && _memicmp(buf, "PAC MODE", 8) != 0)
// {
// PAC MODE goes to TNC, others are parsed locally
//
// ConfigVirtualKISSPort(TNC, buf);
// }
//
// ConfigVirtualKISSPort(TNC, buf);
// }
else if (standardParams(TNC, buf) == FALSE)
strcat(TNC->InitScript, buf);
}
@ -1041,10 +1041,12 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
{
TNC->Busy--;
if (TNC->Busy == 0)
{
MySetWindowText(TNC->xIDC_CHANSTATE, "Clear");
strcpy(TNC->WEB_CHANSTATE, "Clear");
}
}
}
if (TNC->BusyDelay)
{

View file

@ -3701,7 +3701,7 @@ void DoKillCommand(CIRCUIT * conn, struct UserInfo * user, char * Cmd, char * Ar
if (conn->sysop)
{
if (Arg1)
if (KillMessagesFrom(conn, user, Arg1) == 0);
if (KillMessagesFrom(conn, user, Arg1) == 0)
BBSputs(conn, "No Messages found\r");
return;
@ -6556,7 +6556,7 @@ nextline:
{
char APRS[128];
char Call[16];
int SSID = user->flags >> 28;
int SSID = (user->flags >> 28) & 15; // on some platforms this is treated as signed ??
if (SSID)
sprintf(Call, "%s-%d", Msg->to, SSID);
@ -13395,7 +13395,7 @@ int DeleteRedundantMessages()
{
while(n--)
{
if (stat(namelist[n]->d_name, &STAT) == 0);
if (stat(namelist[n]->d_name, &STAT) == 0)
{
Msgno = atoi(&namelist[n]->d_name[2]);

View file

@ -747,6 +747,9 @@ VOID SortRoutes(struct DEST_LIST * Dest)
{
char Call1[10], Call2[10], Call3[10];
// force route re-evaluation
Dest->DEST_ROUTE = 0;
// May now be out of order

94
Bpq32.c
View file

@ -1406,6 +1406,7 @@ void initAIS();
void initADSB();
int CloseAllSessions();
int CloseAllLinks();
void NETROMTCPResolve();
extern BOOL ADIFLogEnabled;
@ -1413,6 +1414,8 @@ int CloseOnError = 0;
char UIClassName[]="UIMAINWINDOW"; // the main window class name
char ClosingClassName[]="CLOSING"; // the main window class name
HWND UIhWnd;
extern char AUTOSAVE;
@ -2216,6 +2219,8 @@ VOID TimerProcX()
Start();
NETROMTCPResolve();
INITIALISEPORTS(); // Restart Ports
SetApplPorts();
@ -2398,7 +2403,7 @@ VOID TimerProcX()
if (CloseAllSessions() == 0)
{
if (CloseAllLinks() == 0) // No sessions closed so close links now
CloseAllTimer = 0; // No Links so close now
CloseAllTimer = 1; // No Links so close now
else
CloseAllTimer = 39; // ~4 secs for links to close
}
@ -2632,6 +2637,7 @@ Check_Timer()
WSAStartup(MAKEWORD(2, 0), &WsaData);
// Load Psapi.dll if possible
ExtDriver = LoadLibrary("Psapi.dll");
@ -2646,6 +2652,8 @@ Check_Timer()
Start();
NETROMTCPResolve();
INITIALISEPORTS();
OpenReportingSockets();
@ -2969,6 +2977,8 @@ BOOL APIENTRY DllMain(HANDLE hInst, DWORD ul_reason_being_called, LPVOID lpReser
}
else
{
NETROMTCPResolve();
SetApplPorts();
GetUIConfig();
@ -5967,14 +5977,96 @@ DllExport VOID APIENTRY CreateNewTrayIcon()
void hookNodeClosing(char * Reason);
BOOL CALLBACK ClosaAllProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
switch (message)
{
case WM_INITDIALOG:
return (INT_PTR)TRUE;
case WM_CTLCOLORDLG:
return (LONG)bgBrush;
case WM_CTLCOLORSTATIC:
{
HDC hdcStatic = (HDC)wParam;
SetTextColor(hdcStatic, RGB(0, 0, 0));
SetBkMode(hdcStatic, TRANSPARENT);
return (LONG)bgBrush;
}
case WM_COMMAND:
return 0;
case WM_SYSCOMMAND:
wmId = LOWORD(wParam); // Remember, these are...
wmEvent = HIWORD(wParam); // ...different for Win32!
switch (wmId)
{
case SC_RESTORE:
return (DefWindowProc(hWnd, message, wParam, lParam));
case SC_MINIMIZE:
if (MinimizetoTray)
return ShowWindow(hWnd, SW_HIDE);
else
return (DefWindowProc(hWnd, message, wParam, lParam));
break;
default:
return (DefWindowProc(hWnd, message, wParam, lParam));
}
case WM_CLOSE:
return(DestroyWindow(hWnd));
default:
return (DefWindowProc(hWnd, message, wParam, lParam));
}
return (0);
}
HWND hwndClosing = NULL; // Window handle of dialog box
DllExport VOID APIENTRY CloseAllPrograms()
{
WNDCLASS wc;
CLOSING = TRUE;
// Tell BG to shut when all links are gone or after 5 secs
CloseAllTimer = 50;
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = ClosaAllProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = DLGWINDOWEXTRA;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon( hInstance, MAKEINTRESOURCE(BPQICON) );
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = bgBrush;
wc.lpszMenuName = NULL;
wc.lpszClassName = ClosingClassName;
RegisterClass(&wc);
hwndClosing = CreateDialog(hInstance, ClosingClassName, NULL, (DLGPROC)ClosaAllProc);
ShowWindow(hwndClosing, SW_SHOW);
}
VOID RealCloseAllPrograms()

18
Cmd.c
View file

@ -130,6 +130,8 @@ int NOBUFFCOUNT = 0;
int BUFFERWAITS = 0;
int MAXDESTS = 0;
int NUMBEROFNODES = 0;
int L2CONNECTSOUT = 0;
int L2CONNECTSIN = 0;
int L4CONNECTSOUT = 0;
int L4CONNECTSIN = 0;
int L4FRAMESTX = 0;
@ -903,8 +905,12 @@ int checkifService(TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTail, s
BOOL Stay = FALSE;
char * ptr, *Context;
int i;
char TailCopy[256];
ptr = strtok_s(CmdTail, " ", &Context);
strcpy(TailCopy, CmdTail);
ptr = strtok_s(TailCopy, " ", &Context);
// see if any param. if longer than two chars treat as remote node
@ -2665,7 +2671,8 @@ NoPort:
// SEE IF CALL TO ANY OF OUR HOST SESSIONS - UNLESS DIGIS SPECIFIED
if (axcalls[7] == 0 && axcalls[9] )
// if (axcalls[7] == 0 && axcalls[9])
if (axcalls[7] == 0)
{
// If this connect is as a result of a command alias, don't check appls or we will loop
@ -2716,11 +2723,15 @@ NoPort:
}
}
// if no digis see if connect to known node. But now could have a single numeric param as a service number (Paula's Netromx)
// if no digis see if connect to known node.
// 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')
@ -2736,6 +2747,7 @@ NoPort:
Service = atoi(cmdCopy);
}
}
}
if (axcalls[7] == 0 || haveService)
{

View file

@ -75,6 +75,7 @@ void printStack(void);
char * FormatMH(PMHSTRUC MH, char Format);
void WriteConnectLog(char * fromCall, char * toCall, UCHAR * Mode);
void SendDataToPktMap();
void NETROMTCPResolve();
extern BOOL LogAllConnects;
extern BOOL M0LTEMap;
@ -3740,14 +3741,13 @@ VOID ResolveUpdateThread(void * Unused)
}
}
NETROMTCPResolve();
if (HostEnt1 && HostEnt2)
{
Sleep(1000 * 60 * 30);
Sleep(1000 * 60 * 15);
continue;
}
Debugprintf("Resolve Failed for update.g8bpq.net or chatmap.g8bpq.net");
Sleep(1000 * 60 * 5);
}
}

View file

@ -578,6 +578,7 @@ int doinflate(unsigned char * source, unsigned char * dest, int Len, int destlen
strm.next_in = Z_NULL;
ret = inflateInit(&strm);
if (ret != Z_OK)
return ret;

142
Events.c
View file

@ -57,6 +57,8 @@ extern char LOC[7];
extern char VersionString[50];
extern double LatFromLOC;
extern double LonFromLOC;
extern int NUMBEROFNODES, MAXDESTS, L4CONNECTSOUT, L4CONNECTSIN, L4FRAMESTX, L4FRAMESRX, L4FRAMESRETRIED, OLDFRAMES;
extern int L2CONNECTSOUT, L2CONNECTSIN;
void hookL2SessionClosed(struct _LINKTABLE * LINK, char * Reason, char * Direction);
int ConvFromAX25(unsigned char * incall, unsigned char * outcall);
@ -66,6 +68,7 @@ int decodeNETROMUIMsg(unsigned char * Msg, int iLen, char * Buffer, int BufferLe
int decodeNETROMIFrame(unsigned char * Msg, int iLen, char * Buffer, int BufferLen);
int decodeINP3RIF(unsigned char * Msg, int iLen, char * Buffer, int BufferLen);
int decodeRecordRoute(L3MESSAGE * L3, int iLen, char * Buffer, int BufferLen);
char * byte_base64_encode(char *str, int len);
// Runs use specified routine on certain event
@ -145,9 +148,11 @@ void hookL2SessionAccepted(int Port, char * remotecall, char * ourcall, struct _
char UDPMsg[1024];
int udplen;
LINK->ConnectTime = time(NULL);
LINK->bytesTXed = LINK->bytesRXed = LINK->framesResent = LINK->framesRXed = LINK->framesTXed = 0;
L2CONNECTSIN++;
LINK->lastStatusSentTime = LINK->ConnectTime = time(NULL);
LINK->bytesTXed = LINK->bytesRXed = LINK->framesResent = LINK->framesRXed = LINK->framesTXed = 0;
LINK->LastStatusbytesTXed = LINK->LastStatusbytesRXed = 0;
strcpy(LINK->callingCall, remotecall);
strcpy(LINK->receivingCall, ourcall);
strcpy(LINK->Direction, "In");
@ -217,9 +222,9 @@ void hookL2SessionDeleted(struct _LINKTABLE * LINK)
void hookL2SessionAttempt(int Port, char * ourcall, char * remotecall, struct _LINKTABLE * LINK)
{
LINK->ConnectTime = time(NULL);
LINK->lastStatusSentTime = LINK->ConnectTime = time(NULL);
LINK->bytesTXed = LINK->bytesRXed = LINK->framesResent = LINK->framesRXed = LINK->framesTXed = 0;
LINK->LastStatusbytesTXed = LINK->LastStatusbytesRXed = 0;
strcpy(LINK->callingCall, ourcall);
strcpy(LINK->receivingCall, remotecall);
strcpy(LINK->Direction, "Out");
@ -232,6 +237,8 @@ void hookL2SessionConnected(struct _LINKTABLE * LINK)
char UDPMsg[1024];
int udplen;
L2CONNECTSOUT++;
if (NodeAPISocket)
{
LINK->lastStatusSentTime = time(NULL);
@ -251,6 +258,7 @@ void hookL2SessionClosed(struct _LINKTABLE * LINK, char * Reason, char * Directi
char UDPMsg[1024];
int udplen;
time_t Now = time(NULL);
if (NodeAPISocket)
{
@ -259,16 +267,21 @@ 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\"}",
"\"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,
LINK->bytesTXed , LINK->bytesRXed, LINK->framesTXed, LINK->framesRXed, COUNT_AT_L2(LINK), LINK->framesResent, Reason);
LINK->bytesTXed , LINK->bytesRXed, LINK->framesTXed, LINK->framesRXed, COUNT_AT_L2(LINK), LINK->framesResent, Reason,
(int)Now, (int)Now - LINK->ConnectTime, LINK->maxQueued);
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\"}",
"\"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,
LINK->bytesTXed , LINK->bytesRXed, LINK->framesTXed, LINK->framesRXed, COUNT_AT_L2(LINK), LINK->framesResent, Reason);
LINK->bytesTXed , LINK->bytesRXed, LINK->framesTXed, LINK->framesRXed, COUNT_AT_L2(LINK), LINK->framesResent, Reason,
(int)Now, (int)Now - LINK->ConnectTime, LINK->maxQueued);
// Debugprintf(UDPMsg);
Debugprintf(UDPMsg);
sendto(NodeAPISocket, UDPMsg, udplen, 0, (struct sockaddr *)&UDPreportdest, sizeof(UDPreportdest));
}
@ -280,23 +293,37 @@ void hookL2SessionStatus(struct _LINKTABLE * LINK)
char UDPMsg[1024];
int udplen;
time_t Now = time(NULL);
int bpsTx, bpsRx, interval;
if (NodeAPISocket)
{
LINK->lastStatusSentTime = time(NULL);
interval = Now - (int)LINK->lastStatusSentTime;
bpsTx = (LINK->bytesTXed - LINK->LastStatusbytesTXed) / interval;
bpsRx = (LINK->bytesRXed - LINK->LastStatusbytesRXed) / interval;
LINK->lastStatusSentTime = Now;
LINK->LastStatusbytesTXed = LINK->bytesTXed;
LINK->LastStatusbytesRXed = LINK->bytesRXed;
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}",
"\"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,
LINK->bytesTXed , LINK->bytesRXed, LINK->framesTXed, LINK->framesRXed, 0, LINK->framesResent);
LINK->bytesTXed, LINK->bytesRXed, LINK->framesTXed, LINK->framesRXed, 0, LINK->framesResent,
(int)Now - LINK->ConnectTime, LINK->maxQueued, bpsTx, bpsRx, LINK->intervalMaxQueued, LINK->RTT);
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}",
"\"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,
LINK->bytesTXed , LINK->bytesRXed, LINK->framesTXed, LINK->framesRXed, COUNT_AT_L2(LINK), LINK->framesResent);
LINK->bytesTXed, LINK->bytesRXed, LINK->framesTXed, LINK->framesRXed, 0, LINK->framesResent,
(int)Now - LINK->ConnectTime, LINK->maxQueued, bpsTx, bpsRx, LINK->intervalMaxQueued, LINK->RTT);
// Debugprintf(UDPMsg);
LINK->intervalMaxQueued = 0;
Debugprintf(UDPMsg);
sendto(NodeAPISocket, UDPMsg, udplen, 0, (struct sockaddr *)&UDPreportdest, sizeof(UDPreportdest));
}
@ -412,8 +439,9 @@ void hookNodeClosing(char * Reason)
if (NodeAPISocket)
{
udplen = sprintf(UDPMsg, "{\"@type\": \"NodeDownEvent\", \"nodeCall\": \"%s\", \"nodeAlias\": \"%s\", \"reason\": \"%s\"}",
NODECALLLOPPED, MYALIASLOPPED, Reason);
udplen = sprintf(UDPMsg, "{\"@type\": \"NodeDownEvent\", \"nodeCall\": \"%s\", \"nodeAlias\": \"%s\", \"reason\": \"%s\", \"uptimeSecs\": %d,"
"\"linksIn\": %d, \"linksOut\": %d, \"cctsIn\": %d, \"cctsOut\": %d, \"l3Relayed\": %d}",
NODECALLLOPPED, MYALIASLOPPED, Reason, time(NULL) - TimeLoaded, L2CONNECTSIN, L2CONNECTSOUT, L4CONNECTSIN, L4CONNECTSOUT, L3FRAMES);
// Debugprintf(UDPMsg);
@ -438,9 +466,10 @@ void hookNodeRunning()
{
udplen = sprintf(UDPMsg, "{\"@type\": \"NodeStatus\", \"nodeCall\": \"%s\", \"nodeAlias\": \"%s\", \"locator\": \"%s\","
"\"latitude\": %f, \"longitude\": %f, \"software\": \"%s\", \"version\": \"%s\", \"uptimeSecs\": %d}",
NODECALLLOPPED, MYALIASLOPPED, LOC, LatFromLOC, LonFromLOC, Software, VersionString, time(NULL) - TimeLoaded);
"\"latitude\": %f, \"longitude\": %f, \"software\": \"%s\", \"version\": \"%s\", \"uptimeSecs\": %d,"
"\"linksIn\": %d, \"linksOut\": %d, \"cctsIn\": %d, \"cctsOut\": %d, \"l3Relayed\": %d}",
NODECALLLOPPED, MYALIASLOPPED, LOC, LatFromLOC, LonFromLOC, Software, VersionString, time(NULL) - TimeLoaded,
L2CONNECTSIN, L2CONNECTSOUT, L4CONNECTSIN, L4CONNECTSOUT, L3FRAMES);
// Debugprintf(UDPMsg);
@ -633,7 +662,42 @@ char * PIDtoText(int PID)
return "?";
}
void APIL2Trace(struct _MESSAGE * Message, char Dirn)
void dumpDuffPacket(char * call, char * Buffer, int Len)
{
// log to syslog in base64
char * Base64;
Base64 = byte_base64_encode(Buffer, Len);
Debugprintf("Trace Error %s %s", call, Base64);
free(Base64);
}
int checkCall(char * call, unsigned char * Buffer, int Len)
{
char c;
int i;
// Validate source and dest calls - if duff, dump packet
for (i = 0; i < strlen(call); i++)
{
c = call[i];
if (isalnum(c) || c == '-' || c == '@')
continue;
dumpDuffPacket(call, Buffer, Len);
return 0;
}
return 1;
}
void APIL2Trace(struct _MESSAGE * Message, char * Dirn)
{
char UDPMsg[2048];
int udplen;
@ -650,13 +714,22 @@ void APIL2Trace(struct _MESSAGE * Message, char Dirn)
int NS;
int NR;
if ((Message->ORIGIN[6] & 1) == 0) // Digis
return;
destcall[ConvFromAX25(Message->DEST, destcall)] = 0;
srcecall[ConvFromAX25(Message->ORIGIN, srcecall)] = 0;
// See if any Digis
// Validate source and dest calls - if duff, dump packet
if (!checkCall(destcall,(char *) Message, Message->LENGTH))
return;
if (!checkCall(srcecall, (char *) Message, Message->LENGTH))
return;
// see if any Digis
if ((Message->ORIGIN[6] & 1) == 0) // Digis - ignore for now
return;
@ -784,9 +857,9 @@ void APIL2Trace(struct _MESSAGE * Message, char Dirn)
// Common to all frame types
udplen = snprintf(UDPMsg, 2048,
"{\"@type\": \"L2Trace\", \"reportFrom\": \"%s\", \"port\": \"%d\", \"srce\": \"%s\", \"dest\": \"%s\", \"ctrl\": %d,"
"\"l2type\": \"%s\", \"modulo\": 8, \"cr\": \"%s\"",
NODECALLLOPPED, Message->PORT, srcecall, destcall, Message->CTL, Type, CR);
"{\"@type\": \"L2Trace\", \"dirn\": \"%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);
if (UIFlag)
{
@ -921,6 +994,13 @@ int decodeNETROMIFrame(unsigned char * Msg, int iLen, char * Buffer, int BufferL
destcall[ConvFromAX25(L3MSG->L3DEST, destcall)] = 0;
srcecall[ConvFromAX25(L3MSG->L3SRCE, srcecall)] = 0;
if (!checkCall(destcall, Msg, iLen))
return 0;
if (!checkCall(srcecall, Msg, iLen))
return 0;
if (strcmp(destcall, "KEEPLI") == 0)
return 0;
@ -955,6 +1035,14 @@ int decodeNETROMIFrame(unsigned char * Msg, int iLen, char * Buffer, int BufferL
srcUser[ConvFromAX25(&L3MSG->L4DATA[1], srcUser)] = 0;
srcNode[ConvFromAX25(&L3MSG->L4DATA[8], srcNode)] = 0;
if (!checkCall(srcUser, Msg, iLen))
return 0;
if (!checkCall(srcNode, Msg, iLen))
return 0;
if (netromx)
Len += snprintf(&Buffer[Len], BufferLen - Len, ", \"l4Type\": \"CONN REQX\", \"fromCct\": %d, \"srcUser\": \"%s\", \"srcNode\": \"%s\", \"window\": %d, \"service\": %d",
(L3MSG->L4INDEX << 8) | L3MSG->L4ID, srcUser, srcNode, L3MSG->L4DATA[0], service);
@ -969,7 +1057,7 @@ int decodeNETROMIFrame(unsigned char * Msg, int iLen, char * Buffer, int BufferL
// Can be ACK or NACK depending on Choke flag
if (L3MSG->L4FLAGS & L4BUSY)
Len += snprintf(&Buffer[Len], BufferLen - Len, ", \"l4Type\": \"CONN NACK\", \"toCct\": %d",
Len += snprintf(&Buffer[Len], BufferLen - Len, ", \"l4Type\": \"CONN NAK\", \"toCct\": %d",
(L3MSG->L4INDEX << 8) | L3MSG->L4ID);
else
Len += snprintf(&Buffer[Len], BufferLen - Len, ", \"l4Type\": \"CONN ACK\", \"toCct\": %d, \"fromCct\": %d, \"accWin\": %d",
@ -1073,7 +1161,7 @@ int decodeRecordRoute(L3MESSAGE * L3, int iLen, char * Buffer, int BufferLen)
Len += snprintf(&Buffer[Len], BufferLen - Len, ", \"l4Type\": \"NRR Request\", \"nrrId\": %d, \"nrrRoute\": \"%s\"",
(L3->L4TXNO << 8) | L3->L4RXNO, callList);
Debugprintf(Buffer);
// Debugprintf(Buffer);
return Len;
}

View file

@ -50,6 +50,19 @@ BEGIN
LTEXT "Enable IGate",IDC_STATIC,5,2,49,10
END
CLOSING DIALOG DISCARDABLE 300, 300, 200, 50
STYLE DS_3DLOOK | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU |
WS_THICKFRAME
CAPTION "BPQ32 Close All"
CLASS "CLOSING"
FONT 8, "Fixedsys"
BEGIN
LTEXT "Closing Links - Please wait....",IDC_BACKGROUND,22,20,337,273
END
CONFIG DIALOGEX 249, 200, 160, 118
STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION
EXSTYLE WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE

View file

@ -2346,6 +2346,9 @@ VOID SFRAME(struct _LINKTABLE * LINK, struct PORTCONTROL * PORT, UCHAR CTL, UCHA
LINK->L2TIMER = ONEMINUTE; // (RE)SET TIMER
LINK->framesResent++;
PORT = LINK->LINKPORT;
if (PORT)
@ -2452,6 +2455,20 @@ treatasRR:
LINK->L2FLAGS &= ~POLLSENT; // CLEAR I(P) or RR(P) SET
// ?? is this the place to do RTT?
if (LINK->lastPSent)
{
int RTT = GetTickCount() - LINK->lastPSent;
if (LINK->RTT)
LINK->RTT = ((LINK->RTT * 90) / 100) + RTT /10; // Smooth - 90% of old + 10% of new
else
LINK->RTT = RTT;
LINK->lastPSent = 0;
}
if ((CTL & 0xf) == RNR)
{
// Dont Clear timer on receipt of RNR(F), spec says should poll for clearing of busy,
@ -2927,6 +2944,8 @@ VOID RESETNS(struct _LINKTABLE * LINK, UCHAR NS)
{
int Resent = (LINK->LINKNS - NS) & 7; // FRAMES TO RESEND
LINK->framesResent += Resent;
LINK->LINKNS = NS; // RESET N(S)
if (LINK->LINKTYPE == 3) // mode-Node
@ -3150,6 +3169,11 @@ VOID SDETX(struct _LINKTABLE * LINK)
LINK->LASTFRAMESENT = time(NULL);
LINK->LASTSENTQCOUNT = COUNT_AT_L2(LINK);
if (LINK->LASTSENTQCOUNT > LINK->maxQueued)
LINK->maxQueued = LINK->LASTSENTQCOUNT;
if (LINK->LASTSENTQCOUNT > LINK->intervalMaxQueued)
LINK->intervalMaxQueued = LINK->LASTSENTQCOUNT;
if (LINK->AllowCompress && Msg->LENGTH > 20 && LINK->TX_Q && Msg->PID == 240) // if short and no more not worth trying compression
{
@ -3352,6 +3376,7 @@ VOID SDETX(struct _LINKTABLE * LINK)
// FLAG BUFFER TO CAUSE TIMER TO BE RESET AFTER SEND (or ACK if ACKMODE)
Buffer->Linkptr = LINK;
LINK->lastPSent = GetTickCount();
}
}

View file

@ -236,7 +236,7 @@ BOOL ACTIVATE_DEST(struct DEST_LIST * DEST)
return L2SETUPCROSSLINK(ROUTE);
}
// We umst be waiting for link to come up
// We must be waiting for link to come up
return TRUE;
@ -627,9 +627,6 @@ VOID PROCROUTES(struct DEST_LIST * DEST, struct ROUTE * ROUTE, int Qual)
if (Index == 0)
{
// THIS IS A REFRESH OF BEST - IF THIS ISNT ACTIVE ROUTE, MAKE IT ACTIVE
if (DEST->DEST_ROUTE > 1) // LEAVE IT IF NOT SELECTED OR ALREADY USING BEST
DEST->DEST_ROUTE = 1;
}
goto UpdatateThisEntry;
@ -728,6 +725,8 @@ SORTROUTES:
goto SORTROUTES; // 1 AND 2 MAY NOW BE WRONG!
}
DEST->DEST_ROUTE = 0; // OForce re-evaluation.
}
int COUNTNODES(struct ROUTE * ROUTE)
@ -1042,7 +1041,8 @@ VOID L3TimerProc()
LINK = LINKS;
i = MAXLINKS;
while (i--);
while (i--)
{
if (LINK->LINKTYPE == 3) // Only if Internode
{
@ -1310,6 +1310,9 @@ VOID REMOVENODE(dest_list * DEST)
while (DEST->DEST_Q)
ReleaseBuffer(Q_REM(&DEST->DEST_Q));
if (DEST->DEST_STATE & 0x80) // LOCKED DESTINATION
return;
// MAY NEED TO CHECK FOR L4 CIRCUITS USING DEST, BUT PROBABLY NOT,
// AS THEY SHOULD HAVE TIMED OUT LONG AGO

View file

@ -1601,6 +1601,7 @@ VOID CONNECTREQUEST(struct _LINKTABLE * LINK, L3MESSAGEBUFFER * L3MSG, UINT Appl
int Index;
char APPLCMD[13] = "";
if (APPL)
memcpy(APPLCMD, APPL->APPLCMD, 13);
memcpy(BPQPARAMS, &L4T1, 2); // SET DEFAULT T1 IN CASE NOT FROM ANOTHER BPQ NODE
@ -1674,6 +1675,8 @@ VOID CONNECTREQUEST(struct _LINKTABLE * LINK, L3MESSAGEBUFFER * L3MSG, UINT Appl
{
// At the moment I only handle connects to appls. May support other node commands later.
memcpy(APPLCMD, CMD->String, 13);
if (n < APPL1 + NumberofAppls)
goto doAPPLConnect;
}
@ -2028,7 +2031,7 @@ TryAgain:
while (n--)
{
if (DEST->DEST_COUNT == 0 && DEST->DEST_RTT == 0) // Not used and not INP3
if (DEST->DEST_COUNT == 0 && DEST->DEST_RTT == 0 && (DEST->DEST_STATE & 0x80) == 0) // Not used and not INP3 and not Appl
{
if (DEST->NRROUTE[0].ROUT_QUALITY < WorstQual)
{

View file

@ -85,6 +85,7 @@ VOID GetPGConfig();
void SendBBSDataToPktMap();
void CloseAllLinks();
void hookNodeClosing(char * Reason);
void NETROMTCPResolve();
extern uint64_t INP3timeLoadedMS;
@ -1015,6 +1016,8 @@ int main(int argc, char * argv[])
return (0);
}
NETROMTCPResolve();
for (i=0;PWTEXT[i] > 0x20;i++); //Scan for cr or null
PWLen=i;
@ -1547,6 +1550,8 @@ int main(int argc, char * argv[])
Start();
NETROMTCPResolve();
INITIALISEPORTS();
SetApplPorts();

View file

@ -2105,7 +2105,6 @@ int CreateSMTPMessage(SocketConn * sockptr, int i, char * MsgTitle, time_t Date,
else
strcpy(B2To, Msg->to);
Msg->B2Flags = B2Msg | Attachments;
if (Msg->type == 'P')

View file

@ -244,6 +244,45 @@ int NETROMOpenConnection(struct ROUTE * Route)
}
void NETROMTCPResolve()
{
struct ROUTE * Route = NEIGHBOURS;
int n = MAXNEIGHBOURS;
struct addrinfo hints, *res = 0;
char PortString[20];
int err;
while (n--)
{
if (Route->TCPAddress)
{
// try to resolve host
sprintf(PortString, "%d", Route->TCPPort);
memset(&hints, 0, sizeof hints);
hints.ai_family = AF_UNSPEC; // use IPv4 or IPv6, whichever
hints.ai_socktype = SOCK_STREAM;
getaddrinfo(Route->TCPHost, PortString, &hints, &res);
err = WSAGetLastError();
if (res)
{
Route->TCPAddress->ai_family = res->ai_family;
Route->TCPAddress->ai_socktype = res->ai_socktype;
Route->TCPAddress->ai_protocol = res->ai_protocol;
Route->TCPAddress->ai_addrlen = res->ai_addrlen;
memcpy(Route->TCPAddress->ai_addr, res->ai_addr, sizeof(struct sockaddr));
freeaddrinfo(res);
}
}
Route++;
}
}
int NETROMTCPConnect(struct ROUTE * Route, struct ConnectionInfo * sockptr)
{
int err;
@ -253,34 +292,22 @@ int NETROMTCPConnect(struct ROUTE * Route, struct ConnectionInfo * sockptr)
struct sockaddr_in sinx;
int addrlen=sizeof(sinx);
char PortString[20];
struct addrinfo hints, *res = 0, *saveres;
struct addrinfo * res = Route->TCPAddress;
int Port = Route->TCPPort;
sprintf(PortString, "%d", Port);
// get host info, make socket, and connect it
memset(&hints, 0, sizeof hints);
hints.ai_family = AF_UNSPEC; // use IPv4 or IPv6, whichever
hints.ai_socktype = SOCK_STREAM;
getaddrinfo(Route->TCPHost, PortString, &hints, &res);
if (!res)
if (res->ai_family == 0)
{
err = WSAGetLastError();
Debugprintf("Resolve HostName %s Failed - Error %d", Route->TCPHost, err);
// err = WSAGetLastError();
// Debugprintf("Resolve HostName %s Failed - Error %d", Route->TCPHost, err);
return FALSE; // Resolve failed
}
// Step thorough the list of hosts
saveres = res; // Save for free
sock = sockptr->socket = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
if (sock == INVALID_SOCKET)
{
Debugprintf, ("Netrom over TCP Create Socket Failed");
@ -299,14 +326,10 @@ int NETROMTCPConnect(struct ROUTE * Route, struct ConnectionInfo * sockptr)
//
sockptr->Connected = TRUE;
freeaddrinfo(saveres);
return TRUE;
}
else
{
freeaddrinfo(saveres);
err=WSAGetLastError();
if (err == 10035 || err == 115 || err == 36) //EWOULDBLOCK
@ -399,6 +422,8 @@ checkLen:
// 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);
memcpy(Info->Call, Msg->Call, 10);
ConvToAX25(Msg->Call, axCall);
@ -407,8 +432,9 @@ checkLen:
{
Info->Route = Route;
Route->NEIGHBOUR_LINK = Info->LINK;
Route->NEIGHBOUR_PORT = portNo;
Info->LINK->NEIGHBOUR = Route;
Info->LINK->LINKPORT = GetPortTableEntryFromPortNum(Route->NEIGHBOUR_PORT);
Info->LINK->LINKPORT = GetPortTableEntryFromPortNum(portNo);
Route->TCPSession = Info;
Info->LINK->L2STATE = 5;
@ -416,7 +442,14 @@ checkLen:
SendRTTMsg(Info->Route);
}
else
goto seeifMore; // Should we kill connection?
{
Debugprintf("Neighbour %s port %d not found - closing connection", Msg->Call, portNo);
closesocket(sockptr->socket);
sockptr->SocketActive = FALSE;
memset(sockptr, 0, sizeof(struct ConnectionInfo));
Info->Call[0] = 0;
return 0;
}
}
@ -434,7 +467,7 @@ checkLen:
L3Msg->LENGTH = (Msg->Length - 12) + MSGHDDRLEN;
L3Msg->Next = 0;
L3Msg->Port = 0;
L3Msg->Port = portNo;
L3Msg->L3PID = NETROM_PID;
memcpy(&L3Msg->L3SRCE, Msg->Packet, Msg->Length - 13);
@ -539,6 +572,7 @@ void NETROMConnectionLost(struct ConnectionInfo * sockptr)
if (sockptr->Connecting)
L3LINKCLOSED(Info->LINK, SETUPFAILED);
if (Route)
Route->TCPSession = 0;
Info->Call[0] = 0;

View file

@ -3874,11 +3874,13 @@ MsgLoop:
LFPtr=memchr(MsgPtr, 10, InputLen);
if (LFPtr == 0)
{
if (CRPtr)
{
LFPtr = ++CRPtr;
InputLen++;
}
}
if (LFPtr == 0)
{
// Check Paclen
@ -4571,6 +4573,7 @@ MsgLoop:
if (P8 == 1)
SendPortsForMonitor(sock, sockptr->UserPointer->Secure);
sockptr->InputLen = 0;
return 0;
}

3
VARA.c
View file

@ -423,10 +423,11 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
{
TNC->Busy--;
if (TNC->Busy == 0)
SetWindowText(TNC->xIDC_CHANSTATE, "Clear");
{ SetWindowText(TNC->xIDC_CHANSTATE, "Clear");
strcpy(TNC->WEB_CHANSTATE, "Clear");
}
}
}
if (TNC->BusyDelay)
{

View file

@ -10,8 +10,8 @@
#endif
#define KVers 6,0,25,8
#define KVerstring "6.0.25.8\0"
#define KVers 6,0,25,9
#define KVerstring "6.0.25.9\0"
#ifdef CKernel

View file

@ -618,10 +618,12 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
{
TNC->Busy--;
if (TNC->Busy == 0)
{
SetWindowText(TNC->xIDC_CHANSTATE, "Clear");
strcpy(TNC->WEB_CHANSTATE, "Clear");
}
}
}
if (TNC->ConnectCmd && TNC->BusyDelay)
{

View file

@ -251,6 +251,7 @@ typedef struct ROUTE
char * TCPHost; // For NETROM over TCP
int TCPPort;
struct NRTCPSTRUCT * TCPSession;
struct addrinfo * TCPAddress; // Resolved Address
} *PROUTE;
@ -977,6 +978,15 @@ typedef struct _LINKTABLE
int framesRXed;
int framesTXed;
int framesResent;
time_t LastStatusTime;
int LastStatusbytesRXed;
int LastStatusbytesTXed;
int maxQueued;
int intervalMaxQueued;
uint64_t lastPSent; // Time last I frame with P bit sent in mS (for RTT Measurements)
int RTT;
// Now support compressing L2 Sessions.
// We collect as much data as possible before compressing and re-packetizing

View file

@ -444,7 +444,7 @@ static size_t ExtProc(int fn, int port, PMESSAGE buff)
From[ConvFromAX25(call, &From[1]) + 1] = 0;
if (strstr(CantReplyList, From) == 0)
{
if (strlen(CantReplyList) < 500);
if (strlen(CantReplyList) < 500)
strcat(CantReplyList, From);
Debugprintf("AXIP Packet from %s dropped - can't reply", &From[1]);
}
@ -557,7 +557,7 @@ static size_t ExtProc(int fn, int port, PMESSAGE buff)
From[ConvFromAX25(call, &From[1]) + 1] = 0;
if (strstr(CantReplyList, From) == 0)
{
if (strlen(CantReplyList) < 500);
if (strlen(CantReplyList) < 500)
strcat(CantReplyList, From);
Debugprintf("AXIP Packet from %s dropped - can't reply", &From[1]);
}

11
cMain.c
View file

@ -57,7 +57,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"
@ -1416,6 +1416,9 @@ 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++;
@ -2028,7 +2031,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 +2282,7 @@ VOID TIMERINTERRUPT()
Message = (struct _MESSAGE *)Buffer;
if(NodeAPISocket)
APIL2Trace(Message, 'T');
APIL2Trace(Message, "sent");
Message->PORT |= 0x80; // Set TX Bit
@ -2394,7 +2397,7 @@ L2Packet:
MQTTKISSRX(Buffer);
if(NodeAPISocket &&PORT->PROTOCOL == 0)
APIL2Trace(Message, 'R');
APIL2Trace(Message, "rcvd");
// Bridge if requested

View file

@ -635,6 +635,8 @@ BOOL ProcessConfig()
paramok[93]=1; // ONLYVer2point0
paramok[94]=1; // DEBUGINP3
paramok[95]=1; // EnableOARCAPI
paramok[96]=1; // OARCAPI
for (i=0; i < PARAMLIM; i++)
{

View file

@ -354,6 +354,7 @@ png_write_compressed_data_out(png_structp png_ptr, compression_state *comp)
comp->output_ptr=NULL;
/* write anything left in zbuf */
if (png_ptr->zstream.avail_out < (png_uint_32)png_ptr->zbuf_size)
png_write_chunk_data(png_ptr, png_ptr->zbuf,
png_ptr->zbuf_size - png_ptr->zstream.avail_out);