smoltcp-rs / smoltcp

a smol tcp/ip stack
BSD Zero Clause License
3.64k stars 404 forks source link

Allow withholding the SYN|ACK packet by user code #863

Closed eeeeeta closed 2 weeks ago

eeeeeta commented 7 months ago

In certain use cases, it's desirable to not send a SYN|ACK packet immediately after receiving a SYN -- for example, a TCP proxy that doesn't want to do so until it's connected to the end destination, because the outgoing connection might get refused. (Currently, you have to send a SYN|ACK and then reset the connection afterwards in this case, which is what we do in onionmasq.)

To fix this, add a simple synack_paused flag, controllable by user code, that withholds SYN|ACK packets in SynReceived state until it is unset.

codecov[bot] commented 7 months ago

Codecov Report

Attention: 17 lines in your changes are missing coverage. Please review.

Comparison is base (f3be43a) 79.55% compared to head (21751ec) 79.53%. Report is 5 commits behind head on main.

Files Patch % Lines
src/socket/raw.rs 44.44% 5 Missing :warning:
src/socket/udp.rs 44.44% 5 Missing :warning:
src/socket/tcp.rs 55.55% 4 Missing :warning:
src/socket/icmp.rs 70.00% 3 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #863 +/- ## ========================================== - Coverage 79.55% 79.53% -0.02% ========================================== Files 78 78 Lines 27917 27896 -21 ========================================== - Hits 22208 22186 -22 - Misses 5709 5710 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

eeeeeta commented 2 weeks ago

Fair enough!