From: Mazet Laurent Date: Thu, 12 Jun 2025 13:48:13 +0000 (+0200) Subject: better alien packet handling X-Git-Tag: v1.0~11 X-Git-Url: https://secure.softndesign.org/git/?a=commitdiff_plain;h=e8fadbb72f2326302edde24aa1a0c25d6cf726eb;p=ulvpn.git better alien packet handling --- diff --git a/ulvpn.c b/ulvpn.c index efb1e5a..f6ca9e3 100644 --- a/ulvpn.c +++ b/ulvpn.c @@ -344,11 +344,10 @@ int main (int argc, char **argv) signal(SIGTERM, sig_handler); /* main loop */ - int rc; + int rc = 0; int seqrx = -1; int seqtx = -1; while (!stop) { - rc = 2; fd_set readset; int max_fd = 0; @@ -374,6 +373,7 @@ int main (int argc, char **argv) if (-1 == select (max_fd + 1, &readset, NULL, NULL, NULL)) { if (!stop) { VERBOSE (ulvpn, ERROR, PRINTF ("select error\n")); + rc = 2; } break; } @@ -445,6 +445,9 @@ int main (int argc, char **argv) uint8_t msgtype = -1; int rxlen = 0; seqrx = MOREP_Receive (rxblack_fd, &msgtype, buffer, &rxlen); + if (seqrx == -2) { + continue; + } if (rxlen <= 0) { VERBOSE (ulvpn, WARNING, PRINTF ("error when receiving from CM black\n")); @@ -481,6 +484,9 @@ int main (int argc, char **argv) uint8_t msgtype = -1; int rxlen = 0; seqrx = MOREP_Receive (rxred_fd, &msgtype, buffer, &rxlen); + if (seqrx == -2) { + continue; + } if (rxlen <= 0) { VERBOSE (ulvpn, WARNING, PRINTF ("error when receiving from CM bred\n")); @@ -514,7 +520,6 @@ int main (int argc, char **argv) } - rc = 0; } /* cleaning */