Skip to content

Commit

Permalink
xdp-synproxy: set SYN+ACK with max window size
Browse files Browse the repository at this point in the history
set window size to 0 for XDP generated SYNACK
seems not common to normal SYNACK which has
larger window size, so set to max window size

Signed-off-by: Vincent Li <[email protected]>
  • Loading branch information
vincentmli committed Nov 8, 2024
1 parent e2a03b1 commit 6c63119
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion xdp-synproxy/xdp_synproxy.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
#define DEFAULT_WSCALE 7
#define DEFAULT_TTL 64
#define MAX_ALLOWED_PORTS 8
#define MAX_WINDOW_SIZE 65535

#define MAX_PACKET_OFF 0xffff

Expand Down Expand Up @@ -524,7 +525,7 @@ static __always_inline void tcp_gen_synack(struct tcphdr *tcp_header,
swap(tcp_header->source, tcp_header->dest);
tcp_header->ack_seq = bpf_htonl(bpf_ntohl(tcp_header->seq) + 1);
tcp_header->seq = bpf_htonl(cookie);
tcp_header->window = 0;
tcp_header->window = bpf_htons(MAX_WINDOW_SIZE);
tcp_header->urg_ptr = 0;
tcp_header->check = 0; /* Calculate checksum later. */

Expand Down

0 comments on commit 6c63119

Please sign in to comment.