smoltcp icon indicating copy to clipboard operation
smoltcp copied to clipboard

Allow withholding the SYN|ACK packet by user code

Open eeeeeta opened this issue 8 months ago • 1 comments

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.

eeeeeta avatar Nov 30 '23 14:11 eeeeeta

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
@@            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.

codecov[bot] avatar Nov 30 '23 14:11 codecov[bot]

Fair enough!

eeeeeta avatar Jun 16 '24 13:06 eeeeeta