add debug.rejecteddata option for reporting bad packets/manifests

etc.
This commit is contained in:
gardners 2013-02-15 13:42:05 +10:30 committed by Jeremy Lakeman
parent 6a620fe221
commit 042cfc3fa1
3 changed files with 6 additions and 2 deletions

View File

@ -1319,7 +1319,7 @@ int app_slip_test(const struct cli_parsed *parsed, void *context)
unsigned char bufin[8192];
unsigned char bufout[8192];
int count=0;
for(count=0;count<1000000;count++) {
for(count=0;count<1000000;count++) {
len=1+random()%1500;
int i;
for(i=0;i<len;i++) bufin[i]=random()&0xff;

View File

@ -201,6 +201,7 @@ ATOM(char, broadcasts, 0, cf_opt_char_boolean,, "")
ATOM(char, packettx, 0, cf_opt_char_boolean,, "")
ATOM(char, packetrx, 0, cf_opt_char_boolean,, "")
ATOM(char, packetradio, 0, cf_opt_char_boolean,, "")
ATOM(char, rejecteddata, 0, cf_opt_char_boolean,, "")
ATOM(char, slip, 0, cf_opt_char_boolean,, "")
ATOM(char, packetconstruction, 0, cf_opt_char_boolean,, "")
ATOM(char, rhizome, 0, cf_opt_char_boolean,, "")

5
slip.c
View File

@ -249,9 +249,12 @@ int slip_decode(struct slip_decode_state *state)
// Check that CRC matches
uint32_t crc=Crc32_ComputeBuf( 0, state->dst, state->packet_length);
if (crc!=state->crc) {
if (config.debug.packetradio)
if (config.debug.packetradio||config.debug.rejecteddata)
DEBUGF("Rejected packet of %d bytes due to CRC mis-match (%08x vs %08x)",
state->packet_length,crc,state->crc);
if (config.debug.rejecteddata) {
dump("bad packet",state->dst,state->packet_length);
}
} else {
if (config.debug.packetradio)
DEBUGF("Accepted packet of %d bytes (CRC ok)",state->packet_length);