Drop packets having source callsign of N0CALL, NOCALL, or SERVER
* NOCALLs being a default on many TNCs and software * potentially blocks a message loop between SERVERs
This commit is contained in:
parent
b62d29b908
commit
cf6f6e2ed7
|
|
@ -42,7 +42,7 @@
|
|||
#include "dupecheck.h"
|
||||
|
||||
/* When adding labels here, remember to add the description strings in
|
||||
* web/aprsc.js rx_err_strings
|
||||
* web/aprsc.js rx_err_strings, and worker.h constants
|
||||
*/
|
||||
const char *inerr_labels[] = {
|
||||
"unknown",
|
||||
|
|
@ -76,11 +76,34 @@ const char *inerr_labels[] = {
|
|||
"q_newq_buffer_small",
|
||||
"q_nonval_multi_q_calls",
|
||||
"q_i_no_viacall",
|
||||
"inerr_empty"
|
||||
"inerr_empty",
|
||||
"dis_srccall"
|
||||
};
|
||||
|
||||
#define incoming_strerror(i) ((i <= 0 && i >= INERR_MIN) ? inerr_labels[i * -1] : inerr_labels[0])
|
||||
|
||||
|
||||
/* a static list of source callsigns which are dropped */
|
||||
static const char *disallow_srccalls[] = {
|
||||
"N0CALL", /* default in some apps */
|
||||
"NOCALL", /* default in some apps */
|
||||
"SERVER", /* originated by APRS-IS server */
|
||||
NULL
|
||||
};
|
||||
|
||||
static const char *disallow_msg_recipients[] = {
|
||||
"USERLIST", /* old aprsd */
|
||||
"JAVATITLE", /* old aprsd */
|
||||
"JAVATITL2", /* old aprsd */
|
||||
NULL
|
||||
};
|
||||
|
||||
static const char *disallow_data_prefixes[] = {
|
||||
"DX de ", /* DX messages */
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
#ifdef _FOR_VALGRIND_
|
||||
typedef struct cellarena_t {
|
||||
int dummy;
|
||||
|
|
@ -523,6 +546,22 @@ int check_invalid_src_dst(const char *call, int len)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check callsign against a list to see if it matches
|
||||
*/
|
||||
|
||||
static int check_call_match(const char **set, const char *call, int len)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; (set[i]); i++) {
|
||||
if (strncmp(call, set[i], len) == 0 && strlen(set[i]) == len)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if a callsign is good for a digi path entry
|
||||
* (valid APRS-IS callsign, * allowed in end)
|
||||
|
|
@ -796,6 +835,9 @@ int incoming_parse(struct worker_t *self, struct client_t *c, char *s, int len)
|
|||
if (check_invalid_src_dst(s, src_len) != 0)
|
||||
return INERR_INV_SRCCALL; /* invalid or too long for source callsign */
|
||||
|
||||
if (check_call_match(disallow_srccalls, s, src_len))
|
||||
return INERR_DIS_SRCCALL; /* disallowed srccall */
|
||||
|
||||
info_start = path_end+1; // @":"+1 - first char of the payload
|
||||
if (info_start >= packet_end)
|
||||
return INERR_NO_BODY;
|
||||
|
|
|
|||
|
|
@ -218,8 +218,9 @@ struct client_heard_t {
|
|||
#define INERR_Q_NONVAL_MULTI_Q_CALLS -29
|
||||
#define INERR_Q_I_NO_VIACALL -30
|
||||
#define INERR_EMPTY -31
|
||||
#define INERR_DIS_SRCCALL -32
|
||||
|
||||
#define INERR_MIN -31 /* MINIMUM VALUE FOR INERR, GROW WHEN NEEDED! */
|
||||
#define INERR_MIN -32 /* MINIMUM VALUE FOR INERR, GROW WHEN NEEDED! */
|
||||
/* WHEN ADDING STUFF HERE, REMEMBER TO UPDATE inerr_labels IN incoming.c. Thanks! */
|
||||
#define INERR_BUCKETS (INERR_MIN*-1 + 1)
|
||||
|
||||
|
|
|
|||
|
|
@ -78,10 +78,13 @@ my @pkts = (
|
|||
"SRC2>DST,DIGI,TCPXX,qAR,$login:>Packet from unverified login according to TCPXX in path",
|
||||
"SRC2>DST,DIGI,TCPXX*,qAR,$login:>Packet from unverified login according to TCPXX* in path",
|
||||
"SRC->DST,DIGI-0,qAR,$login:>should drop, too short SSID in srccall",
|
||||
"SRC>DST,DIGI-0,qAR,$login:>should drop, -0 SSID in viacall",
|
||||
# javap4 drops these, javap3 allows
|
||||
# "SRC-111>DST,DIGI-0,qAR,$login:>should drop, too long SSID in srccall",
|
||||
# "EL-DH5FFL>DST,DIGI-0,qAR,$login:>should drop, much too long SSID in srccall",
|
||||
# disallowed source callsigns
|
||||
"N0CALL>DST,DIGI,qAR,$login:>should drop, N0CALL as source callsign",
|
||||
"NOCALL>DST,DIGI,qAR,$login:>should drop, NOCALL as source callsign",
|
||||
"SERVER>DST,DIGI,qAR,$login:>should drop, SERVER as source callsign",
|
||||
);
|
||||
|
||||
# send the packets
|
||||
|
|
|
|||
Loading…
Reference in New Issue