mirror of
https://passt.top/passt
synced 2024-12-22 13:45:32 +00:00
Compare commits
4 Commits
71dd405460
...
4988e2b406
Author | SHA1 | Date | |
---|---|---|---|
|
4988e2b406 | ||
|
5894a245b9 | ||
|
16c2d8da0d | ||
|
99355e25b9 |
13
tcp.c
13
tcp.c
@ -1593,8 +1593,6 @@ static void tcp_update_seqack_from_tap(const struct ctx *c,
|
|||||||
*/
|
*/
|
||||||
static int tcp_send_flag(struct ctx *c, struct tcp_tap_conn *conn, int flags)
|
static int tcp_send_flag(struct ctx *c, struct tcp_tap_conn *conn, int flags)
|
||||||
{
|
{
|
||||||
uint32_t prev_ack_to_tap = conn->seq_ack_to_tap;
|
|
||||||
uint32_t prev_wnd_to_tap = conn->wnd_to_tap;
|
|
||||||
struct tcp4_l2_flags_buf_t *b4 = NULL;
|
struct tcp4_l2_flags_buf_t *b4 = NULL;
|
||||||
struct tcp6_l2_flags_buf_t *b6 = NULL;
|
struct tcp6_l2_flags_buf_t *b6 = NULL;
|
||||||
struct tcp_info tinfo = { 0 };
|
struct tcp_info tinfo = { 0 };
|
||||||
@ -1674,16 +1672,13 @@ static int tcp_send_flag(struct ctx *c, struct tcp_tap_conn *conn, int flags)
|
|||||||
*data++ = OPT_WS;
|
*data++ = OPT_WS;
|
||||||
*data++ = OPT_WS_LEN;
|
*data++ = OPT_WS_LEN;
|
||||||
*data++ = conn->ws_to_tap;
|
*data++ = conn->ws_to_tap;
|
||||||
|
} else if (!(flags & RST)) {
|
||||||
th->ack = !!(flags & ACK);
|
flags |= ACK;
|
||||||
} else {
|
|
||||||
th->ack = !!(flags & (ACK | DUP_ACK)) ||
|
|
||||||
conn->seq_ack_to_tap != prev_ack_to_tap ||
|
|
||||||
!prev_wnd_to_tap;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
th->doff = (sizeof(*th) + optlen) / 4;
|
th->doff = (sizeof(*th) + optlen) / 4;
|
||||||
|
|
||||||
|
th->ack = !!(flags & ACK);
|
||||||
th->rst = !!(flags & RST);
|
th->rst = !!(flags & RST);
|
||||||
th->syn = !!(flags & SYN);
|
th->syn = !!(flags & SYN);
|
||||||
th->fin = !!(flags & FIN);
|
th->fin = !!(flags & FIN);
|
||||||
@ -2503,7 +2498,7 @@ out:
|
|||||||
*/
|
*/
|
||||||
if (conn->seq_dup_ack_approx != (conn->seq_from_tap & 0xff)) {
|
if (conn->seq_dup_ack_approx != (conn->seq_from_tap & 0xff)) {
|
||||||
conn->seq_dup_ack_approx = conn->seq_from_tap & 0xff;
|
conn->seq_dup_ack_approx = conn->seq_from_tap & 0xff;
|
||||||
tcp_send_flag(c, conn, DUP_ACK);
|
tcp_send_flag(c, conn, ACK | DUP_ACK);
|
||||||
}
|
}
|
||||||
return p->count - idx;
|
return p->count - idx;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user