Commit Graph

59 Commits

Author SHA1 Message Date
Xiang Xiao
9d4c708913 net/tcp: Search conn list again to aovid the race condition in tcp_timer_expiry
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-06-07 20:15:41 +03:00
Xiang Xiao
298b4aba0c net/tcp: Hold the net lock in tcp_timer_expiry
to follow the call convention for d_txavail

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-06-07 20:15:41 +03:00
zhanghongyu
3f8b71924f tcp: move wd_timer from wifi driver to tcp stack
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2022-05-28 16:29:51 +08:00
Xiang Xiao
d8b97d7ae8 net/tcp: Use the relative value for keep alive timer
unify the timer process logic as other tcp state

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-05-18 18:40:41 +03:00
Xiang Xiao
2d3ee157ce net/tcp: Use the decrease timer in TCP_TIME_WAIT/TCP_FIN_WAIT_2
unify the timer process logic as other tcp state

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-05-18 18:40:41 +03:00
Alexander Lunev
0f080cdeaf net/tcp/sendfile: NET_TCP_WRITE_BUFFERS and NET_SENDFILE were inconsistent with each other:
tcp_sendfile() reads data directly from a file and does not use NET_TCP_WRITE_BUFFERS data flow
even if CONFIG_NET_TCP_WRITE_BUFFERS option is enabled.
Despite this, tcp_sendfile relied on NET_TCP_WRITE_BUFFERS specific flow control variables that
were idle during sendfile operation. Thus it was a total inconsistency.

E.g. because of the issue, TCP socket used by sendfile() operation never issued
FIN packet on close() command, and the TCP connection hung up.

As a result of the fix, simultaneously enabled CONFIG_NET_TCP_WRITE_BUFFERS and
CONFIG_NET_SENDFILE options can coexist.
2022-01-17 01:42:41 +08:00
Alexander Lunev
e9ab3adf23 net/tcp(unbuffered): advance sndseq by +1 because SYN and FIN occupy one sequence number (RFC 793) 2022-01-03 12:18:44 +09:00
Alexander Lunev
1e25602678 net/can,icmp,icmpv6,tcp,tcp_timer,udp: device should poll only those connections that are bound to the device.
tcp_timer: eliminated false decrements of conn->timer in case of multiple network adapters.
The false timer decrements sometimes provoked TCP spurious retransmissions due to premature timeouts.
2021-10-11 23:09:00 -07:00
chao.an
c132e5bed4 net/tcp: sanity check for the listen address
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-09-23 23:07:57 -07:00
chao.an
e03218ab71 net/tcp: reset the connection ref count before tcp_free()
reset the connection refcount if SYN retry count has elapsed

Assertion:

up_assert: Assertion failed at file:tcp/tcp_conn.c line: 764 task: netdev_wq

N/A

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-03-22 10:55:30 +09:00
GAEHWILER Reto
cbd4e90781 net/tcp: Rectified keepalive fix
Simplification of previous fix. Also fixes the case when new data should
be sent while a keepalive is not yet acked.
2020-11-18 17:40:42 -03:00
GAEHWILER Reto
83745652c4 TCP-stack fix for stalled tcp sockets due to broken keepalive
Fixes an issue where tcp sockets with activated keepalives stalled and
were not properly closed. Poll would not indicate a POLLHUP and therefore
locks down the application.

* tcp_conn_s.tcp_conn_s & tcp_conn_s.keepintvl changed to uint32_t
  According RFC1122 keepidle MUST have a default of 2 hours.
2020-10-27 11:21:56 -07:00
YAMAMOTO Takashi
4f7745ae1c net/tcp/tcp_timer.c: Remove redundant assignments
Found by clang-check:

tcp/tcp_timer.c:185:15: warning: Value stored to 'result' is never read
              result = tcp_callback(dev, conn, TCP_TIMEDOUT);
              ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tcp/tcp_timer.c:264:23: warning: Value stored to 'result' is never read
                      result = tcp_callback(dev, listener, TCP_TIMEDOUT);
                      ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tcp/tcp_timer.c:300:19: warning: Value stored to 'result' is never read
                  result = tcp_callback(dev, conn, TCP_TIMEDOUT);
                  ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 warnings generated.
2020-08-03 22:52:31 -05:00
Xiang Xiao
517974787f Rename clock_systime[r|spec] to clock_systime_[ticks|timespec]
follow up the new naming convention:
https://cwiki.apache.org/confluence/display/NUTTX/Naming+of+OS+Internal+Functions
2020-05-10 14:35:50 -06:00
Xiang Xiao
b7d922960f Fix nxstyle issue
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-08 07:20:49 -06:00
Gregory Nutt
98f431d8d8 net/: Run all .c files under net/ through tools/nxstyle and fix all resulting complaints. 2020-01-11 13:41:33 -03:00
Gregory Nutt
66ef6d143a This commit adds an initial implemented of TCP delayed ACKs as specified in RFC 1122.
Squashed commit of the following:

    net/tmp:  Rename the unacked field of the tcp connection structure to tx_unacked.  Too confusing with the implementation of delayed RX ACKs.

    net/tcp:  Initial implementation of TCP delayed ACKs.

    net/tcp:  Add delayed ACK configuration selection.  Rename tcp_ack() to tcp_synack().  It may or may not send a ACK.  It will always send SYN or SYN/ACK.
2019-12-08 13:13:51 -06:00
Gregory Nutt
9efadaefc1 net/tcp: Be consistent with units of TIME_WAIT. Units were unspecified in tcp/Kconfig, but assumed to be in units of half seconds in tcp/timer.h. include/nuttx/netconfig does not indicate the units but is apparently assuming seconds. This commit unifies all delays to clearly specified units of seconds. 2019-11-24 09:19:54 -06:00
Gregory Nutt
3b275fcf4e net/: Run nxstyle against all C files. 2019-10-25 11:31:42 -06:00
Gregory Nutt
1346f29151 net/: Fix alignment and spacing problems found by tools/nxstyle. 2019-07-02 18:02:23 -06:00
Gregory Nutt
f6b00e1966 tools/nxstyle.c: Fix logic error that prevent detecion of '/' and '/=' as operators. net/: Minor updates resulting from testing tools/nxstyle. 2019-03-11 12:48:39 -06:00
Gregory Nutt
b54ffe858a Standardization of some function headers. 2018-03-13 09:52:27 -06:00
Gregory Nutt
ae399b9b62 net/tcp: In tcp_input(), add the logic to detect, decode, and respond to TCP Keep-Alive packets. In tcp_timer(), fix some problems with the way that TCP Keep-Alive probes were being formatted. 2018-03-12 15:54:45 -06:00
Gregory Nutt
251924a734 Squashed commit of the following:
net/tcp:  Add logic to send probes when SO_KEEPALIVE is enabled.
    net/tcp:  TCP socket should not have to be connected to configure KeepAlive.
    net/: Add a separate configuration to enable/disable KEEPALIVE socket options.
    net/tcp: Arguments to TCP keep-alive timing functions probably should be struct timeval as are the times for other time-related socket options.
    net/tcp:  Fix a backward conditional
    net/tcp:  Add some more checks and debug output to TCP-protocol socket options.
    net/tcp:  Cosmetic changes to some alignment.
    net/:  Adds socket options needed to manage TCP-keepalive and TCP state machine logic to detect if that the remote peer is alive.  Still missing the timer poll logic to send the keep-alive probes and the state machine logic to respond to probes.
2018-03-12 10:59:46 -06:00
Gregory Nutt
7cf88d7dbd Make sure that labeling is used consistently in all function headers. 2018-02-01 10:00:02 -06:00
Gregory Nutt
0b2a4eb4bd Networking: A little more wording changes related to interrupts vs. events 2017-08-29 15:08:38 -06:00
Gregory Nutt
bd7c84b23e Remove CONFIG_NETDEV_MULTINIC. This increases code size by a little, but greatly reduces the complexity of the network code. 2017-08-08 14:24:12 -06:00
Masayuki Ishikawa
32a638cdfe TCP: Fix tcp_findlistner() in dual stack mode
Signed-off-by: Masayuki Ishikawa <masayuki.ishikawa@gmail.com>
2017-05-25 16:54:19 +09:00
Gregory Nutt
914c5dad0c TCP: An RST recevied suring the 3-way handshake requires a little more clean-up 2017-05-15 08:10:43 -06:00
Gregory Nutt
8acfea1197 Fix some typos 2017-05-14 12:14:31 -06:00
Gregory Nutt
d339ba9e0e TCP: Fix some potential error conditions that could result from deferring the connection until the full 3-way handshake has completed. 2017-05-14 10:56:25 -06:00
Gregory Nutt
1b6630ee75 6loWPAN: Fix compile errors and warnings when building the complete 6loWPAN configuration. 2017-04-02 17:46:22 -06:00
Gregory Nutt
43eb04bb8f Without lowsyslog() *llinfo() is not useful. Eliminate and replace with *info(). 2016-06-20 11:59:15 -06:00
Gregory Nutt
fc3540cffe Replace all occurrences of vdbg with vinfo 2016-06-11 11:59:51 -06:00
Gregory Nutt
2dd9777c7e Fix a backward conditional test introduced with the last commit 2016-03-20 09:58:07 -06:00
Gregory Nutt
4639cdd894 TCP timeouts: Fix some logic when there are multiple network interfaces. In this case, TCP timeout events can really only being processed when the poll from the correct device is received. 2016-03-20 08:19:00 -06:00
Gregory Nutt
2c95fef501 Remove some empty code section comments 2016-02-26 07:35:55 -06:00
Gregory Nutt
0fb035f76b Standardize some naming in code section comments 2016-02-21 18:09:04 -06:00
Gregory Nutt
cb9e27c3b0 Standardize naming used for public data and function groupings 2015-10-02 16:30:35 -06:00
Gregory Nutt
d6c3ed1c6f Networking: Fixes an important TCP bug: 16-bit flags was being converted to 8-bits in a few locations, causing loss of status indications 2015-05-27 17:17:42 -06:00
Gregory Nutt
d8b046f2fb Networking: Fix a simple IPv6 compile error 2015-01-17 17:48:15 -06:00
Gregory Nutt
88a0e82934 Networking: Remove field d_sndata from the device structure. It is the same as d_appdata and unnecessary 2015-01-17 05:59:13 -06:00
Gregory Nutt
630366272a Networking: Seperate tcp_input() and udp_input() into seprate functions tcp_ipv4_input(), tcp_ipv6_input(), udp_ipv4_input(), and upd_ipv6_input() than can deal will the data offsets caused by the differing sizes of the IP header. 2015-01-15 15:06:46 -06:00
Gregory Nutt
2e55db369d Network: All logic will now handle varialbe length link layer protocol headers within incoming packets. This permits use of multiple network interfaces with differing data links. For example, ETHERNET + SLIP 2014-11-15 13:13:23 -06:00
Gregory Nutt
73f3ecf7e2 NET: Rename network interrupt event flags more appropriately: TCP_, UDP_, ICMP_, or PKT_ vs UIP_ 2014-07-06 17:22:02 -06:00
Gregory Nutt
a251259f90 NET: Rename some non-configurable constants UIP_ to IP_ or TCP_ 2014-07-06 16:19:26 -06:00
Gregory Nutt
b77fda2c95 NET: Rename TCP state values: UIP_ -> TCP_ 2014-07-06 16:10:26 -06:00
Gregory Nutt
2d52d70d4c NET: Move private definitions from include/nuttx/net/tcp to net/tcp/tcp.h 2014-07-06 12:34:27 -06:00
Gregory Nutt
c5fc24e110 NET: Standardize naming of all protocal header lengths 2014-07-05 13:04:48 -06:00
Gregory Nutt
0bb153b8cb Remove all inclusion of uip.h 2014-07-04 16:58:22 -06:00