Repository navigation
Conversation
The PR description also says the test server needs nuttx-apps #4103; that should be listed as a dependency. |
5a35a49 to
16e7aed
Compare
|
@cederom 1, 2, 3, 5: Done. |
|
Please resolve the tesitng/nettest conflicts :-) Fixed:
Still open:
|
|
@casaroli please fix the conflict |
|
4: On master the case does not stop in pthread_join(): its main thread stops before, in close() of the listener, in the kernel (tcp_free() waits for the device lock with the list lock held). No time limit in the test can end that. 6: Done for the time check (tcp_backlog_now() is removed). A fixed pool does not run out: when it is full, tcp_alloc_conn() frees the oldest connection in TIME_WAIT (tcp_reclaim()). #4103 is merged. |
Three cases in cmocka_net_tcp (IPv4 on the loopback address) for the backlog of a listener. They need CONFIG_NET_TCPBACKLOG. - test_tcp_backlog_relisten_rst: client A connects to a listener of backlog 4 and nobody accepts it. listen() again gives a backlog of 1 (A moves to the new backlog), then A resets its connection (SO_LINGER 0). The connect() of client C must end within 2 s: a backlog that still holds A drops the SYN of C. accept() then gives C (the reset connection of A may come first). 10 rounds. It needs CONFIG_NET_SOLINGER. - test_tcp_backlog_relisten_race: 50 rounds of a listener of backlog 8, 6 clients that connect at once, listen() again with a backlog of 1 while they connect, and the close of the listener. Two more clients keep the loopback input busy with connections to another listener. Each round must end. - test_tcp_backlog_close_race: the same with 4 clients to a listener of backlog 4 that closes while their handshakes run. The clients of the race cases use a non-blocking connect() and wait at most 500 ms, so a dropped SYN does not make a round long. Their thread IDs are in the state of the case, so that the teardown waits for them when an assert ends the case. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
Two cases in cmocka_net_tcp (IPv4 on the loopback address) for a read of /proc/net/tcp with more than 255 connections. - test_tcp_procfs_many: 300 connections to a listener on 127.0.0.1, each closed by the client first, so that each stays in TIME_WAIT on the client side. Then /proc/net/tcp is read to its end in reads of 1 KiB. The read must end within 8192 lines (more lines mean that the read starts again from the head of the table), and must list each connection of the listener once: 300 to 600 lines with its port. Connections that earlier cases leave in TIME_WAIT are not counted. - test_tcp_procfs_close: 8 open pairs to a first listener, then 300 connections in TIME_WAIT to a second one. The file is read until the lines of the pairs are there, then the pairs reset their connections (SO_LINGER 0) and the read goes on to the end. It must list the client side of each connection to the second listener once: connections that go away during a read must not hide others. It needs CONFIG_NET_SOLINGER. They need /proc/net/tcp (CONFIG_NET_STATISTICS) and dynamic connections and callbacks (CONFIG_NET_TCP_ALLOC_CONNS and CONFIG_NET_ALLOC_DEVIF_CALLBACKS greater than 0), with no limit or a limit of 1024 or more (CONFIG_NET_TCP_MAX_CONNS), and a CONFIG_NET_TCP_WAIT_TIMEOUT of 60 s or more: the connections in TIME_WAIT must stay while the file is read. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
16e7aed to
db61af7
Compare
|
3: Done. |
Summary
New cases of
cmocka_net_tcpfor the fixes of apache/nuttx#22145, on the IPv4 loopback address:test_tcp_backlog_relisten_rst: client A connects to a listener of backlog 4 and nobody accepts it.listen()again gives a backlog of 1, then A resets its connection (SO_LINGER{1, 0}). Theconnect()of client C must end within 2 s. 10 rounds. NeedsCONFIG_NET_SOLINGER.test_tcp_backlog_relisten_race: 50 rounds of a listener of backlog 8, 6 clients that connect at once,listen()again with a backlog of 1 while they connect, and the close of the listener. Two more clients keep the loopback input busy.test_tcp_backlog_close_race: the same with 4 clients and the close of the listener while their handshakes run.test_tcp_procfs_many: 300 connections that the client closes first (they stay in TIME_WAIT), then a read of/proc/net/tcpto its end in 1 KiB parts. The read must end within 8192 lines and list each connection of the case's listener once (300 to 600 lines with its port). Connections that the earlier cases leave in TIME_WAIT are not counted.test_tcp_procfs_close: 8 open pairs to a first listener, then 300 connections in TIME_WAIT to a second one. The file is read until the lines of the pairs are there, then the pairs reset their connections and the read goes on to its end. It must list the client side of each connection to the second listener once. NeedsCONFIG_NET_SOLINGER.The backlog cases need
CONFIG_NET_TCPBACKLOG. The procfs cases need/proc/net/tcp(CONFIG_NET_STATISTICS),CONFIG_NET_TCP_ALLOC_CONNS> 0,CONFIG_NET_ALLOC_DEVIF_CALLBACKS> 0,CONFIG_NET_TCP_MAX_CONNS0 or 1024 or more, andCONFIG_NET_TCP_WAIT_TIMEOUT60 s or more. Every socket has a 10 s send and receive timeout. A kernel with the lock-order bug stops the network in the race cases.Impact
Only
testing/nettest/tcp: two new source files (test_tcp_backlog.c,test_tcp_procfs.c, built withCONFIG_NET_IPv4) and their lines inMakefileandCMakeLists.txt. No new Kconfig option.Testing
qemu-armv8a:knsh (kernel build) and qemu-armv8a:nsh (flat build) under HVF, 4 CPUs, TCP over the loopback device,
NET_TCPBACKLOG,NET_SOLINGER, dynamic connections and devif callbacks. NuttX master 623b1a9ad18 and apache/nuttx#22145 both with apache/nuttx#22168 applied (without it, master stops incmocka_net_tcpbefore these cases):test_tcp_backlog_relisten_rstconnect()of C times out (110)test_tcp_backlog_relisten_racetest_tcp_backlog_close_racetest_tcp_procfs_manytest_tcp_procfs_closeAll 36 cases of
cmocka_net_tcpin one run with apache/nuttx#22145: 34 pass on knsh, 35 on flat nsh.test_tcp_send_limit_wakeupandtest_tcp_close_timewait(knsh) andtest_tcp_reset_send(flat) fail on master in the same way.tools/checkpatch.sh -c -u -m -gpasses.