Fix dropped packets to promisc interfaces

This commit is contained in:
XANTRONIX Development 2020-08-03 02:44:17 -04:00 committed by XANTRONIX Industrial
parent 16179894d2
commit c287eb7a61

View file

@ -292,6 +292,10 @@ static int sock_shutdown(patty_ax25_server *server,
patty_ax25_sock *sock) { patty_ax25_sock *sock) {
fd_clear(server, sock->fd); fd_clear(server, sock->fd);
if (sock->type != PATTY_AX25_SOCK_STREAM) {
return 0;
}
if (sock->status != PATTY_AX25_SOCK_ESTABLISHED) { if (sock->status != PATTY_AX25_SOCK_ESTABLISHED) {
return 0; return 0;
} }
@ -1754,12 +1758,14 @@ static int handle_sock(uint32_t key,
goto done; goto done;
} }
if (sock->type == PATTY_AX25_SOCK_STREAM) {
/* /*
* NOTE: See AX.25 2.2, Section 6.4.1, "Sending I Frames" * NOTE: See AX.25 2.2, Section 6.4.1, "Sending I Frames"
*/ */
if (sock->seq_recv + sock->n_window_tx == sock->seq_send) { if (sock->seq_recv + sock->n_window_tx == sock->seq_send) {
goto done; goto done;
} }
}
if ((len = read(sock->fd, sock->rx_buf, sock->n_maxlen_rx)) < 0) { if ((len = read(sock->fd, sock->rx_buf, sock->n_maxlen_rx)) < 0) {
if (errno == EIO) { if (errno == EIO) {
@ -1779,10 +1785,12 @@ static int handle_sock(uint32_t key,
goto error_sock_write; goto error_sock_write;
} }
if (sock->type == PATTY_AX25_SOCK_STREAM) {
/* /*
* AX.25 v2.2, Section 6.4.1 "Sending I Frames" * AX.25 v2.2, Section 6.4.1 "Sending I Frames"
*/ */
patty_timer_start(&sock->timer_t1, sock->n_ack); patty_timer_start(&sock->timer_t1, sock->n_ack);
}
done: done:
return 0; return 0;