cederom commented on PR #4101: URL: https://github.com/apache/nuttx-apps/pull/4101#issuecomment-7070839263
Thanks, nice regression test. It hits the bug well: the 10 rounds of mss/8 all stay inside one write buffer (4 × mss), and each retransmission is fully ACKed, so `nrtx` goes back to 0 with #22132. A few things before merge: **Blocking** 1. **Kconfig (L126):** please add `NET_TCPBACKLOG`, `NET_SOCKOPTS` and `!DISABLE_PTHREAD`. Without a backlog, the final ACK of the handshake gets an RST if `accept()` isn't waiting yet. `listening = 1` is set before `accept()`, so on SMP this can latch `st->rst` and fail the test even with the fix. 2. **Idle nudge in the lossy loop (L605–610):** it ACKs `tun_contiguous()`, which includes the "lost" first transmission, and advertises 8192 before the next ACK shrinks the window back to mss/8. With `NET_TCP_RTO >= 4` or after a backoff, it fires every round and the case tests something else. Suggest `tun_send_tcp(st, st->isn + 1 + lastack, TCP_ACK, wnd);`. Or is the nudge needed there at all? **Should fix** 3. **L62:** `TUN_ROUNDS` assumes `TCP_MAXRTX` = 8, but it's configurable. Use `(CONFIG_NET_TCP_MAXRTX + 2)`. `TUN_IDLE_MS` and the 60 s budget also assume the default `NET_TCP_RTO`. 4. **L379–382, L418–419:** `setsockopt()` return values aren't checked. If the timeouts don't apply, `accept()`/`send()` can block forever. Record the failure the way the bind/listen path does. 5. **L633–636:** `volatile` doesn't order the `sent`/`done` stores on weakly ordered SMP (e.g. the 4-CPU armv8a runs). Please `pthread_join()` here before asserting on `st->sent`, and skip the join in teardown. **Nits** - **L64:** use `CONFIG_NET_TUN_PKTSIZE`. On a too-small buffer, `tun_read()` returns `-EINVAL` and keeps the packet, so the read loop spins on it. - **L579:** assert `st->mss > 0`. If the MSS option isn't the first option, the window silently becomes 1 byte. - **L323/L578:** `isn == 0` as the "no handshake yet" sentinel excludes a valid ISN. - **L481–490:** if an assert in setup fails, cmocka skips teardown, so the fd and the thread leak. - A defconfig with `NET_TUN` + nettest would let CI run this. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
