From 84b3067c722dc5ca6eeea0f7405b5a72415c3ed6 Mon Sep 17 00:00:00 2001 From: John Wiseman Date: Thu, 14 Sep 2023 08:20:49 +0100 Subject: [PATCH] 6.0.24.9 --- BPQINP3.c | 12 ++++++++++-- Bpq32.c | 7 +++++++ CommonCode.c | 53 +++++++++++++++++++++++++++++++++++++++++++--------- LinBPQ.c | 11 ++++++++++- Versions.h | 4 ++-- compatbits.h | 4 +++- 6 files changed, 76 insertions(+), 15 deletions(-) diff --git a/BPQINP3.c b/BPQINP3.c index 8a1860a..e541518 100644 --- a/BPQINP3.c +++ b/BPQINP3.c @@ -35,6 +35,9 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses #include //#include "vmm.h" +uint64_t timeLoadedMS = 0; + + static VOID SendNetFrame(struct ROUTE * Route, struct _L3MESSAGEBUFFER * Frame) { // INP3 should only ever send over an active link, so just queue the message @@ -320,7 +323,7 @@ VOID ProcessRTTReply(struct ROUTE * Route, struct _L3MESSAGEBUFFER * Buff) Route->Timeout = 0; // Got Response sscanf(&Buff->L4DATA[6], "%d", &OrigTime); - RTT = GetTickCount() - OrigTime; + RTT = (GetTickCount() - timeLoadedMS) - OrigTime; if (RTT > 60000) return; // Ignore if more than 60 secs @@ -379,6 +382,11 @@ VOID ProcessINP3RIF(struct ROUTE * Route, UCHAR * ptr1, int msglen, int Port) rtt = (*ptr1++ << 8); rtt += *ptr1++; + // rtt is value from remote node. Add our RTT to that node and update hops + + rtt += Route->SRTT; + hops++; + msglen -= 10; while (*ptr1 && msglen > 0) @@ -766,7 +774,7 @@ VOID SendRTTMsg(struct ROUTE * Route) Msg->L4FLAGS = L4INFO; - sprintf(Stamp, "%10d %10d %10d %10d ", GetTickCount(), Route->SRTT/10, Route->RTT/10, 0); + sprintf(Stamp, "%10llu %10d %10d %10d ", (GetTickCount() - timeLoadedMS), Route->SRTT/10, Route->RTT/10, 0); memcpy(RTTMsg.TXTIME, Stamp, 44); memcpy(Msg->L4DATA, &RTTMsg, 236); diff --git a/Bpq32.c b/Bpq32.c index 7a6faab..6fa985a 100644 --- a/Bpq32.c +++ b/Bpq32.c @@ -1185,6 +1185,8 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses // Fix 64 bit compatibility problems in SCSTracker and UZ7HO drivers // Add Chat PACLEN config (5) // Fix NC to Application Call (6) +// Fix INP3 L3RTT messages on Linux and correct RTT calculation (9) +// Get Beacon config from config file on windows (9) #define CKernel @@ -1410,6 +1412,8 @@ extern char MAPCOMMENT[]; // Locator for Reporting - may be Maidenhead or LAT:L extern char LOC[7]; // Maidenhead Locator for Reporting extern char ReportDest[7]; +extern uint64_t timeLoadedMS; + VOID __cdecl Debugprintf(const char * format, ...); VOID __cdecl Consoleprintf(const char * format, ...); @@ -2292,6 +2296,9 @@ FirstInit() GetModuleFileNameExPtr = (FARPROCX)GetProcAddress(ExtDriver,"GetModuleFileNameExA"); EnumProcessesPtr = (FARPROCX)GetProcAddress(ExtDriver,"EnumProcesses"); } + + timeLoadedMS = GetTickCount(); + INITIALISEPORTS(); OpenReportingSockets(); diff --git a/CommonCode.c b/CommonCode.c index 433ed71..f0de5fd 100644 --- a/CommonCode.c +++ b/CommonCode.c @@ -4093,10 +4093,10 @@ VOID SaveUIConfig() config_destroy(&cfg); } +int GetRegConfig(); + VOID GetUIConfig() { -#ifdef LINBPQ - char Key[100]; char CfgFN[256]; char Digis[100]; @@ -4123,7 +4123,13 @@ VOID GetUIConfig() if (stat(CfgFN, &STAT) == -1) { + // No file. If Windows try to read from registy + +#ifndef LINBPQ + GetRegConfig(); +#else Debugprintf("UIUtil Config File not found\n"); +#endif return; } @@ -4163,8 +4169,42 @@ VOID GetUIConfig() } } -#else + _beginthread(UIThread, 0, NULL); + +} + +#ifndef LINBPQ + +int GetIntValue(config_setting_t * group, char * name) +{ + config_setting_t *setting; + + setting = config_setting_get_member (group, name); + if (setting) + return config_setting_get_int (setting); + + return 0; +} + +BOOL GetStringValue(config_setting_t * group, char * name, char * value) +{ + const char * str; + config_setting_t *setting; + + setting = config_setting_get_member (group, name); + if (setting) + { + str = config_setting_get_string (setting); + strcpy(value, str); + return TRUE; + } + value[0] = 0; + return FALSE; +} + +int GetRegConfig() +{ int retCode, Vallen, Type, i; char Key[80]; char Size[80]; @@ -4239,14 +4279,9 @@ VOID GetUIConfig() SaveUIConfig(); -#endif - - _beginthread(UIThread, 0, NULL); - + return TRUE; } -#ifndef LINBPQ - INT_PTR CALLBACK ChildDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { // This processes messages from controls on the tab subpages diff --git a/LinBPQ.c b/LinBPQ.c index ba6d20f..8a79141 100644 --- a/LinBPQ.c +++ b/LinBPQ.c @@ -75,6 +75,8 @@ void SaveAIS(); void initAIS(); void DRATSPoll(); +extern uint64_t timeLoadedMS; + BOOL IncludesMail = FALSE; BOOL IncludesChat = FALSE; @@ -755,6 +757,10 @@ int main(int argc, char * argv[]) if (!isatty(STDOUT_FILENO) || !isatty(STDIN_FILENO)) Redirected = 1; + timeLoadedMS = GetTickCount(); + + printf("Loaded at %llu ms\r\n", timeLoadedMS); + #endif printf("G8BPQ AX25 Packet Switch System Version %s %s\n", TextVerstring, Datestring); @@ -1799,6 +1805,8 @@ struct TNCINFO * TNC; #define CLOCK_REALTIME 0 #define CLOCK_MONOTONIC 0 + + int clock_gettime(int clk_id, struct timespec *t){ mach_timebase_info_data_t timebase; mach_timebase_info(&timebase); @@ -1813,7 +1821,8 @@ int clock_gettime(int clk_id, struct timespec *t){ #endif #endif -int GetTickCount() + +uint64_t GetTickCount() { struct timespec ts; clock_gettime(CLOCK_REALTIME, &ts); diff --git a/Versions.h b/Versions.h index f60d0e5..533344c 100644 --- a/Versions.h +++ b/Versions.h @@ -10,8 +10,8 @@ #endif -#define KVers 6,0,24,8 -#define KVerstring "6.0.24.8\0" +#define KVers 6,0,24,9 +#define KVerstring "6.0.24.9\0" #ifdef CKernel diff --git a/compatbits.h b/compatbits.h index 6441507..5804fc5 100644 --- a/compatbits.h +++ b/compatbits.h @@ -54,7 +54,6 @@ uintptr_t _beginthread(void(__cdecl *start_address)(void *), unsigned stack_size #else int Sleep(int ms); -int GetTickCount(); #define ioctlsocket ioctl @@ -142,6 +141,9 @@ typedef DWORD COLORREF; #define MoveFile rename #define CreateDirectory mkdir +uint64_t GetTickCount(); + + int sprintf_s(char * string, int plen, const char * format, ...);