diff --git a/AISCommon.c b/AISCommon.c index e123bb2..2d7bc33 100644 --- a/AISCommon.c +++ b/AISCommon.c @@ -3256,9 +3256,9 @@ static VOID ADSBConnect(void * unused) { err=WSAGetLastError(); #ifdef LINBPQ - printf("Connect Failed for ADSB socket - error code = %d\n", err); + // printf("Connect Failed for ADSB socket - error code = %d\n", err); #else - Debugprintf("Connect Failed for ADSB socket - error code = %d", err); + // Debugprintf("Connect Failed for ADSB socket - error code = %d", err); #endif closesocket(TCPSock); ADSBConnected = FALSE; diff --git a/APRSCode.c b/APRSCode.c index 6e65001..d236fc4 100644 --- a/APRSCode.c +++ b/APRSCode.c @@ -443,110 +443,6 @@ HANDLE hMapFile; static int LogAge = 14; -#ifdef WIN32 - -int DeleteAPRSLogFiles() -{ - WIN32_FIND_DATA ffd; - - char szDir[MAX_PATH]; - char File[MAX_PATH]; - HANDLE hFind = INVALID_HANDLE_VALUE; - DWORD dwError=0; - LARGE_INTEGER ft; - time_t now = time(NULL); - int Age; - - // Prepare string for use with FindFile functions. First, copy the - // string to a buffer, then append '\*' to the directory name. - - strcpy(szDir, GetLogDirectory()); - strcat(szDir, "/logs/APRS*.log"); - - // Find the first file in the directory. - - hFind = FindFirstFile(szDir, &ffd); - - if (INVALID_HANDLE_VALUE == hFind) - return dwError; - - // Walk directory - - do - { - if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - { - OutputDebugString(ffd.cFileName); - } - else - { - ft.HighPart = ffd.ftCreationTime.dwHighDateTime; - ft.LowPart = ffd.ftCreationTime.dwLowDateTime; - - ft.QuadPart -= 116444736000000000; - ft.QuadPart /= 10000000; - - Age = (int)((now - ft.LowPart) / 86400); - - if (Age > LogAge) - { - sprintf(File, "%s/logs/%s%c", GetLogDirectory(), ffd.cFileName, 0); - Debugprintf("Deleting %s", File); - DeleteFile(File); - } - } - } - while (FindNextFile(hFind, &ffd) != 0); - - FindClose(hFind); - return dwError; -} - -#else - -#include - -int APRSFilter(const struct dirent * dir) -{ - return (memcmp(dir->d_name, "APRS", 4) == 0 && strstr(dir->d_name, ".log")); -} - -int DeleteAPRSLogFiles() -{ - struct dirent **namelist; - int n; - struct stat STAT; - time_t now = time(NULL); - int Age = 0, res; - char FN[256]; - - n = scandir("logs", &namelist, APRSFilter, alphasort); - - if (n < 0) - perror("scandir"); - else - { - while(n--) - { - sprintf(FN, "logs/%s", namelist[n]->d_name); - if (stat(FN, &STAT) == 0) - { - Age = (now - STAT.st_mtime) / 86400; - - if (Age > LogAge) - { - Debugprintf("Deleting %s\n", FN); - unlink(FN); - } - } - free(namelist[n]); - } - free(namelist); - } - return 0; -} -#endif - int APRSWriteLog(char * msg) { FILE *file; @@ -646,8 +542,6 @@ Dll BOOL APIENTRY Init_APRS() MobileBeaconInterval = 0; BeaconInterval = 0; - DeleteAPRSLogFiles(); - memset(MHTABLE, 0, sizeof(MHTABLE)); ConvToAX25(MYNODECALL, MYCALL); diff --git a/BPQINP3.c b/BPQINP3.c index d87aa69..86bfc96 100644 --- a/BPQINP3.c +++ b/BPQINP3.c @@ -37,6 +37,9 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses extern int DEBUGINP3; +int NegativePercent = 110; // if time is 10% worse send negative info +int PositivePercent = 80; // if time is 20% better send positive info + VOID SendNegativeInfo(); VOID SortRoutes(struct DEST_LIST * Dest); VOID SendRTTMsg(struct ROUTE * Route); @@ -90,7 +93,7 @@ VOID UpdateNode(struct ROUTE * Route, UCHAR * axcall, UCHAR * alias, int hops, VOID UpdateRoute(struct DEST_LIST * Dest, struct INP3_DEST_ROUTE_ENTRY * ROUTEPTR, int hops, int rtt); VOID KillRoute(struct INP3_DEST_ROUTE_ENTRY * ROUTEPTR); VOID AddHere(struct INP3_DEST_ROUTE_ENTRY * ROUTEPTR,struct ROUTE * Route , int hops, int rtt); -VOID SendRIPToNeighbour(struct ROUTE * Route); +VOID SendRIFToNewNeighbour(struct ROUTE * Route); VOID DecayNETROMRoutes(struct ROUTE * Route); VOID DeleteINP3Routes(struct ROUTE * Route); BOOL L2SETUPCROSSLINKEX(PROUTE ROUTE, int Retries); @@ -200,7 +203,8 @@ VOID DeleteINP3Routes(struct ROUTE * Route) { // Only entry - Dest->INP3ROUTE[0].SRTT = 60000; + + Dest->INP3ROUTE[0].STT = 60000; Dest->INP3ROUTE[0].Hops = 255; if (DEBUGINP3) Debugprintf("Was the only INP3 route"); @@ -211,7 +215,7 @@ VOID DeleteINP3Routes(struct ROUTE * Route) continue; } - Dest->INP3ROUTE[1].LastRTT = Dest->INP3ROUTE[0].SRTT; // So next scan will check if rtt has increaced enough to need a RIF + Dest->INP3ROUTE[1].LastTT = Dest->INP3ROUTE[0].STT; // So next scan will check if rtt has increaced enough to need a RIF memcpy(&Dest->INP3ROUTE[0], &Dest->INP3ROUTE[1], sizeof(struct INP3_DEST_ROUTE_ENTRY)); memcpy(&Dest->INP3ROUTE[1], &Dest->INP3ROUTE[2], sizeof(struct INP3_DEST_ROUTE_ENTRY)); memset(&Dest->INP3ROUTE[2], 0, sizeof(struct INP3_DEST_ROUTE_ENTRY)); @@ -361,6 +365,9 @@ VOID ProcessRTTReply(struct ROUTE * Route, struct _L3MESSAGEBUFFER * Buff) if (RTT > 60000 || RTT < 0) return; // Ignore if more than 60 secs (why ??) + if (DEBUGINP3) Debugprintf("INP3 RTT reply from %s - SRTT was %d, Current RTT %d", Normcall, Route->SRTT, RTT); + + Route->RTT = RTT; if (Route->SRTT == 0) @@ -553,6 +560,7 @@ VOID UpdateNode(struct ROUTE * Route, UCHAR * axcall, UCHAR * alias, int hops, } + // Adding New Node memset(Dest, 0, sizeof(struct DEST_LIST)); @@ -562,8 +570,8 @@ VOID UpdateNode(struct ROUTE * Route, UCHAR * axcall, UCHAR * alias, int hops, // Set up First Route Dest->INP3ROUTE[0].Hops = hops; - Dest->INP3ROUTE[0].SRTT = rtt; - Dest->INP3ROUTE[0].LastRTT = 0; + Dest->INP3ROUTE[0].STT = rtt; + Dest->INP3ROUTE[0].LastTT = 0; Dest->INP3FLAGS = NewNode; @@ -587,7 +595,7 @@ Found: // Update ALIAS ConvFromAX25(Dest->DEST_CALL, call); - if (DEBUGINP3) Debugprintf("INP3 Updating Node %s Hops %d RTT %d", call, hops, rtt); + if (DEBUGINP3) Debugprintf("INP3 Updating Node %s Hops %d TT %d", call, hops, rtt); if (alias[0] > ' ') memcpy(Dest->DEST_ALIAS, alias, 6); @@ -598,7 +606,7 @@ Found: if (ROUTEPTR->ROUT_NEIGHBOUR == Route) { - if (DEBUGINP3) Debugprintf("INP3 Already have as route[0] - updating"); + if (DEBUGINP3) Debugprintf("INP3 Already have as route[0] - TT was %d updating to %d", ROUTEPTR->STT, rtt); UpdateRoute(Dest, ROUTEPTR, hops, rtt); return; } @@ -607,7 +615,7 @@ Found: if (ROUTEPTR->ROUT_NEIGHBOUR == Route) { - if (DEBUGINP3) Debugprintf("INP3 Already have as route[1] - updating"); + if (DEBUGINP3) Debugprintf("INP3 Already have as route[1] - TT was %d updating to %d", ROUTEPTR->STT, rtt); UpdateRoute(Dest, ROUTEPTR, hops, rtt); return; } @@ -616,7 +624,7 @@ Found: if (ROUTEPTR->ROUT_NEIGHBOUR == Route) { - if (DEBUGINP3) Debugprintf("INP3 Already have as route[2] - updating"); + if (DEBUGINP3) Debugprintf("INP3 Already have as route[2] - TT was %d updating to %d", ROUTEPTR->STT, rtt); UpdateRoute(Dest, ROUTEPTR, hops, rtt); return; } @@ -646,7 +654,7 @@ Found: // Note that wont replace any netrom routes with INP3 ones unless we add pseudo rtt values to netrom entries - if (Dest->INP3ROUTE[0].SRTT > rtt) + if (Dest->INP3ROUTE[0].STT > rtt) { // We are better. Move others down and add on front @@ -658,7 +666,7 @@ Found: return; } - if (Dest->INP3ROUTE[1].SRTT > rtt) + if (Dest->INP3ROUTE[1].STT > rtt) { // We are better. Move 2nd down and add @@ -668,7 +676,7 @@ Found: return; } - if (Dest->INP3ROUTE[2].SRTT > rtt) + if (Dest->INP3ROUTE[2].STT > rtt) { // We are better. Add here @@ -688,63 +696,13 @@ Found: VOID AddHere(struct INP3_DEST_ROUTE_ENTRY * ROUTEPTR,struct ROUTE * Route , int hops, int rtt) { ROUTEPTR->Hops = hops; - ROUTEPTR->SRTT = rtt; - ROUTEPTR->LastRTT = 0; - ROUTEPTR->RTT = 0; + ROUTEPTR->LastTT = 0; + ROUTEPTR->STT = rtt; ROUTEPTR->ROUT_NEIGHBOUR = Route; return; } - -/* LEA EDI,DEST_CALL[EBX] - MOV ECX,7 - REP MOVSB - - MOV ECX,6 ; ADD ALIAS - MOV ESI,OFFSET32 TEMPFIELD - REP MOVSB - - POP ESI -; -; GET _NEIGHBOURS FOR THIS DESTINATION -; - CALL CONVTOAX25 - JNZ SHORT BADROUTE -; - CALL GETVALUE - MOV _SAVEPORT,AL ; SET PORT FOR _FINDNEIGHBOUR - - CALL GETVALUE - MOV _ROUTEQUAL,AL -; - MOV ESI,OFFSET32 AX25CALL - - PUSH EBX ; SAVE DEST - CALL _FINDNEIGHBOUR - MOV EAX,EBX ; ROUTE TO AX - POP EBX - - JZ SHORT NOTBADROUTE - - JMP SHORT BADROUTE - -NOTBADROUTE: -; -; UPDATE ROUTE LIST FOR THIS DEST -; - MOV ROUT1_NEIGHBOUR[EBX],EAX - MOV AL,_ROUTEQUAL - MOV ROUT1_QUALITY[EBX],AL - MOV ROUT1_OBSCOUNT[EBX],255 ; LOCKED -; - POP EDI - POP EBX - - INC _NUMBEROFNODES - - JMP SENDOK -*/ struct INP3_DEST_ROUTE_ENTRY Temp; @@ -762,7 +720,7 @@ VOID SortRoutes(struct DEST_LIST * Dest) if (Dest->INP3ROUTE[1].ROUT_NEIGHBOUR == 0) { Call1[ConvFromAX25(Dest->INP3ROUTE[0].ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call1)] = 0; - if (DEBUGINP3) Debugprintf("INP3 1 route %d %s", Dest->INP3ROUTE[0].SRTT, Call1); + if (DEBUGINP3) Debugprintf("INP3 1 route %d %s", Dest->INP3ROUTE[0].STT, Call1); return; // Only One, so cant be out of order } if (Dest->INP3ROUTE[2].ROUT_NEIGHBOUR == 0) @@ -772,9 +730,9 @@ VOID SortRoutes(struct DEST_LIST * Dest) Call1[ConvFromAX25(Dest->INP3ROUTE[0].ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call1)] = 0; Call2[ConvFromAX25(Dest->INP3ROUTE[1].ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call2)] = 0; - if (DEBUGINP3) Debugprintf("INP3 2 routes %d %s %d %s", Dest->INP3ROUTE[0].SRTT, Call1, Dest->INP3ROUTE[1].SRTT, Call2); + if (DEBUGINP3) Debugprintf("INP3 2 routes %d %s %d %s", Dest->INP3ROUTE[0].STT, Call1, Dest->INP3ROUTE[1].STT, Call2); - if (Dest->INP3ROUTE[0].SRTT <= Dest->INP3ROUTE[1].SRTT) + if (Dest->INP3ROUTE[0].STT <= Dest->INP3ROUTE[1].STT) return; // Swap one and two @@ -786,7 +744,7 @@ VOID SortRoutes(struct DEST_LIST * Dest) Call1[ConvFromAX25(Dest->INP3ROUTE[0].ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call1)] = 0; Call2[ConvFromAX25(Dest->INP3ROUTE[1].ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call2)] = 0; - if (DEBUGINP3) Debugprintf("INP3 2 routes %d %s %d %s", Dest->INP3ROUTE[0].SRTT, Call1, Dest->INP3ROUTE[1].SRTT, Call2); + if (DEBUGINP3) Debugprintf("INP3 2 routes %d %s %d %s", Dest->INP3ROUTE[0].STT, Call1, Dest->INP3ROUTE[1].STT, Call2); return; } @@ -797,16 +755,16 @@ VOID SortRoutes(struct DEST_LIST * Dest) Call2[ConvFromAX25(Dest->INP3ROUTE[1].ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call2)] = 0; Call3[ConvFromAX25(Dest->INP3ROUTE[2].ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call3)] = 0; - if (DEBUGINP3) Debugprintf("INP3 3 routes %d %s %d %s %d %s", Dest->INP3ROUTE[0].SRTT, Call1, Dest->INP3ROUTE[1].SRTT, Call2, Dest->INP3ROUTE[2].SRTT, Call3); + if (DEBUGINP3) Debugprintf("INP3 3 routes %d %s %d %s %d %s", Dest->INP3ROUTE[0].STT, Call1, Dest->INP3ROUTE[1].STT, Call2, Dest->INP3ROUTE[2].STT, Call3); // In order? - if (Dest->INP3ROUTE[0].SRTT <= Dest->INP3ROUTE[1].SRTT && Dest->INP3ROUTE[1].SRTT <= Dest->INP3ROUTE[2].SRTT)// In order? + if (Dest->INP3ROUTE[0].STT <= Dest->INP3ROUTE[1].STT && Dest->INP3ROUTE[1].STT <= Dest->INP3ROUTE[2].STT)// In order? return; // If second is better that first swap - if (Dest->INP3ROUTE[0].SRTT > Dest->INP3ROUTE[1].SRTT) + if (Dest->INP3ROUTE[0].STT > Dest->INP3ROUTE[1].STT) { memcpy(&Temp, &Dest->INP3ROUTE[0], sizeof(struct INP3_DEST_ROUTE_ENTRY)); memcpy(&Dest->INP3ROUTE[0], &Dest->INP3ROUTE[1], sizeof(struct INP3_DEST_ROUTE_ENTRY)); @@ -818,11 +776,11 @@ VOID SortRoutes(struct DEST_LIST * Dest) Call2[ConvFromAX25(Dest->INP3ROUTE[1].ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call2)] = 0; Call3[ConvFromAX25(Dest->INP3ROUTE[2].ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call3)] = 0; - if (DEBUGINP3) Debugprintf("INP3 3 routes %d %s %d %s %d %s", Dest->INP3ROUTE[0].SRTT, Call1, Dest->INP3ROUTE[1].SRTT, Call2, Dest->INP3ROUTE[2].SRTT, Call3); + if (DEBUGINP3) Debugprintf("INP3 3 routes %d %s %d %s %d %s", Dest->INP3ROUTE[0].STT, Call1, Dest->INP3ROUTE[1].STT, Call2, Dest->INP3ROUTE[2].STT, Call3); // if 3 is better than 2 swap them. As two is worse than one. three will then be worst - if (Dest->INP3ROUTE[1].SRTT > Dest->INP3ROUTE[2].SRTT) + if (Dest->INP3ROUTE[1].STT > Dest->INP3ROUTE[2].STT) { memcpy(&Temp, &Dest->INP3ROUTE[1], sizeof(struct INP3_DEST_ROUTE_ENTRY)); memcpy(&Dest->INP3ROUTE[1], &Dest->INP3ROUTE[2], sizeof(struct INP3_DEST_ROUTE_ENTRY)); @@ -834,12 +792,12 @@ VOID SortRoutes(struct DEST_LIST * Dest) Call2[ConvFromAX25(Dest->INP3ROUTE[1].ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call2)] = 0; Call3[ConvFromAX25(Dest->INP3ROUTE[2].ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call3)] = 0; - if (DEBUGINP3) Debugprintf("INP3 3 routes %d %s %d %s %d %s", Dest->INP3ROUTE[0].SRTT, Call1, Dest->INP3ROUTE[1].SRTT, Call2, Dest->INP3ROUTE[2].SRTT, Call3); + if (DEBUGINP3) Debugprintf("INP3 3 routes %d %s %d %s %d %s", Dest->INP3ROUTE[0].STT, Call1, Dest->INP3ROUTE[1].STT, Call2, Dest->INP3ROUTE[2].STT, Call3); // 3 is now slowest. 2 could still be better than 1 - if (Dest->INP3ROUTE[0].SRTT > Dest->INP3ROUTE[1].SRTT) + if (Dest->INP3ROUTE[0].STT > Dest->INP3ROUTE[1].STT) { memcpy(&Temp, &Dest->INP3ROUTE[0], sizeof(struct INP3_DEST_ROUTE_ENTRY)); memcpy(&Dest->INP3ROUTE[0], &Dest->INP3ROUTE[1], sizeof(struct INP3_DEST_ROUTE_ENTRY)); @@ -851,9 +809,9 @@ VOID SortRoutes(struct DEST_LIST * Dest) Call2[ConvFromAX25(Dest->INP3ROUTE[1].ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call2)] = 0; Call3[ConvFromAX25(Dest->INP3ROUTE[2].ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call3)] = 0; - if (DEBUGINP3) Debugprintf("INP3 3 routes %d %s %d %s %d %s", Dest->INP3ROUTE[0].SRTT, Call1, Dest->INP3ROUTE[1].SRTT, Call2, Dest->INP3ROUTE[2].SRTT, Call3); + if (DEBUGINP3) Debugprintf("INP3 3 routes %d %s %d %s %d %s", Dest->INP3ROUTE[0].STT, Call1, Dest->INP3ROUTE[1].STT, Call2, Dest->INP3ROUTE[2].STT, Call3); - if (Dest->INP3ROUTE[0].SRTT <= Dest->INP3ROUTE[1].SRTT && Dest->INP3ROUTE[1].SRTT <= Dest->INP3ROUTE[2].SRTT)// In order? + if (Dest->INP3ROUTE[0].STT <= Dest->INP3ROUTE[1].STT && Dest->INP3ROUTE[1].STT <= Dest->INP3ROUTE[2].STT)// In order? return; // Something went wrong @@ -871,7 +829,7 @@ VOID UpdateRoute(struct DEST_LIST * Dest, struct INP3_DEST_ROUTE_ENTRY * ROUTEPT // This is not a INP3 Route - Convert it ROUTEPTR->Hops = hops; - ROUTEPTR->SRTT = rtt; + ROUTEPTR->STT = rtt; SortRoutes(Dest); return; @@ -879,7 +837,7 @@ VOID UpdateRoute(struct DEST_LIST * Dest, struct INP3_DEST_ROUTE_ENTRY * ROUTEPT if (rtt == 60000) { - ROUTEPTR->SRTT = rtt; + ROUTEPTR->STT = rtt; ROUTEPTR->Hops = hops; SortRoutes(Dest); @@ -887,7 +845,7 @@ VOID UpdateRoute(struct DEST_LIST * Dest, struct INP3_DEST_ROUTE_ENTRY * ROUTEPT } - ROUTEPTR->SRTT = rtt; + ROUTEPTR->STT = rtt; ROUTEPTR->Hops = hops; SortRoutes(Dest); @@ -947,6 +905,9 @@ VOID ProcessRTTMsg(struct ROUTE * Route, struct _L3MESSAGEBUFFER * Buff, int Len if (OtherRTT < 60000) // Don't save suspect values Route->NeighbourSRTT = OtherRTT; + + if (DEBUGINP3) Debugprintf("INP3 RTT Msg from %s remote SRTT %u", Normcall, OtherRTT); + } // Look for $M and $H (MAXRTT MAXHOPS) @@ -1174,7 +1135,6 @@ int SendRIPTimer() int INP3Delay; char Normcall[10]; - for (count=0; countNEIGHBOUR_CALL[0] != 0) @@ -1236,6 +1196,7 @@ int SendRIPTimer() L2SETUPCROSSLINKEX(Route, 2); // Only try SABM twice Route->NeighbourSRTT = 0; // just in case! + Route->BCTimer = 0; Route->LastConnectAttempt = REALTIMETICKS; @@ -1296,12 +1257,24 @@ int SendRIPTimer() char Call [11] = ""; ConvFromAX25(Route->NEIGHBOUR_CALL, Call); - if (DEBUGINP3) Debugprintf("BPQ32 INP3 Neighbour %s Lost", Call); + if (DEBUGINP3) Debugprintf("BPQ32 INP3 Neighbour %s Lost (No Response to RTT)", Call); + + DecayNETROMRoutes(Route); + DeleteINP3Routes(Route); Route->Status = 0; // Down + + // close the link + + if (Route->TCPPort == 0) // NetromTCP doesn't have a real link + { + Route->NEIGHBOUR_LINK->KILLTIMER = 0; + Route->NEIGHBOUR_LINK->L2TIMER = 1; // TO FORCE DISC + Route->NEIGHBOUR_LINK->L2STATE = 4; // DISCONNECTING + } } - Route->BCTimer=5; // Wait a while before retrying + Route->BCTimer = 5; // Wait a while before retrying } } @@ -1354,39 +1327,74 @@ VOID SendRIF(struct ROUTE * Route, struct _L3MESSAGEBUFFER * Msg) SendNetFrame(Route, Msg); } -VOID SendRIPToOtherNeighbours(UCHAR * axcall, UCHAR * alias, struct INP3_DEST_ROUTE_ENTRY * Entry) +VOID SendRIFToOtherNeighbours(UCHAR * axcall, UCHAR * alias, struct INP3_DEST_ROUTE_ENTRY * Entry, int Negative) { struct ROUTE * Routes = NEIGHBOURS; struct _L3MESSAGEBUFFER * Msg; int count, MaxRoutes = MAXNEIGHBOURS; char Normcall[10]; - int sendHops, sendTT; + char Normcall2[10]; + int sendHops, sendTT, lastTT; + int sent = 0; Normcall[ConvFromAX25(axcall, Normcall)] = 0; - if (DEBUGINP3) Debugprintf("INP3 SendRIPToOtherNeighbours for %s", Normcall); - for (count=0; countINP3Node) && + if ((Entry->ROUT_NEIGHBOUR && Routes->INP3Node) && (Routes->Status) && (Routes != Entry->ROUT_NEIGHBOUR)) // Dont send to originator of route { + // as the value sent will be different for each link, we need to check if change is enough here + sendHops = Entry->Hops + 1; - sendTT = Entry->SRTT + Entry->ROUT_NEIGHBOUR->RTTIncrement; + sendTT = Entry->STT + Entry->ROUT_NEIGHBOUR->RTTIncrement; + lastTT = Entry->LastTT + Entry->LastNeighbourTT; - // send, but only if within their constraints + if (Negative) + { + // only send if significantly worse - if ((Routes->RemoteMAXHOPS == 0 || Routes->RemoteMAXHOPS >= Entry->Hops) && - (Routes->RemoteMAXRTT == 0 || Routes->RemoteMAXRTT >= Entry->SRTT || Entry->SRTT == 60000)) + if (sendTT < (lastTT * NegativePercent) / 100) + { + Routes+=1; + continue; + } + } + else { + // Send if significantly better + + if (sendTT > (lastTT * PositivePercent) / 100) + { + Routes+=1; + continue; + } + } + + sent++; + + if (DEBUGINP3) Debugprintf("INP3 SendRIFToOtherNeighbours for %s", Normcall); + + if (DEBUGINP3) Debugprintf("INP3 %s Old RTT %d Old NRTT %d New %d %d Sufficent change so sending if in other ends limits", + Normcall, Entry->LastTT, Entry->LastNeighbourTT, sendTT, Entry->ROUT_NEIGHBOUR->RTTIncrement); + + Entry->LastTT = Entry->STT; + Entry->LastNeighbourTT = Entry->ROUT_NEIGHBOUR->RTTIncrement; + + // send, but only if within their constraints + + if ((Routes->RemoteMAXHOPS == 0 || Routes->RemoteMAXHOPS >= Entry->Hops) && + (Routes->RemoteMAXRTT == 0 || Routes->RemoteMAXRTT >= Entry->STT || Entry->STT == 60000)) + { Msg = Routes->Msg; if (Msg == NULL) { - Normcall[ConvFromAX25(Routes->NEIGHBOUR_CALL, Normcall)] = 0; - if (DEBUGINP3) Debugprintf("INP3 Building RIF to send to %s", Normcall); + Normcall2[ConvFromAX25(Routes->NEIGHBOUR_CALL, Normcall2)] = 0; + if (DEBUGINP3) Debugprintf("INP3 Building RIF to send to %s", Normcall2); Msg = Routes->Msg = CreateRIFHeader(Routes); } @@ -1398,6 +1406,7 @@ VOID SendRIPToOtherNeighbours(UCHAR * axcall, UCHAR * alias, struct INP3_DEST_RO else Msg->LENGTH += BuildRIF(&Msg->L3SRCE[Msg->LENGTH], axcall, alias, sendHops, sendTT); + if (Msg->LENGTH > 250 - 15) // if (Msg->LENGTH > Routes->NBOUR_PACLEN - 11) @@ -1408,11 +1417,17 @@ VOID SendRIPToOtherNeighbours(UCHAR * axcall, UCHAR * alias, struct INP3_DEST_RO } } } + + Routes+=1; } + + if (sent) + Debugprintf("INP3 End of Loop %s Old RTT %d Old NRTT %d ", Normcall, Entry->LastTT, Entry->LastNeighbourTT); + } -VOID SendRIPToNeighbour(struct ROUTE * Route) +VOID SendRIFToNewNeighbour(struct ROUTE * Route) { int i; struct DEST_LIST * Dest = DESTS; @@ -1441,10 +1456,12 @@ VOID SendRIPToNeighbour(struct ROUTE * Route) // Best Route not via this neighbour - send, but only if within their constraints sendHops = Entry->Hops + 1; - sendTT = Entry->SRTT + Entry->ROUT_NEIGHBOUR->RTTIncrement; + Entry->LastTT = Entry->STT; + + sendTT = Entry->STT + Entry->ROUT_NEIGHBOUR->RTTIncrement; if ((Route->RemoteMAXHOPS == 0 || Route->RemoteMAXHOPS >= Entry->Hops) && - (Route->RemoteMAXRTT == 0 || Route->RemoteMAXRTT >= Entry->SRTT || Entry->SRTT == 60000)) + (Route->RemoteMAXRTT == 0 || Route->RemoteMAXRTT >= Entry->STT || Entry->STT == 60000)) { Msg = Route->Msg; @@ -1487,7 +1504,7 @@ VOID FlushRIFs() { Routes->Status |= SentOurRIF; SendOurRIF(Routes); - SendRIPToNeighbour(Routes); + SendRIFToNewNeighbour(Routes); } if (Routes->Msg) @@ -1505,9 +1522,11 @@ VOID FlushRIFs() VOID SendNegativeInfo() { - int i, Preload; + int i; struct DEST_LIST * Dest = DESTS; struct INP3_DEST_ROUTE_ENTRY * Entry; + char call[11]=""; + Dest--; @@ -1525,22 +1544,15 @@ VOID SendNegativeInfo() Entry = &Dest->INP3ROUTE[0]; - if (Entry->SRTT > Entry->LastRTT) - { - if (Entry->LastRTT) // if zero haven't yet reported +ve info - { - if (Entry->LastRTT == 1) // if 1, probably new, so send alias - SendRIPToOtherNeighbours(Dest->DEST_CALL, Dest->DEST_ALIAS, Entry); - else - SendRIPToOtherNeighbours(Dest->DEST_CALL, 0, Entry); + if (Entry->ROUT_NEIGHBOUR == 0) + continue; - Preload = Entry->SRTT /10; - if (Entry->SRTT < 60000) - Entry->LastRTT = Entry->SRTT + Preload; //10% Negative Preload - } - } + if (Entry->LastTT == 0) // if zero haven't yet reported +ve info. Shouldn't really be reporting negative without positive but just in case + SendRIFToOtherNeighbours(Dest->DEST_CALL, Dest->DEST_ALIAS, Entry, TRUE); + else + SendRIFToOtherNeighbours(Dest->DEST_CALL, 0, Entry, TRUE); - if (Entry->SRTT >= 60000) + if (Entry->STT >= 60000) { // It is dead, and we have reported it if necessary, so remove if no NETROM Routes @@ -1580,21 +1592,13 @@ VOID SendPositiveInfo() Dest++; Entry = &Dest->INP3ROUTE[0]; - - if (( (Entry->SRTT) && (Entry->LastRTT == 0) )|| // if zero haven't yet reported +ve info - ((((Entry->SRTT * 125) /100) < Entry->LastRTT) && // Better by 25% - ((Entry->LastRTT - Entry->SRTT) > 10))) // and 100ms - { - SendRIPToOtherNeighbours(Dest->DEST_CALL, 0, Entry); - Dest->INP3ROUTE[0].LastRTT = (Dest->INP3ROUTE[0].SRTT * 11) / 10; //10% Negative Preload - } + SendRIFToOtherNeighbours(Dest->DEST_CALL, 0, Entry, FALSE); } } VOID SendNewInfo() { int i; - unsigned int NewRTT; struct DEST_LIST * Dest = DESTS; struct INP3_DEST_ROUTE_ENTRY * Entry; @@ -1612,10 +1616,7 @@ VOID SendNewInfo() Entry = &Dest->INP3ROUTE[0]; - SendRIPToOtherNeighbours(Dest->DEST_CALL, Dest->DEST_ALIAS, Entry); - - NewRTT = (Entry->SRTT * 11) / 10; - Entry->LastRTT = NewRTT; //10% Negative Preload + SendRIFToOtherNeighbours(Dest->DEST_CALL, Dest->DEST_ALIAS, Entry, FALSE); } } } diff --git a/Bpq32.c b/Bpq32.c index 1f80282..e88e26a 100644 --- a/Bpq32.c +++ b/Bpq32.c @@ -1292,6 +1292,7 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses // Improvments to INP3 (4, 5) // Add Node API /api/tcpqueues (5) // Add sending link events to OARC API (disabled by default) (6) +// Add option to write monitor output to a file (6) // Fix possible program error in Telnet_Connected (7) // Close links when program is closed down (7) // Fix possible problem with deleting routes when using both NODES and INP3 routing on same link (7) @@ -1302,6 +1303,8 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses // 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) +// Add config file option to enable writing monitor data to a file at startup (13) + #define CKernel @@ -2821,7 +2824,13 @@ BOOL APIENTRY DllMain(HANDLE hInst, DWORD ul_reason_being_called, LPVOID lpReser MessageBox(NULL,"NODES Table .c and .asm mismatch - fix and rebuild", "BPQ32", MB_OK); return 0; } - + + if (sizeof(struct NR_DEST_ROUTE_ENTRY) != sizeof(struct INP3_DEST_ROUTE_ENTRY)) + { + MessageBox(NULL,"Route Entry mismatch - fix and rebuild", "BPQ32", MB_OK); + return 0; + } + GetSemaphore(&Semaphore, 4); BPQHOSTVECPTR = &BPQHOSTVECTOR[0]; @@ -4219,13 +4228,12 @@ int APIENTRY Restart() hProc = OpenProcess(PROCESS_TERMINATE | PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, TimerInst); - if (hProc) - { - TerminateProcess(hProc, 0); - CloseHandle(hProc); - } + if (hProc) + { + TerminateProcess(hProc, 0); + CloseHandle(hProc); + } - return 0; } diff --git a/Cmd.c b/Cmd.c index 3e6c0eb..cf3000a 100644 --- a/Cmd.c +++ b/Cmd.c @@ -3306,7 +3306,7 @@ char * DoOneNode(TRANSPORTENTRY * Session, char * Bufferptr, struct DEST_LIST * if (Neighbour) { - double srtt = Route->SRTT/100.0; + double srtt = Route->STT/100.0; len = ConvFromAX25(Neighbour->NEIGHBOUR_CALL, Normcall); Normcall[len] = 0; @@ -3326,7 +3326,7 @@ int DoViaEntry(struct DEST_LIST * Dest, int n, char * line, int cursor) char Portcall[10]; int len; - if (Dest->NRROUTE[n].ROUT_NEIGHBOUR != 0 && Dest->NRROUTE[n].ROUT_NEIGHBOUR->INP3Node == 0) + if (Dest->NRROUTE[n].ROUT_NEIGHBOUR != 0) { len=ConvFromAX25(Dest->NRROUTE[n].ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Portcall); Portcall[len]=0; @@ -3355,7 +3355,7 @@ int DoINP3ViaEntry(struct DEST_LIST * Dest, int n, char * line, int cursor) if (Dest->INP3ROUTE[n].ROUT_NEIGHBOUR != 0) { - srtt = Dest->INP3ROUTE[n].SRTT/100.0; + srtt = Dest->INP3ROUTE[n].STT/100.0; len=ConvFromAX25(Dest->INP3ROUTE[n].ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Portcall); Portcall[len]=0; diff --git a/CommonCode.c b/CommonCode.c index 9e8b37a..26dda97 100644 --- a/CommonCode.c +++ b/CommonCode.c @@ -76,6 +76,7 @@ char * FormatMH(PMHSTRUC MH, char Format); void WriteConnectLog(char * fromCall, char * toCall, UCHAR * Mode); void SendDataToPktMap(); void NETROMTCPResolve(); +VOID FindLostBuffers(); extern BOOL LogAllConnects; extern BOOL M0LTEMap; @@ -565,6 +566,15 @@ VOID * _GetBuff(char * File, int Line) Msg->Linkptr = NULL; Msg->Padding[0] = 0; // Used for modem status info } + else if (QCOUNT != 0) + { + // Queue must be corrupt + + Debugprintf("Fatal - Getbuff returned NULL and Q not empty - exit"); + FindLostBuffers(); + WriteMiniDump(); + Restart(); + } else Debugprintf("Warning - Getbuff returned NULL"); diff --git a/HTTPcode.c b/HTTPcode.c index 385eca2..8d32c88 100644 --- a/HTTPcode.c +++ b/HTTPcode.c @@ -147,9 +147,15 @@ char IndexNoAPRS[] = "PortCallQualityNode CountFrame CountRetriesPercentMaxframeFrackLast HeardQueuedRem Qual"; +"PortCallQualityNode CountFrame CountRetriesPercentMaxframe" +"FrackLast HeardQueuedRem QualSRTTRem SRTT"; + +char RouteLine[] = "%s%d%s%s%d%d%d%d%d%%d%d" +"%02d:%02d%d%d"; + +char RouteLineINP3[] = "%s%d%s%s%d%d%d%d%d%%d%d" +"%02d:%02d%d%d%4.2fs%4.2fs"; -char RouteLine[] = "%s%d%s%s%d%d%d%d%d%%d%d%02d:%02d%d%d"; char xNodeHddr[] = "
" "" "
" @@ -3942,9 +3948,21 @@ doHeader: else Percent = 0; - ReplyLen += sprintf(&_REPLYBUFFER[ReplyLen], RouteLine, Active, Routes->NEIGHBOUR_PORT, Normcall, locked, - Routes->NEIGHBOUR_QUAL, NodeCount, Iframes, Retries, Percent, Routes->NBOUR_MAXFRAME, Routes->NBOUR_FRACK, - Routes->NEIGHBOUR_TIME >> 8, Routes->NEIGHBOUR_TIME & 0xff, Queued, Routes->OtherendsRouteQual); + if (Routes->INP3Node) // INP3 Enabled? + { + double srtt = Routes->SRTT/100.0; + double nsrtt = Routes->NeighbourSRTT/100.0; + + ReplyLen += sprintf(&_REPLYBUFFER[ReplyLen], RouteLineINP3, Active, Routes->NEIGHBOUR_PORT, Normcall, locked, + Routes->NEIGHBOUR_QUAL, NodeCount, Iframes, Retries, Percent, Routes->NBOUR_MAXFRAME, Routes->NBOUR_FRACK, + Routes->NEIGHBOUR_TIME >> 8, Routes->NEIGHBOUR_TIME & 0xff, Queued, Routes->OtherendsRouteQual, srtt, nsrtt); + } + else + { + ReplyLen += sprintf(&_REPLYBUFFER[ReplyLen], RouteLine, Active, Routes->NEIGHBOUR_PORT, Normcall, locked, + Routes->NEIGHBOUR_QUAL, NodeCount, Iframes, Retries, Percent, Routes->NBOUR_MAXFRAME, Routes->NBOUR_FRACK, + Routes->NEIGHBOUR_TIME >> 8, Routes->NEIGHBOUR_TIME & 0xff, Queued, Routes->OtherendsRouteQual); + } } Routes+=1; } diff --git a/L3Code.c b/L3Code.c index 0aafe67..84ebbdd 100644 --- a/L3Code.c +++ b/L3Code.c @@ -620,7 +620,7 @@ VOID PROCROUTES(struct DEST_LIST * DEST, struct ROUTE * ROUTE, int Qual) if (DEST->DEST_STATE & 0x80) // BBS ENTRY return; - for (Index = 0; Index < 4; Index++) + for (Index = 0; Index < 3; Index++) { if (DEST->NRROUTE[Index].ROUT_NEIGHBOUR == ROUTE) { @@ -692,6 +692,7 @@ UpdatateThisEntry: // IT DID - THIS IS ALSO CALLED BY CHECKL3TABLES. TRY RESETING // OBS, BUT NOT QUALITY + if ((DEST->NRROUTE[Index].ROUT_OBSCOUNT & 0x80) == 0) DEST->NRROUTE[Index].ROUT_OBSCOUNT = OBSINIT; // SET OBSOLESCENCE COUNT @@ -1432,7 +1433,8 @@ VOID L3TRYNEXTDEST(struct ROUTE * ROUTE) { // not Locked - DEST->NRROUTE[ActiveRoute].ROUT_OBSCOUNT--; + if (ActiveRoute < 3) // Not INP3 Route + DEST->NRROUTE[ActiveRoute].ROUT_OBSCOUNT--; // if ROUTE HAS EXPIRED - WE SHOULD CLEAR IT, AND MOVE OTHERS (IF ANY) UP } @@ -1563,7 +1565,10 @@ struct DEST_LIST * CHECKL3TABLES(struct _LINKTABLE * LINK, L3MESSAGEBUFFER * Msg if (DEST->DEST_ROUTE) { int Index = DEST->DEST_ROUTE -1; - + + if (Index > 2) // INP3 Route + return DEST; + if (DEST->NRROUTE[Index].ROUT_OBSCOUNT & 0x80) // Locked: return DEST; @@ -1592,6 +1597,9 @@ VOID REFRESHROUTE(TRANSPORTENTRY * Session) Index--; + if (Index > 2) // INP3 Route + return; + if (DEST->NRROUTE[Index].ROUT_OBSCOUNT & 0x80) return; // Locked diff --git a/LinBPQ.c b/LinBPQ.c index dd9bdf6..08dae7c 100644 --- a/LinBPQ.c +++ b/LinBPQ.c @@ -866,7 +866,6 @@ int main(int argc, char * argv[]) srand(time(NULL)); - // look for optarg format parameters { diff --git a/NETROMTCP.c b/NETROMTCP.c index 0710f73..69a91c0 100644 --- a/NETROMTCP.c +++ b/NETROMTCP.c @@ -244,6 +244,7 @@ int NETROMOpenConnection(struct ROUTE * Route) Info->Route = Route; Info->LINK->NEIGHBOUR = Route; Info->LINK->LINKPORT = GetPortTableEntryFromPortNum(Route->NEIGHBOUR_PORT); + memcpy(Route->NEIGHBOUR_LINK->LINKCALL, Route->NEIGHBOUR_CALL, 7); } return NETROMTCPConnect(Route, sockptr); @@ -443,7 +444,8 @@ checkLen: Info->LINK->LINKPORT = GetPortTableEntryFromPortNum(portNo); Route->TCPSession = Info; Info->LINK->L2STATE = 5; - + memcpy(Route->NEIGHBOUR_LINK->LINKCALL, axCall, 7); + if (Info->Route->INP3Node) SendRTTMsg(Info->Route); } diff --git a/TelnetV6.c b/TelnetV6.c index 590186c..332e843 100644 --- a/TelnetV6.c +++ b/TelnetV6.c @@ -56,6 +56,7 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses extern UCHAR LogDirectory[]; +extern int MONTOFILEFLAG; static char ClassName[]="TELNETSERVER"; static char WindowTitle[] = "Telnet Server"; @@ -177,77 +178,74 @@ void NETROMConnectionLost(struct ConnectionInfo * sockptr); void NETROMConnectionAccepted(struct ConnectionInfo * sockptr); struct ConnectionInfo * AllocateNRTCPRec(); -static int LogAge = 13; +static int LogAge = 10; - -#ifdef WIN32 - -int DeleteLogFile(char * Log); +int DeleteLogFile(char * Log, int KeepDays); void DeleteTelnetLogFiles() { - DeleteLogFile("/logs/Telnet*.log"); - DeleteLogFile("/logs/CMSAccess_*.log"); - DeleteLogFile("/logs/ConnectLog_*.log"); + DeleteLogFile("Telnet", 14); + DeleteLogFile("CMSAccess_", 14); + DeleteLogFile("ConnectLog_",14); + DeleteLogFile("APRS_", 14); + DeleteLogFile("PacketLog_",MONTOFILEFLAG); } -int DeleteLogFile(char * Log) -{ +#ifdef WIN32 - +int DeleteLogFile(char * Log, int KeepDays) +{ WIN32_FIND_DATA ffd; - char szDir[MAX_PATH]; - char File[MAX_PATH]; - HANDLE hFind = INVALID_HANDLE_VALUE; - DWORD dwError=0; - LARGE_INTEGER ft; - time_t now = time(NULL); - int Age; - - // Prepare string for use with FindFile functions. First, copy the - // string to a buffer, then append '\*' to the directory name. + char szDir[MAX_PATH]; + char File[MAX_PATH]; + HANDLE hFind = INVALID_HANDLE_VALUE; + DWORD dwError=0; + LARGE_INTEGER ft; + time_t now = time(NULL); + int Age; - strcpy(szDir, GetLogDirectory()); - strcat(szDir, Log); - // Find the first file in the directory. + strcpy(szDir, GetLogDirectory()); + strcat(szDir, "/Logs/"); + strcat(szDir, Log); + strcat(szDir, "*.log"); - hFind = FindFirstFile(szDir, &ffd); + // Find the first file in the directory. - if (INVALID_HANDLE_VALUE == hFind) - return dwError; + hFind = FindFirstFile(szDir, &ffd); - // List all the files in the directory with some info about them. + if (INVALID_HANDLE_VALUE == hFind) + return dwError; - do - { - if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - { - OutputDebugString(ffd.cFileName); - } - else - { - ft.HighPart = ffd.ftCreationTime.dwHighDateTime; - ft.LowPart = ffd.ftCreationTime.dwLowDateTime; + do + { + if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + { + OutputDebugString(ffd.cFileName); + } + else + { + ft.HighPart = ffd.ftCreationTime.dwHighDateTime; + ft.LowPart = ffd.ftCreationTime.dwLowDateTime; - ft.QuadPart -= 116444736000000000; - ft.QuadPart /= 10000000; + ft.QuadPart -= 116444736000000000; + ft.QuadPart /= 10000000; - Age = (int)((now - ft.LowPart) / 86400); + Age = (int)((now - ft.LowPart) / 86400); - if (Age > LogAge) + if (Age > KeepDays) { sprintf(File, "%s/logs/%s%c", GetLogDirectory(), ffd.cFileName, 0); Debugprintf("Deleting %s", File); DeleteFile(File); } - } - } - while (FindNextFile(hFind, &ffd) != 0); + } + } + while (FindNextFile(hFind, &ffd) != 0); - FindClose(hFind); - return dwError; + FindClose(hFind); + return dwError; } #else @@ -256,22 +254,19 @@ int DeleteLogFile(char * Log) int TelFilter(const struct dirent * dir) { - return (memcmp(dir->d_name, "CMSAccess", 9) == 0 - || memcmp(dir->d_name, "Telnet", 6) == 0 - || memcmp(dir->d_name, "ConnectLog", 6) == 0) - && strstr(dir->d_name, ".log"); + return strstr(dir->d_name, ".log") != 0; } -int DeleteTelnetLogFiles() +int DeleteLogFile(char * Log, int KeepDays) { struct dirent **namelist; - int n; + int n; struct stat STAT; time_t now = time(NULL); int Age = 0, res; char FN[256]; - - n = scandir("logs", &namelist, TelFilter, alphasort); + + n = scandir("logs", &namelist, TelFilter, alphasort); if (n < 0) perror("scandir"); @@ -279,21 +274,25 @@ int DeleteTelnetLogFiles() { while(n--) { - sprintf(FN, "logs/%s", namelist[n]->d_name); - if (stat(FN, &STAT) == 0) + if (memcmp(namelist[n]->d_name, Log, strlen(Log)) == 0) { - Age = (now - STAT.st_mtime) / 86400; - - if (Age > LogAge) + sprintf(FN, "logs/%s", namelist[n]->d_name); + + if (stat(FN, &STAT) == 0) { - Debugprintf("Deleting %s\n", FN); - unlink(FN); + Age = (now - STAT.st_mtime) / 86400; + + if (Age > KeepDays) + { + Debugprintf("Deleting %s", FN); + unlink(FN); + } } } free(namelist[n]); } free(namelist); - } + } return 0; } #endif @@ -320,7 +319,7 @@ void BuffertoNode(struct ConnectionInfo * sockptr, char * MsgPtr, int InputLen) sockptr->InputLen = 0; return; - } +} BOOL SendAndCheck(struct ConnectionInfo * sockptr, unsigned char * MsgPtr, int len, int flags) { @@ -331,7 +330,7 @@ BOOL SendAndCheck(struct ConnectionInfo * sockptr, unsigned char * MsgPtr, int l return TRUE; // OK err = WSAGetLastError(); - + Debugprintf("TCP Send Failed - Sent %d should be %d err %d - requeue data", sent, len, err); if (err == 10035 || err == 115 || err == 36) //EWOULDBLOCK @@ -1194,6 +1193,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff) TNC = TNCInfo[n]; TNC->Port = n; + TNC->PortRecord = PortRecord; TNC->PortRecord->PORTCONTROL.HWType = TNC->Hardware = H_TELNET; TNC->RIG = &TNC->DummyRig; // Not using Rig control, so use Dummy @@ -1445,7 +1445,7 @@ void * TelnetExtInit(EXTPORTDATA * PortEntry) } */ - DeleteTelnetLogFiles(); + DeleteTelnetLogFiles(LogAge); initUTF8(); diff --git a/Versions.h b/Versions.h index 25ed90e..a6c8834 100644 --- a/Versions.h +++ b/Versions.h @@ -10,8 +10,8 @@ #endif -#define KVers 6,0,25,12 -#define KVerstring "6.0.25.12\0" +#define KVers 6,0,25,13 +#define KVerstring "6.0.25.13\0" #ifdef CKernel diff --git a/asmstrucs.h b/asmstrucs.h index 439b6f9..97e4a4d 100644 --- a/asmstrucs.h +++ b/asmstrucs.h @@ -489,9 +489,11 @@ typedef struct NR_DEST_ROUTE_ENTRY typedef struct INP3_DEST_ROUTE_ENTRY { struct ROUTE * ROUT_NEIGHBOUR; // POINTER TO NEXT NODE IN PATH - USHORT LastRTT; // Last Value Reported - USHORT RTT; // Current - USHORT SRTT; // Smoothed RTT + USHORT LastTT; // Last Value Reported. This is our value, not the one actually sent (which includes Neighbour TT) + USHORT LastNeighbourTT; // Saved from last report so we can calulate what we actually sent + + USHORT STT; // Current time to dest from here (was called RTT but is one way not round trip. + // Is actually a smoothed value as is calculated from smoother link times) UCHAR Hops; } *PDEST_ROUTE_ENTRY; diff --git a/cMain.c b/cMain.c index d592ecb..2773a95 100644 --- a/cMain.c +++ b/cMain.c @@ -882,11 +882,12 @@ BOOL Start() PREFERINP3ROUTES = cfg->C_PREFERINP3ROUTES; - if (cfg->C_DEBUGINP3) - DEBUGINP3 = 0; + DEBUGINP3 = cfg->C_DEBUGINP3; EnableOARCAPI = cfg->C_OARCAPI; + MONTOFILEFLAG = cfg->C_MONTOFILE; + if (cfg->C_OnlyVer2point0) SUPPORT2point2 = 0; @@ -2398,7 +2399,7 @@ L2Packet: if (MQTT && PORT->PROTOCOL == 0) MQTTKISSRX(Buffer); - if(NodeAPISocket &&PORT->PROTOCOL == 0) + if(NodeAPISocket && PORT->PROTOCOL == 0) APIL2Trace(Message, "rcvd"); // Bridge if requested diff --git a/config.c b/config.c index b41e0e8..b883ad5 100644 --- a/config.c +++ b/config.c @@ -310,7 +310,7 @@ static char *keywords[] = "LogL4Connects", "LogAllConnects", "SAVEMH", "ENABLEADIFLOG", "ENABLEEVENTS", "SAVEAPRSMSGS", "EnableM0LTEMap", "MQTT", "MQTT_HOST", "MQTT_PORT", "MQTT_USER", "MQTT_PASS", "L4Compress", "L4CompMaxframe", "L4CompPaclen", "L2Compress", "L2CompMaxframe", -"L2CompPaclen", "PREFERINP3ROUTES", "OnlyVer2point0", "DEBUGINP3", "ENABLEOARCAPI" +"L2CompPaclen", "PREFERINP3ROUTES", "OnlyVer2point0", "DEBUGINP3", "ENABLEOARCAPI", "MONTOFILE" }; /* parameter keywords */ static void * offset[] = @@ -334,7 +334,7 @@ static void * offset[] = &xxcfg.C_LogL4Connects, &xxcfg.C_LogAllConnects, &xxcfg.C_SaveMH, &xxcfg.C_ADIF, &xxcfg.C_EVENTS, &xxcfg.C_SaveAPRSMsgs, &xxcfg.C_M0LTEMap, &xxcfg.C_MQTT, &xxcfg.C_MQTT_HOST, &xxcfg.C_MQTT_PORT, &xxcfg.C_MQTT_USER, &xxcfg.C_MQTT_PASS, &xxcfg.C_L4Compress, &xxcfg.C_L4CompMaxframe, &xxcfg.C_L4CompPaclen, &xxcfg.C_L2Compress, &xxcfg.C_L2CompMaxframe, -&xxcfg.C_L2CompPaclen, &xxcfg.C_PREFERINP3ROUTES, &xxcfg.C_OnlyVer2point0, &xxcfg.C_DEBUGINP3, &xxcfg.C_OARCAPI}; /* offset for corresponding data in config file */ +&xxcfg.C_L2CompPaclen, &xxcfg.C_PREFERINP3ROUTES, &xxcfg.C_OnlyVer2point0, &xxcfg.C_DEBUGINP3, &xxcfg.C_OARCAPI, &xxcfg.C_MONTOFILE}; /* offset for corresponding data in config file */ static int routine[] = { @@ -357,7 +357,7 @@ static int routine[] = 2, 2, 1, 2, 2, 2, 2, 2, 0, 1, 20, 20, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1}; // Routine to process param +1, 1, 1, 1, 1, 1}; // Routine to process param int PARAMLIM = sizeof(routine)/sizeof(int); //int NUMBEROFKEYWORDS = sizeof(routine)/sizeof(int); @@ -560,7 +560,6 @@ BOOL ProcessConfig() heading = 1; } - paramok[6]=1; /* dont need BUFFERS */ paramok[8]=1; /* dont need TRANSDELAY */ paramok[13]=1; // NodeAlias @@ -610,35 +609,35 @@ BOOL ProcessConfig() paramok[45+i]=1; /* or APPLCALLS, APPLALIASS APPLQUAL */ paramok[69]=1; // BText optional - paramok[70]=1; // IPGateway optional + paramok[70]=1; // NETROMCALL optional paramok[71]=1; // C_IS_CHAT optional - paramok[72]=1; // MAXRTT optional - paramok[73]=1; // MAXHOPS optional - paramok[74]=1; // LogL4Connects optional - paramok[75]=1; // LogAllConnects optional - paramok[76]=1; // SAVEMH optional - paramok[77]=1; // ENABLEADIFLOG optional - paramok[78]=1; // EnableEvents optional - paramok[79]=1; // SaveAPRSMsgs optional + paramok[73]=1; // MAXTT optional + paramok[74]=1; // MAXHOPS optional + paramok[75]=1; // LogL4Connects optional + paramok[76]=1; // LogAllConnects optional + paramok[77]=1; // SAVEMH optional + paramok[78]=1; // ENABLEADIFLOG optional + paramok[79]=1; // EnableEvents optional + paramok[80]=1; // SaveAPRSMsgs optional paramok[79]=1; // SaveAPRSMsgs optional paramok[80]=1; // EnableM0LTEMap optional - paramok[81]=1; // MQTT Params paramok[82]=1; // MQTT Params paramok[83]=1; // MQTT Params paramok[84]=1; // MQTT Params paramok[85]=1; // MQTT Params - paramok[86]=1; // L4Compress - paramok[87]=1; // L4Compress Maxframe - paramok[88]=1; // L4Compress Paclen - paramok[89]=1; // L2Compress - paramok[90]=1; // L2Compress Maxframe - paramok[91]=1; // L2Compress Paclen - paramok[92]=1; // PREFERINP3ROUTES - paramok[93]=1; // ONLYVer2point0 - paramok[94]=1; // DEBUGINP3 - paramok[95]=1; // EnableOARCAPI - paramok[96]=1; // OARCAPI + paramok[86]=1; // MQTT Params + paramok[87]=1; // L4Compress + paramok[88]=1; // L4Compress Maxframe + paramok[89]=1; // L4Compress Paclen + paramok[90]=1; // L2Compress + paramok[91]=1; // L2Compress Maxframe + paramok[92]=1; // L2Compress Paclen + paramok[93]=1; // PREFERINP3ROUTES + paramok[94]=1; // ONLYVer2point0 + paramok[95]=1; // DEBUGINP3 + paramok[96]=1; // EnableOARCAPI + paramok[97]=1; // MONTOFILE for (i=0; i < PARAMLIM; i++) @@ -651,7 +650,7 @@ BOOL ProcessConfig() Consoleprintf("The following parameters were not correctly specified"); heading = 1; } - Consoleprintf(keywords[i]); + Consoleprintf("%s", keywords[i]); } } @@ -3069,13 +3068,39 @@ int simple(int i) /* Set PARAMOK flags on all values that are defaulted */ - for (i=0; i < PARAMLIM; i++) - paramok[i]=1; - paramok[15] = 0; // Must have callsign paramok[45] = 0; // Dont Have Appl1Call paramok[53] = 0; // or APPL1ALIAS + // Set defined flag on defaulted params + + paramok[0] = 1; // OBSINIT + paramok[1] = 1; // OBSMIN + paramok[2] = 1; // NODESINTERVAL + paramok[3] = 1; // L3TIMETOLIVE + paramok[4] = 1; // L4RETRIES + paramok[5] = 1; // L4TIMEOUT + paramok[7] = 1; // PACLEN + paramok[9] = 1; // T3 + paramok[10] = 1; // IDLETIME + paramok[11] = 1; // BBS + paramok[12] = 1; // NODE + paramok[18] = 1; // IDMSG: + paramok[19] = 1; // INFOMSG: + paramok[22] = 1; // MAXLINKS + paramok[23] = 1; // MAXNODES + paramok[24] = 1; // MAXROUTES + paramok[25] = 1; // MAXCIRCUITS + paramok[26] = 1; // IDINTERVAL + paramok[27] = 1; // MINQUAL + paramok[28] = 1; // HIDENODES + paramok[29] = 1; // L4DELAY + paramok[30] = 1; // L4WINDOW + paramok[31] = 1; // BTINTERVAL + paramok[36] = 1; // CTEXT: + paramok[39] = 1; // ENABLE_LINKED + paramok[41] = 1; // FULL_CTEXT + return(1); } diff --git a/configstructs.h b/configstructs.h index fae9d30..89ffb60 100644 --- a/configstructs.h +++ b/configstructs.h @@ -187,6 +187,7 @@ struct CONFIGTABLE int C_OnlyVer2point0; int C_DEBUGINP3; int C_OARCAPI; + int C_MONTOFILE; //#define ApplOffset 80000 // Applications offset in config buffer diff --git a/datadefs.c b/datadefs.c index 54766ab..5cb3711 100644 --- a/datadefs.c +++ b/datadefs.c @@ -39,7 +39,7 @@ int DEBUGINP3 = 0; int EnableOARCAPI = 0; -int RTTInterval = 24; // 4 Minutes +int RTTInterval = 30; // 5 Minutes BOOL IPRequired = FALSE; BOOL PMRequired = FALSE;