-
Notifications
You must be signed in to change notification settings - Fork 2.1k
net/gnrc_tcp: timeout of connection establishment #10945
Description
Description
Disturbances during connection establishment (see gnrc_tcp_open_passive()) may lead to half-open state and thus to deadlock of a TCP endpoint.
The problem occurred in two different scenarios. The first one was figured by @sabyse during testing. She found that a lost ACK after a SYN-ACK during 3-way handshake leads to an infinite number of SYN-ACK retransmissions, as the timer is never stopped. This leads to deadlock as the only TCB we allocate is never freed again.
The second one will be described below in more detail and is present with the current tests/gnrc_tcp_* applications due to an other issue.
Steps to reproduce the issue
- Set up tap bridge and two tap devices (e.g. by running
RIOT/dist/tools/tapsetup/tapsetup -c 2) - Open wireshark and monitor traffic on
tapbr0 - Build and run tests/gnrc_tcp_server on Node A (
make all term) - Build and run tests/gnrc_tcp_client on Node B (
make all term PORT=tap1)
(Adding a delay (for examplextimer_sleep(5)) before connection establishment here prevents the initial SYN packet from being sent with : : source address and thus, successfully establishes the connection. However, this only fixes "the other issue" not the TCP timeout)
Expected results
Successful 3-way handshake establishes a TCP connection.
Actual results
- Node A sends a SYN packet with source address
: :. - Node B does not establish the connection.
- Node A retransmits the SYN with its correct source address.
- Node B responds RST-ACK and will never establish any connection again.
Versions
Operating System Environment
-----------------------------
Operating System: "Ubuntu" "18.04.1 LTS (Bionic Beaver)"
Kernel: Linux 4.15.0-45-generic x86_64 x86_64
Installed compiler toolchains
-----------------------------
native gcc: gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
arm-none-eabi-gcc: arm-none-eabi-gcc (GNU Tools for Arm Embedded Processors 7-2018-q3-update) 7.3.1 20180622 (release) [ARM/embedded-7-branch revision 261907]
avr-gcc: missing
mips-mti-elf-gcc: missing
msp430-gcc: msp430-gcc (GCC) 4.6.3 20120301 (mspgcc LTS 20120406 unpatched)
riscv-none-embed-gcc: missing
xtensa-esp32-elf-gcc: missing
xtensa-lx106-elf-gcc: missing
clang: missing
Installed compiler libs
-----------------------
arm-none-eabi-newlib: "3.0.0"
mips-mti-elf-newlib: missing
riscv-none-embed-newlib: missing
xtensa-esp32-elf-newlib: missing
xtensa-lx106-elf-newlib: missing
avr-libc: missing (missing)
Installed development tools
---------------------------
cmake: cmake version 3.10.2
cppcheck: missing
doxygen: 1.8.13
flake8: 3.6.0 (mccabe: 0.6.1, pycodestyle: 2.4.0, pyflakes: 2.0.0) CPython 3.6.7 on Linux
git: git version 2.17.1
make: GNU Make 4.1
openocd: Open On-Chip Debugger 0.10.0
python: Python 2.7.15rc1
python2: Python 2.7.15rc1
python3: Python 3.6.7
coccinelle: missing