Add APRS-IS link resilience for some frame errors
Add APRS-IS link resilience for some errors encoding APRS-IS TNC2 format frames as AX.25 by simply dropping the frame and moving on to the next
This commit is contained in:
parent
78f42b02ea
commit
9a1b163954
1 changed files with 10 additions and 15 deletions
|
@ -196,9 +196,7 @@ ssize_t patty_ax25_aprs_is_drain(patty_ax25_aprs_is *aprs,
|
|||
} else if (c == ',' || c == ':') {
|
||||
if (aprs->frame.dest.callsign[0]) {
|
||||
if (aprs->frame.hops == PATTY_AX25_MAX_HOPS) {
|
||||
errno = EOVERFLOW;
|
||||
|
||||
goto error;
|
||||
goto drop;
|
||||
}
|
||||
|
||||
addr = &aprs->frame.repeaters[aprs->frame.hops++];
|
||||
|
@ -211,25 +209,19 @@ ssize_t patty_ax25_aprs_is_drain(patty_ax25_aprs_is *aprs,
|
|||
}
|
||||
} else if (PATTY_AX25_ADDR_CHAR_VALID(c)) {
|
||||
if (aprs->offset_call == PATTY_AX25_ADDRSTRLEN) {
|
||||
errno = EOVERFLOW;
|
||||
|
||||
goto error;
|
||||
goto drop;
|
||||
}
|
||||
|
||||
aprs->call[aprs->offset_call++] = c;
|
||||
} else {
|
||||
errno = EINVAL;
|
||||
|
||||
goto error;
|
||||
goto drop;
|
||||
}
|
||||
|
||||
if (addr) {
|
||||
aprs->call[aprs->offset_call] = '\0';
|
||||
|
||||
if (patty_ax25_pton(aprs->call, addr) < 0) {
|
||||
(void)patty_ax25_aprs_is_flush(aprs);
|
||||
|
||||
goto done;
|
||||
goto drop;
|
||||
}
|
||||
|
||||
aprs->offset_call = 0;
|
||||
|
@ -270,9 +262,7 @@ ssize_t patty_ax25_aprs_is_drain(patty_ax25_aprs_is *aprs,
|
|||
goto done;
|
||||
} else {
|
||||
if (aprs->offset_info == aprs->infosz) {
|
||||
errno = EOVERFLOW;
|
||||
|
||||
goto error;
|
||||
goto drop;
|
||||
}
|
||||
|
||||
aprs->info[aprs->offset_info++] = c;
|
||||
|
@ -288,6 +278,11 @@ ssize_t patty_ax25_aprs_is_drain(patty_ax25_aprs_is *aprs,
|
|||
done:
|
||||
return aprs->offset_i - offset_start;
|
||||
|
||||
drop:
|
||||
(void)patty_ax25_aprs_is_flush(aprs);
|
||||
|
||||
return aprs->offset_i - offset_start;
|
||||
|
||||
error:
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue