* ACK packets being rejected in SYNPROXY, unless there was a valid TCP connection before it
@ 2024-09-16 22:03 Yadunandan Pillai
0 siblings, 0 replies; only message in thread
From: Yadunandan Pillai @ 2024-09-16 22:03 UTC (permalink / raw)
To: Kernelnewbies@kernelnewbies.org
Hi,
I have written an XDP program that intercepts ACK handshake packets, and rewrites the acknowledgement number with a randomly generated syncookie (bpf_tcp_raw_gen_syncookie_ipv4). The idea is to eventually create a custom SYNPROXY.
I've got a TCP socket server that logs whenever "accept" finishes (connection was established). Initially, my ACK packets kept getting rejected with RST packets. However, I found that once I unlink the XDP program, complete a normal TCP handshake, and then link the XDP program again, the ACK packets are accepted.
I figured there's some issue with hanging socket states so I tried killing all TIME_WAIT, and other sockets in various close states with `ss`, but the same behavior continued.
"xdp_synproxy_kern.c" is the only relevant example I can find in the kernel source, and it does the same thing I do with ACK packets. Only difference is, the sample code generates a SYNACK directly in the XDP program, while I let the kernel do it for me and just modify the ACK. I looked through the kernel source, and I didn't see any context being added to the listening port with SYNCOOKIES enabled until the ACK packet is received (as should be the behavior, otherwise you defeat the purpose of SYNCOOKIES).
What am I missing here?
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-09-16 22:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-16 22:03 ACK packets being rejected in SYNPROXY, unless there was a valid TCP connection before it Yadunandan Pillai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).