4 ms·
TCP_DEFER_ACCEPT is probably what you're looking for (SO_ACCEPTFILTER on BSD/macos) : https://github.com/paraboul/libapenetwork/blob/6e5acac08467b818914ba600a9
by paraboul 5y ago
TCP_DEFER_ACCEPT is probably what you're looking for (SO_ACCEPTFILTER on BSD/macos) :
https://github.com/paraboul/libapenetwork/blob/6e5acac08467b818914ba600a9985e04ccfd32c6/src/ape_socket.c#L266-L334 https://github.com/paraboul/libapenetwork/blob/6e5acac08467b...
- mkj 5y agoI don't think TCP_DEFER_ACCEPT does that - "Allow a listener to be awakened only when data arrives on" it just changes the timing of accept()? What you describe sounds more like TCP_CORK, but I don't think that'll work. Looking a bit more at the network stack perhaps the SYN+ACK is sent straight from the SYN handler with no chance for userspace to pack any data in. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/net/ipv4/tcp_input.c?h=v5.13#n6860 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin... Edit: Ah, you are right about TCP_DEFER_ACCEPT putting data in the ACK on the client side, I'd forgotten about that. https://lore.kernel.org/netdev/CAK3+h2ydKQ15U1_2dqWsHAL_LKYm-1xbJvUbeaMJShoOCU_TsA@mail.gmail.com/ https://lore.kernel.org/netdev/CAK3+h2ydKQ15U1_2dqWsHAL_LKYm...
- paraboul 5y agoOops my bad, indeed.