Project

General

Profile

Actions

Bug #5848

open

TCP options are reset after failed connect()

Added by Marcel Telka about 7 years ago. Updated about 7 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
networking
Start date:
2015-04-16
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

The TCP options (for example TCP_KEEPIDLE, or TCP_CONN_ABORT_THRESHOLD) are reset to their default values after the failed connect().

Steps to reproduce:

# uname -a
SunOS openindiana 5.11 illumos-f8554bb i86pc i386 i86pc Solaris
# curl https://www.illumos.org/attachments/download/1266/tcp-timeout.c -o tcp-timeout.c
# gcc -Wall -lxnet -o tcp-timeout tcp-timeout.c
# time ./tcp-timeout 10.0.0.1 22
Opening TCP socket... done
Reading TCP_KEEPIDLE... 7200 s
Setting TCP_KEEPIDLE to 3600 s... done
Reading TCP_KEEPIDLE... 3600 s
Trying to connect to the host... done
Reading TCP_KEEPIDLE... 3600 s

real    0m0.008s
user    0m0.001s
sys     0m0.003s
# time ./tcp-timeout 10.0.0.1 222
Opening TCP socket... done
Reading TCP_KEEPIDLE... 7200 s
Setting TCP_KEEPIDLE to 3600 s... done
Reading TCP_KEEPIDLE... 3600 s
Trying to connect to the host... failed
Reading TCP_KEEPIDLE... 7200 s

real    3m10.963s
user    0m0.001s
sys     0m0.003s
#

We see that after the successful connect(), the value of the TCP_KEEPIDLE option stays as it was before the connect() call. OTOH, after the failed connect(), the TCP_KEEPIDLE option resets to its default.

When tested on linux (Fedora 21), the TCP_KEEPIDLE value is preserved even after the connect() failure:

# uname -a
Linux localhost.localdomain 3.19.3-200.fc21.x86_64 #1 SMP Thu Mar 26 21:39:42 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
# curl https://www.illumos.org/attachments/download/1266/tcp-timeout.c -o tcp-timeout.c
# gcc -Wall -o tcp-timeout tcp-timeout.c
# time ./tcp-timeout 10.0.0.1 22
Opening TCP socket... done
Reading TCP_KEEPIDLE... 7200 s
Setting TCP_KEEPIDLE to 3600 s... done
Reading TCP_KEEPIDLE... 3600 s
Trying to connect to the host... done
Reading TCP_KEEPIDLE... 3600 s

real    0m0.002s
user    0m0.000s
sys    0m0.001s
# time ./tcp-timeout 10.0.0.1 222
Opening TCP socket... done
Reading TCP_KEEPIDLE... 7200 s
Setting TCP_KEEPIDLE to 3600 s... done
Reading TCP_KEEPIDLE... 3600 s
Trying to connect to the host... failed
Reading TCP_KEEPIDLE... 3600 s

real    2m7.288s
user    0m0.002s
sys    0m0.000s
#

Files

tcp-timeout.c (1.79 KB) tcp-timeout.c Marcel Telka, 2015-04-16 01:40 PM

Related issues

Related to illumos gate - Bug #5753: libnsl: set_up_connection() over TCP does not adhere the specified timeoutClosedMarcel Telka2015-03-26

Actions
Actions #1

Updated by Marcel Telka about 7 years ago

  • Description updated (diff)
Actions #2

Updated by Marcel Telka about 7 years ago

  • Related to Bug #5753: libnsl: set_up_connection() over TCP does not adhere the specified timeout added
Actions

Also available in: Atom PDF