diff --git a/AGWMoncode.c b/AGWMoncode.c index 2c26191..da9f81e 100644 --- a/AGWMoncode.c +++ b/AGWMoncode.c @@ -49,7 +49,7 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses #define DM 0x0F #define UA 0x63 #define FRMR 0x87 -#define XID 0xAF +#define XID 0xAF #define TEST 0xE3 #define RR 1 #define RNR 5 @@ -267,16 +267,16 @@ int InternalAGWDecodeFrame(MESSAGE * msg, char * buffer, time_t Stamp, int * Fra FRMRFLAG = 1; break; - case XID: - - strcpy(SUP, "XID"); - XIDFLAG = 1; - break; - - case TEST: - - strcpy(SUP, "TEST"); - TESTFLAG = 1; + case XID: + + strcpy(SUP, "XID"); + XIDFLAG = 1; + break; + + case TEST: + + strcpy(SUP, "TEST"); + TESTFLAG = 1; break; } diff --git a/BPQMail.c b/BPQMail.c index 2aab885..7b3c365 100644 --- a/BPQMail.c +++ b/BPQMail.c @@ -1154,6 +1154,7 @@ // Add Send and Receive byte counts to status displays (69) // Validate Mode and Frequency and fix formatting in Connected Message (71) // Fix using OpenBCM on other than Telnet connections (75) +// Fix sending + in Webmail (80) #include "bpqmail.h" #include "winstdint.h" diff --git a/Bpq32.c b/Bpq32.c index 9ca6ea5..15304d4 100644 --- a/Bpq32.c +++ b/Bpq32.c @@ -1276,8 +1276,10 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses // Fix KAM Pactor Interlock (73) // Fix Node map reporting, broken in .73 (74) // Fixes to build on FreeBSD and NetBSD from jg1uaa (77) -// Fix to L4Compress from Stece G7TAJ (77) - +// Fix to L4Compress from Steve G7TAJ (77) +// Fix possible FRMR when RNR is cleared by SREJ (78) +// Fix error in .77 L4Compress fix (mine, not Steve's!) (78) +// Fix possible stuck L2 session when handling SREJ (79) #define CKernel diff --git a/ChatMultiConsole.c b/ChatMultiConsole.c index bd38475..78308c6 100644 --- a/ChatMultiConsole.c +++ b/ChatMultiConsole.c @@ -983,7 +983,27 @@ LRESULT APIENTRY InputProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return 0; } - + + if (wParam == 0x7) // BEL (Ctrl/G) + { + // Get buffer, append 07 and write back + + Cinfo->kbptr = SendMessage(Cinfo->hwndInput, WM_GETTEXT, INPUTLEN-1, + (LPARAM) (LPCSTR)Cinfo->kbbuf); + + + Cinfo->kbbuf[Cinfo->kbptr++] = 7; + Cinfo->kbbuf[Cinfo->kbptr] = 0; + + SendMessage(Cinfo->hwndInput,WM_SETTEXT,0,(LPARAM)(LPCSTR) Cinfo->kbbuf); + + // Send cursor right + + SendMessage(Cinfo->hwndInput, WM_KEYDOWN, VK_RIGHT, 0); + SendMessage(Cinfo->hwndInput, WM_KEYUP, VK_RIGHT, 0); + + return 0; + } } return CallWindowProc(Cinfo->wpOrigInputProc, hwnd, uMsg, wParam, lParam); diff --git a/L2Code.c b/L2Code.c index 76924bf..0fd8ecd 100644 --- a/L2Code.c +++ b/L2Code.c @@ -2176,7 +2176,9 @@ VOID SFRAME(struct _LINKTABLE * LINK, struct PORTCONTROL * PORT, UCHAR CTL, UCHA int count; MESSAGE * Msg; MESSAGE * Buffer; - + + LINK->L2FLAGS &= ~POLLSENT; // CLEAR I(P) or RR(P) SET + Msg = LINK->FRAMES[NS]; // is frame available? if (Msg == NULL) @@ -2977,6 +2979,43 @@ VOID SDETX(struct _LINKTABLE * LINK) // if (LINK->L2RESEQ_Q) // return; + // **** Debug code **** look for stuck links + + if (LINK->LASTFRAMESENT && (time(NULL) - LINK->LASTFRAMESENT) > 60) // No send for 60 secs + { + if (COUNT_AT_L2(LINK) > 16) + { + // Dump Link State + + char Normcall[11] = ""; + char Normcall2[11] = ""; + + int Count = COUNT_AT_L2(LINK); + int secs = time(NULL) - LINK->LASTFRAMESENT; + + ConvFromAX25(LINK->LINKCALL, Normcall); + ConvFromAX25(LINK->OURCALL, Normcall2); + + Debugprintf("*** Stuck L2 Session for %d Secs %s %s %d", secs, Normcall, Normcall2, Count); + Debugprintf("LINK->LINKNS %d LINK->LINKOWS %d SDTSLOT %d LINKWINDOW %d L2FLAGS %d", LINK->LINKNS, LINK->LINKOWS, LINK->SDTSLOT, LINK->LINKWINDOW, LINK->L2FLAGS); + Debugprintf("Slots %x %x %x %x %x %x %x %x", LINK->FRAMES[0], LINK->FRAMES[1], LINK->FRAMES[2], LINK->FRAMES[3], + LINK->FRAMES[4], LINK->FRAMES[5], LINK->FRAMES[6], LINK->FRAMES[7]); + + // Reset Link + + + InformPartner(LINK, NORMALCLOSE); // TELL OTHER END ITS GONE + + LINK->L2RETRIES -= 1; // Just send one DISC + LINK->L2STATE = 4; // CLOSING + + L2SENDCOMMAND(LINK, DISC | PFBIT); + + return; + } + } + + Outstanding = LINK->LINKNS - LINK->LINKOWS; // Was WS not NS if (Outstanding < 0) @@ -2994,6 +3033,10 @@ VOID SDETX(struct _LINKTABLE * LINK) Msg = Q_REM(&LINK->TX_Q); Msg->CHAIN = NULL; + LINK->LASTFRAMESENT = time(NULL); + LINK->LASTSENTQCOUNT = COUNT_AT_L2(LINK); + + if (LINK->AllowCompress && Msg->LENGTH > 20 && LINK->TX_Q && Msg->PID == 240) // if short and no more not worth trying compression { int complen = 0; @@ -3018,6 +3061,7 @@ VOID SDETX(struct _LINKTABLE * LINK) // I think I need to know how many slots are available, so I don't compress too much // Then collect data, compressing after each frame to make sure will fit in available space + while (LINK->FRAMES[n] == NULL && slots < 8) { slots++; @@ -3281,7 +3325,7 @@ VOID L2TimerProc() LINK->L2ACKREQ = 0; // CLEAR ANY DELAYED ACK TIMER - if (LINK->L2RETRIES == 0) // IF RR(P) OUTSTANDING WILl REPORT ANYWAY + if (LINK->L2RETRIES == 0) // IF RR(P) OUTSTANDING WILL REPORT ANYWAY { SendSupervisCmd(LINK); LINK++; @@ -3904,6 +3948,7 @@ UINT RR_OR_RNR(struct _LINKTABLE * LINK) { UCHAR Temp; TRANSPORTENTRY * Session; + int SaveRNRSent = LINK->L2FLAGS & RNRSENT; LINK->L2FLAGS &= ~RNRSENT; @@ -3979,6 +4024,11 @@ stayinREJ2: // if we support SREJ send that instesd or REJ + // Dont send SREJ if clearing RNR - causes FRMR + + if (SaveRNRSent) + return REJ; + if (LINK->Ver2point2) // We only allow 2.2 with SREJ Multi return SREJ; else diff --git a/L4Code.c b/L4Code.c index 703168a..f6fdb79 100644 --- a/L4Code.c +++ b/L4Code.c @@ -824,9 +824,8 @@ VOID L4BG() int Len = bytesleft; if (Len > ChunkSize) Len = ChunkSize; - - complen = L2Compressit(Compressed, 8192, toCompress, Len); - + + complen = L2Compressit(Compressed, 8192, CompressPtr, Len); Debugprintf("Chunked %d %d %d%%", Len, complen, ((Len - complen) * 100) / Len); sendChunk(L4, Compressed, complen, savePort); diff --git a/PG/Loop.obj b/PG/Loop.obj deleted file mode 100644 index f9d68d3..0000000 Binary files a/PG/Loop.obj and /dev/null differ diff --git a/PG/PGTest.obj b/PG/PGTest.obj deleted file mode 100644 index c97914c..0000000 Binary files a/PG/PGTest.obj and /dev/null differ diff --git a/Versions.h b/Versions.h index 061e9eb..4595afc 100644 --- a/Versions.h +++ b/Versions.h @@ -10,8 +10,8 @@ #endif -#define KVers 6,0,24,77 -#define KVerstring "6.0.24.77\0" +#define KVers 6,0,24,80 +#define KVerstring "6.0.24.80\0" #ifdef CKernel diff --git a/WebMail.c b/WebMail.c index 2c97f84..63bfd6e 100644 --- a/WebMail.c +++ b/WebMail.c @@ -2662,10 +2662,10 @@ VOID SaveNewMessage(struct HTTPConnectionInfo * Session, char * MsgPtr, char * R if (strlen(WebMail->BID) > 12) WebMail->BID[12] = 0; - UndoTransparency(WebMail->BID); - UndoTransparency(WebMail->To); - UndoTransparency(WebMail->Subject); - UndoTransparency(WebMail->Body); +// UndoTransparency(WebMail->BID); +// UndoTransparency(WebMail->To); +// UndoTransparency(WebMail->Subject); +// UndoTransparency(WebMail->Body); MsgLen = strlen(WebMail->Body); diff --git a/asmstrucs.h b/asmstrucs.h index 79e9a26..968f5fb 100644 --- a/asmstrucs.h +++ b/asmstrucs.h @@ -930,6 +930,9 @@ typedef struct _LINKTABLE VOID * FRAMES[8]; // FRAMES WAITING ACK VOID * RXFRAMES[8]; // Frames received out of sequence + time_t LASTFRAMESENT; // For detecting stuck links + int LASTSENTQCOUNT; // + UCHAR L2STATE; // PROCESSING STATE UCHAR Ver2point2; // Set if running 2.2 USHORT L2TIMER; // FRAME RETRY TIMER diff --git a/bpqchat.c b/bpqchat.c index 35f62c9..31dcc3e 100644 --- a/bpqchat.c +++ b/bpqchat.c @@ -73,6 +73,8 @@ //.25 // Increase size of status display buffers (7) +// Allow sending BEL (CTRL/G) (79) + #include "BPQChat.h" #include "Dbghelp.h" diff --git a/cMain.c b/cMain.c index c87fac2..05732c7 100644 --- a/cMain.c +++ b/cMain.c @@ -62,6 +62,7 @@ extern int needADSB; struct PORTCONFIG * PortRec; #define RNRSET 0x2 // RNR RECEIVED FROM OTHER END +#define PFBIT 0x10 // POLL/FINAL BIT IN CONTROL BYTE // STATION INFORMATION @@ -2506,6 +2507,47 @@ ENDOFLIST: if ((LINK->L2FLAGS & RNRSET) == 0) SDETX(LINK); + else + { + // Stuck link debug check + + if (LINK->LASTFRAMESENT && (time(NULL) - LINK->LASTFRAMESENT) > 60) // No send for 60 secs + { + if (COUNT_AT_L2(LINK) > 16) + { + // Dump Link State + + char Normcall[11] = ""; + char Normcall2[11] = ""; + + int Count = COUNT_AT_L2(LINK); + int secs = time(NULL) - LINK->LASTFRAMESENT; + + + ConvFromAX25(LINK->LINKCALL, Normcall); + ConvFromAX25(LINK->OURCALL, Normcall2); + + Debugprintf("*** Stuck L2 Session for %d Secs RNR Set %s %s %d", secs, Normcall, Normcall2, Count); + Debugprintf("LINK->LINKNS %d LINK->LINKOWS %d SDTSLOT %d LINKWINDOW %d L2FLAGS %d", LINK->LINKNS, LINK->LINKOWS, LINK->SDTSLOT, LINK->LINKWINDOW, LINK->L2FLAGS); + Debugprintf("Slots %x %x %x %x %x %x %x %x", LINK->FRAMES[0], LINK->FRAMES[1], LINK->FRAMES[2], LINK->FRAMES[3], + LINK->FRAMES[4], LINK->FRAMES[5], LINK->FRAMES[6], LINK->FRAMES[7]); + + // Reset Link + + + InformPartner(LINK, NORMALCLOSE); // TELL OTHER END ITS GONE + + LINK->L2RETRIES -= 1; // Just send one DISC + LINK->L2STATE = 4; // CLOSING + + L2SENDCOMMAND(LINK, DISC | PFBIT); + + return; + } + } + + } + } } LINK++; diff --git a/makefile b/makefile index cdb6298..0152c9a 100644 --- a/makefile +++ b/makefile @@ -19,7 +19,11 @@ OBJS = pngwtran.o pngrtran.o pngset.o pngrio.o pngwio.o pngtrans.o pngrutil.o pn #Default to Linux CC = gcc - EXTRA_LDFLAGS = -Xlinker -Map=output.map -lrt -l:libpaho-mqtt3a.a -l:libjansson.a + LDFLAGS = -Xlinker -Map=output.map -lrt + +all: CFLAGS = -DLINBPQ -MMD -g -fcommon -fasynchronous-unwind-tables $(EXTRA_CFLAGS) +all: LIBS = -lpaho-mqtt3a -ljansson -lminiupnpc -lm -lz -lpthread -lconfig -lpcap +all: linbpq #other OS @@ -27,34 +31,50 @@ OS_NAME = $(shell uname -s) ifeq ($(OS_NAME),NetBSD) CC = cc EXTRA_CFLAGS = -DFREEBSD -DNOMQTT -I/usr/pkg/include - EXTRA_LDFLAGS = -Xlinker -Map=output.map -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lrt -lutil -lexecinfo + LDFLAGS = -Xlinker -Map=output.map -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lrt -lutil -lexecinfo + +all: CFLAGS = -DLINBPQ -MMD -g -fcommon -fasynchronous-unwind-tables $(EXTRA_CFLAGS) +all: LIBS = -lminiupnpc -lm -lz -lpthread -lconfig -lpcap +all: linbpq + + endif ifeq ($(OS_NAME),FreeBSD) CC = cc EXTRA_CFLAGS = -DFREEBSD -DNOMQTT -I/usr/local/include - EXTRA_LDFLAGS = -Xlinker -Map=output.map -L/usr/local/lib -lrt -liconv -lutil -lexecinfo + LDFLAGS = -Xlinker -Map=output.map -L/usr/local/lib -lrt -liconv -lutil -lexecinfo + +all: CFLAGS = -DLINBPQ -MMD -g -fcommon -fasynchronous-unwind-tables $(EXTRA_CFLAGS) +all: LIBS = -lminiupnpc -lm -lz -lpthread -lconfig -lpcap +all: linbpq + endif + ifeq ($(OS_NAME),Darwin) CC = gcc EXTRA_CFLAGS = -DMACBPQ -DNOMQTT - EXTRA_LDFLAGS = -liconv + LDFLAGS = -liconv + +all: CFLAGS = -DLINBPQ -MMD -g -fcommon -fasynchronous-unwind-tables $(EXTRA_CFLAGS) +all: LIBS = -lminiupnpc -lm -lz -lpthread -lconfig -lpcap +all: linbpq endif $(info OS_NAME is $(OS_NAME)) -all: CFLAGS = -DLINBPQ -MMD -g -fcommon -fasynchronous-unwind-tables $(EXTRA_CFLAGS) -all: linbpq nomqtt: CFLAGS = -DLINBPQ -MMD -fcommon -g -rdynamic -DNOMQTT -fasynchronous-unwind-tables +nomqtt: LIBS = -lminiupnpc -lm -lz -lpthread -lconfig -lpcap nomqtt: linbpq noi2c: CFLAGS = -DLINBPQ -MMD -DNOI2C -g -rdynamic -fcommon -fasynchronous-unwind-tables +noi2c: LIBS = -lpaho-mqtt3a -ljansson -lminiupnpc -lm -lz -lpthread -lconfig -lpcap noi2c: linbpq linbpq: $(OBJS) - cc $(OBJS) $(EXTRA_LDFLAGS) -lminiupnpc -lm -lz $(LDFLAGS) -lpthread -lconfig -lpcap -o linbpq + cc $(OBJS) $(CFLAGS) $(LDFLAGS) $(LIBS) -o linbpq sudo setcap "CAP_NET_ADMIN=ep CAP_NET_RAW=ep CAP_NET_BIND_SERVICE=ep" linbpq -include *.d diff --git a/upnp.c b/upnp.c index 714e04d..fa855f8 100644 --- a/upnp.c +++ b/upnp.c @@ -41,7 +41,6 @@ POSSIBILITY OF SUCH DAMAGE. #include #endif #ifdef LINBPQ -#ifndef MACBPQ #ifndef WIN32 #include #include @@ -49,13 +48,8 @@ POSSIBILITY OF SUCH DAMAGE. #include #endif #endif -#endif -#ifdef MACBPQ -#include -#include -#include -#include -#endif + + int AddMap(char * controlURL, char * eport, char * iport, char * proto); int DeleteMap(char * controlURL, char * eport, char * iport, char * proto);