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 == ':') {
|
} else if (c == ',' || c == ':') {
|
||||||
if (aprs->frame.dest.callsign[0]) {
|
if (aprs->frame.dest.callsign[0]) {
|
||||||
if (aprs->frame.hops == PATTY_AX25_MAX_HOPS) {
|
if (aprs->frame.hops == PATTY_AX25_MAX_HOPS) {
|
||||||
errno = EOVERFLOW;
|
goto drop;
|
||||||
|
|
||||||
goto error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
addr = &aprs->frame.repeaters[aprs->frame.hops++];
|
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)) {
|
} else if (PATTY_AX25_ADDR_CHAR_VALID(c)) {
|
||||||
if (aprs->offset_call == PATTY_AX25_ADDRSTRLEN) {
|
if (aprs->offset_call == PATTY_AX25_ADDRSTRLEN) {
|
||||||
errno = EOVERFLOW;
|
goto drop;
|
||||||
|
|
||||||
goto error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
aprs->call[aprs->offset_call++] = c;
|
aprs->call[aprs->offset_call++] = c;
|
||||||
} else {
|
} else {
|
||||||
errno = EINVAL;
|
goto drop;
|
||||||
|
|
||||||
goto error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addr) {
|
if (addr) {
|
||||||
aprs->call[aprs->offset_call] = '\0';
|
aprs->call[aprs->offset_call] = '\0';
|
||||||
|
|
||||||
if (patty_ax25_pton(aprs->call, addr) < 0) {
|
if (patty_ax25_pton(aprs->call, addr) < 0) {
|
||||||
(void)patty_ax25_aprs_is_flush(aprs);
|
goto drop;
|
||||||
|
|
||||||
goto done;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
aprs->offset_call = 0;
|
aprs->offset_call = 0;
|
||||||
|
@ -270,9 +262,7 @@ ssize_t patty_ax25_aprs_is_drain(patty_ax25_aprs_is *aprs,
|
||||||
goto done;
|
goto done;
|
||||||
} else {
|
} else {
|
||||||
if (aprs->offset_info == aprs->infosz) {
|
if (aprs->offset_info == aprs->infosz) {
|
||||||
errno = EOVERFLOW;
|
goto drop;
|
||||||
|
|
||||||
goto error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
aprs->info[aprs->offset_info++] = c;
|
aprs->info[aprs->offset_info++] = c;
|
||||||
|
@ -288,6 +278,11 @@ ssize_t patty_ax25_aprs_is_drain(patty_ax25_aprs_is *aprs,
|
||||||
done:
|
done:
|
||||||
return aprs->offset_i - offset_start;
|
return aprs->offset_i - offset_start;
|
||||||
|
|
||||||
|
drop:
|
||||||
|
(void)patty_ax25_aprs_is_flush(aprs);
|
||||||
|
|
||||||
|
return aprs->offset_i - offset_start;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue