Packet filtering treated telemetry metadata as messages rather than telemetry.

modified:   CHANGES.md
	modified:   pfilter.c
This commit is contained in:
WB2OSZ 2016-03-19 08:10:34 -04:00
parent 283b768125
commit ce9eebf273
2 changed files with 28 additions and 4 deletions

View File

@ -3,7 +3,7 @@
---------- ----------
## Version 1.3 -- Beta Test -- February 2016 ## ## Version 1.3 -- Beta Test -- March 2016 ##
### New Features: ### ### New Features: ###
@ -40,7 +40,7 @@ command line option.
- When receiving packet with comment of a few hundred characters. - When receiving packet with comment of a few hundred characters.
- Address in path, from Internet server. more than 9 characters. - Address in path, from Internet server, more than 9 characters.
- "INTERNAL ERROR: dlq_append NULL packet pointer." when using PASSALL. - "INTERNAL ERROR: dlq_append NULL packet pointer." when using PASSALL.
@ -51,6 +51,8 @@ command line option.
- AGW network protocol now works properly for big-endian processors - AGW network protocol now works properly for big-endian processors
such as PowerPC or MIPS. such as PowerPC or MIPS.
- Packet filtering treated telemetry metadata as messages rather than telemetry.
---------- ----------
## Version 1.2 -- June 2015 ## ## Version 1.2 -- June 2015 ##

View File

@ -619,6 +619,21 @@ static int filt_bodgu (pfstate_t *pf, char *arg)
* *
*------------------------------------------------------------------------------*/ *------------------------------------------------------------------------------*/
/* Telemetry metadata is a special case of message. */
/* We want to categorize it as telemetry rather than message. */
static int is_telem_metadata (char *infop)
{
if (*infop != ':') return (0);
if (strlen(infop) < 16) return (0);
if (strncmp(infop+10, ":PARM.", 6) == 0) return (1);
if (strncmp(infop+10, ":UNIT.", 6) == 0) return (1);
if (strncmp(infop+10, ":EQNS.", 6) == 0) return (1);
if (strncmp(infop+10, ":BITS.", 6) == 0) return (1);
return (0);
}
static int filt_t (pfstate_t *pf) static int filt_t (pfstate_t *pf)
{ {
char src[AX25_MAX_ADDR_LEN]; char src[AX25_MAX_ADDR_LEN];
@ -652,7 +667,7 @@ static int filt_t (pfstate_t *pf)
break; break;
case 'm': /* Message */ case 'm': /* Message */
if (*infop == ':') return (1); if (*infop == ':' && ! is_telem_metadata(infop)) return (1);
break; break;
case 'q': /* Query */ case 'q': /* Query */
@ -665,6 +680,7 @@ static int filt_t (pfstate_t *pf)
case 't': /* Telemetry */ case 't': /* Telemetry */
if (*infop == 'T') return (1); if (*infop == 'T') return (1);
if (is_telem_metadata(infop)) return (1);
break; break;
case 'u': /* User-defined */ case 'u': /* User-defined */
@ -1033,13 +1049,19 @@ int main ()
pftest (112, "t/t", "WM1X>APU25N:@210147z4235.39N/07106.58W_359/000g000t027r000P000p000h89b10234/WX REPORT {UIV32N}<0x0d>", 0); pftest (112, "t/t", "WM1X>APU25N:@210147z4235.39N/07106.58W_359/000g000t027r000P000p000h89b10234/WX REPORT {UIV32N}<0x0d>", 0);
pftest (113, "t/w", "WM1X>APU25N:@210147z4235.39N/07106.58W_359/000g000t027r000P000p000h89b10234/WX REPORT {UIV32N}<0x0d>", 1); pftest (113, "t/w", "WM1X>APU25N:@210147z4235.39N/07106.58W_359/000g000t027r000P000p000h89b10234/WX REPORT {UIV32N}<0x0d>", 1);
/* Telemetry metadata is a special case of message. */
pftest (114, "t/t", "KJ4SNT>APMI04::KJ4SNT :PARM.Vin,Rx1h,Dg1h,Eff1h,Rx10m,O1,O2,O3,O4,I1,I2,I3,I4", 1);
pftest (115, "t/m", "KJ4SNT>APMI04::KJ4SNT :PARM.Vin,Rx1h,Dg1h,Eff1h,Rx10m,O1,O2,O3,O4,I1,I2,I3,I4", 0);
pftest (116, "t/t", "KB1GKN-10>APRX27,UNCAN,WIDE1*:T#491,4.9,0.3,25.0,0.0,1.0,00000000", 1);
pftest (120, "t/p", "CWAPID>APRS::NWS-TTTTT:DDHHMMz,ADVISETYPE,zcs{seq#", 0); pftest (120, "t/p", "CWAPID>APRS::NWS-TTTTT:DDHHMMz,ADVISETYPE,zcs{seq#", 0);
pftest (122, "t/p", "CWAPID>APRS::SKYCWA :DDHHMMz,ADVISETYPE,zcs{seq#", 0); pftest (122, "t/p", "CWAPID>APRS::SKYCWA :DDHHMMz,ADVISETYPE,zcs{seq#", 0);
pftest (123, "t/p", "CWAPID>APRS:;CWAttttz *DDHHMMzLATLONICONADVISETYPE{seq#", 0); pftest (123, "t/p", "CWAPID>APRS:;CWAttttz *DDHHMMzLATLONICONADVISETYPE{seq#", 0);
pftest (124, "t/n", "CWAPID>APRS::NWS-TTTTT:DDHHMMz,ADVISETYPE,zcs{seq#", 1); pftest (124, "t/n", "CWAPID>APRS::NWS-TTTTT:DDHHMMz,ADVISETYPE,zcs{seq#", 1);
pftest (125, "t/n", "CWAPID>APRS::SKYCWA :DDHHMMz,ADVISETYPE,zcs{seq#", 1); pftest (125, "t/n", "CWAPID>APRS::SKYCWA :DDHHMMz,ADVISETYPE,zcs{seq#", 1);
pftest (126, "t/n", "CWAPID>APRS:;CWAttttz *DDHHMMzLATLONICONADVISETYPE{seq#", 1); pftest (126, "t/n", "CWAPID>APRS:;CWAttttz *DDHHMMzLATLONICONADVISETYPE{seq#", 1);
pftest (127, "t/", "CWAPID>APRS:;CWAttttz *DDHHMMzLATLONICONADVISETYPE{seq#", 0); pftest (127, "t/", "CWAPID>APRS:;CWAttttz *DDHHMMzLATLONICONADVISETYPE{seq#", 0);
pftest (130, "r/42.6/-71.3/10", "WB2OSZ-5>APDW12,WIDE1-1,WIDE2-1:!4237.14NS07120.83W#PHG7140Chelmsford MA", 1); pftest (130, "r/42.6/-71.3/10", "WB2OSZ-5>APDW12,WIDE1-1,WIDE2-1:!4237.14NS07120.83W#PHG7140Chelmsford MA", 1);
pftest (131, "r/42.6/-71.3/10", "WA1PLE-5>APWW10,W1MHL,N8VIM,WIDE2*:@022301h4208.75N/07115.16WoAPRS-IS for Win32", 0); pftest (131, "r/42.6/-71.3/10", "WA1PLE-5>APWW10,W1MHL,N8VIM,WIDE2*:@022301h4208.75N/07115.16WoAPRS-IS for Win32", 0);