soypat / seqs

seqs: the hottest, most idiomatic userspace TCP/IP implementation on the internet. lwip in go basically
BSD 3-Clause "New" or "Revised" License
47 stars 5 forks source link

tcb:rcv.reject with segment drop stops TCP #18

Open marcofeltmann opened 7 months ago

marcofeltmann commented 7 months ago

I tried both the reference implementation from the book Automate Your Home Using Go and your example/http-server code.

It works until the first request appears. (Sometimes !dhcpclient.IsDone() although the DHCP server assigned that IP, but yeah, I can somewhat fix that setting the same RequestedIP in config)

-- snip ---
time=1970-01-01T00:00:09.011Z level=INFO msg=listening addr=http://192.168.160.203:80
time=1970-01-01T00:00:25.714Z level=INFO msg=TCP:rx-statechange port=80 old=Listen new=SynRcvd rxflags=[SYN]
time=1970-01-01T00:00:25.869Z level=ERROR msg=tcb:rcv.reject err="drop segment"

After that happened all TCP requests time out or fail as the particular IP address is no longer reachable. No more logs are spawned, it seems dead.

With curl sometimes I can get up to three requests through and then it stops. But with Firefox Developer Edition it stops directly at the first approach.

I know that TCP/IP is kinda fragile and things like that might happen. Yet I'd expect that system to somehow discard these errors gracefully and keep on receiving.

If you do have any idea on what makes this happen and how to cope with it, I'd happily fork and fiddle around.

soypat commented 7 months ago

Could you upload wireshark captures of this bug in action? With a wireshark capture of packets it should be relatively easy to write a test for this bug.

soypat commented 6 months ago

Might be a fix: https://github.com/soypat/seqs/pull/24