From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=gvDTp1bC; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTPS id C14B75A0619 for ; Mon, 27 Oct 2025 04:37:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761536258; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=P8kqBdnPvJ5VIGIR9IvGNBMpgF/T9AAPglsdDSMhUDo=; b=gvDTp1bCbf5oN/suqQE0XT+2Dt+W7rYzaeId8KR1GuzfPZZm1ermiOjQHnOh1ktlqFkXiV D72yCfl2rVnNm0cQTmfqpW6aHENS4yLvFhAqh3dvIuymZVFoHlQuj8oeL9ahUu1caiCSoJ z7uh8tld3G+/18xuhMCHoxpNgxe1XWU= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-274-8OUnI_eRMqqOD9g4vB1iQA-1; Sun, 26 Oct 2025 23:37:36 -0400 X-MC-Unique: 8OUnI_eRMqqOD9g4vB1iQA-1 X-Mimecast-MFC-AGG-ID: 8OUnI_eRMqqOD9g4vB1iQA_1761536253 Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-634cdb5d528so6293767a12.1 for ; Sun, 26 Oct 2025 20:37:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761536253; x=1762141053; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=P8kqBdnPvJ5VIGIR9IvGNBMpgF/T9AAPglsdDSMhUDo=; b=l26JmFdI78RqUFfVz8ZFBTjdGB+3a4Zp0b1pBY0m8RL/TgEyo9yBtbp/LL20XPRot+ Mkg/o95wDBP1+TP6hX0QjavoqsESL8vs+THoCAXvFhokAQ7Bzbv1QiNaKjzAC63uusbV F2Bqgo8LnzFiUy1xMZ4KfkV2+vWQ2CTCpVz4RfcXTt7SNfz8Mk/Dnu2UMdqA1GzraTpX riRyzi8P3U4ayOApHIcw2kfIUSO5wi4lq+BKGQItnri8fdK2m6kTuqOHAL8i4KJrHI4+ 2ErYv18pLwbESMWLqHOzUuBJvjhpjMBYAsQGmXzwoYK5M+yMFa3HcYnk9mevpvn/4w9j BJYQ== X-Forwarded-Encrypted: i=1; AJvYcCUxenNYWqzBZJl+DZ3M7KAgWmzxL/OryHmtzpFDEh6t/MXiBcasnzR70UzuUyeQRIJSdgfPpkqo4n8=@passt.top X-Gm-Message-State: AOJu0Yxdxy/eZZfmmS4xCOt1a+TBFmRuIXaH+dHuqRm+15Ed+2e//pZ+ 9lVlffIdfLCCfwYp7s/p6/mM2qA679lIDrw5cQ01D5pTV2gHWHcqdkZ7FzrFu7T6YJFel01DdV1 yyTisD2uz0gxnfp5duPQnuQBNTNHv4+BTZN5lDAoZvdurH9cgLKGLvd9NBmO4bnhwTPcnUV3pkz F0gI66KqmIFtusIn4tHTBY2Rhm5HeE X-Gm-Gg: ASbGncuVbyFwwziq/J2hcIdYtL6PxAA1x5+KmaPQs5lY2doYZ6q4YGwgn5uRx8uCep6 CL0zkYq4ZyfdX6QcYnQ+OUZDM2UyVxdRyoJHXG+I5DwO0FUyH2mNB40M4Mdcjy1yJP4tbKjlk/9 lGwPGYa9UR+PP3ASRXQyzu0Qq+rU9n6qLxYPGb+jEYrbqDqITrSs9bX5oG X-Received: by 2002:a05:6402:1ec8:b0:634:11d7:f70c with SMTP id 4fb4d7f45d1cf-63e5eafc1a5mr8841107a12.2.1761536253208; Sun, 26 Oct 2025 20:37:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFXdE7I63LnZ+Gw2bx9F400FFehLP0fvFpTueG4OEBSUCivn02NUXs5Xyi3lYp9DlElAS7fBGG4ZRcgMT6xwyM= X-Received: by 2002:a05:6402:1ec8:b0:634:11d7:f70c with SMTP id 4fb4d7f45d1cf-63e5eafc1a5mr8841099a12.2.1761536252769; Sun, 26 Oct 2025 20:37:32 -0700 (PDT) MIME-Version: 1.0 References: <20251017062838.21041-1-yuhuang@redhat.com> <20251017062838.21041-4-yuhuang@redhat.com> <20251024010431.4329a843@elisabeth> <20251024103717.715fe49e@elisabeth> In-Reply-To: From: Yumei Huang Date: Mon, 27 Oct 2025 11:37:20 +0800 X-Gm-Features: AWmQ_bmk8nk30FSIfBK71iFhUiqaNBRKqe7iiYxSAlaJ4hN1gMD5g0b1FkxuxWM Message-ID: Subject: Re: [PATCH v6 3/4] tcp: Resend SYN for inbound connections To: David Gibson X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: EawiuPcXIz_BvSvgHzrtlCWgwzC08sC06siiTH3wPxQ_1761536253 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Message-ID-Hash: I3YFQP2M4MKFK64DTLIBAK43IWK3F6TD X-Message-ID-Hash: I3YFQP2M4MKFK64DTLIBAK43IWK3F6TD X-MailFrom: yuhuang@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Stefano Brivio , passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Fri, Oct 24, 2025 at 6:56=E2=80=AFPM David Gibson wrote: > > On Fri, Oct 24, 2025 at 10:37:17AM +0200, Stefano Brivio wrote: > > On Fri, 24 Oct 2025 14:30:09 +1100 > > David Gibson wrote: > > > On Fri, Oct 24, 2025 at 01:04:31AM +0200, Stefano Brivio wrote: > > > > On Fri, 17 Oct 2025 14:28:37 +0800 > > > > Yumei Huang wrote: > [snip] > > > > > @@ -2409,8 +2419,17 @@ void tcp_timer_handler(const struct ctx *c= , union epoll_ref ref) > > > > > tcp_timer_ctl(c, conn); > > > > > } else if (conn->flags & ACK_FROM_TAP_DUE) { > > > > > if (!(conn->events & ESTABLISHED)) { > > > > > - flow_dbg(conn, "handshake timeout"); > > > > > - tcp_rst(c, conn); > > > > > + if (conn->retries >=3D TCP_MAX_RETRIES || > > > > > + conn->retries >=3D (c->tcp.tcp_syn_re= tries + > > > > > + c->tcp.syn_linear_t= imeouts)) { > > > > > + flow_dbg(conn, "handshake timeout= "); > > > > > + tcp_rst(c, conn); > > > > > + } else { > > > > > + flow_trace(conn, "SYN timeout, re= try"); > > > > > + tcp_send_flag(c, conn, SYN); > > > > > + conn->retries++; > > > > > > > > I think I already raised this point on a previous revision: this ne= eds > > > > to be zeroed as the connection is established, but I don't see that= in > > > > the current version. > > > > > > Yes, you raised that, but then I realised it's already handled. I > > > think I put that in the thread, not just direct to Yumei, but maybe > > > not? Or it just got lost in the minutiae. > > > > Yes, here: > > > > https://archives.passt.top/passt-dev/aOxFRfJjPWy0ZW0M@zatzit > > > > this is another example of what I meant about (potential) advantages of > > a fully threaded (email) workflow. > > > > In this case, I didn't review v2, which came before you could post this > > to my comment on v1, but in a normal case, we could have settled this > > earlier, once for all. > > Ah, right, that'd do it. > > > > When we receive a SYN-ACK, it will have th->ack_seq advanced a byte > > > acknowledging the SYN. tcp_tap_handler() calls > > > tcp_update_seqack_from_tap() in the !ESTABLISHED case which will see > > > the new ack_seq and clear retries (retrans before this series). > > > > It doesn't look obvious at all to me. > > Oh, it's definitely not obvious, but I'm pretty confident it's > correct. Fwiw, I spotted this because I thought the explicit handling > in v2 wasn't at quite the right point logically (though close enough > to be fine in practice). I went looking for the precise right point - > when we receive the SYN-ACK - and there it was, already handled. > > It does make a kind of logical sense. The RFCs don't generally treat > SYN (or SYN-ACK, or FIN) retransmits any differently from data > retransmits. We do treat them differently, but less so after this > series, which is a good thing, I think. > > > We're unlikely to break it in the future, so I don't think it's fragile > > in the long term, but... can one of you double check that it's actually > > the case with a manual one-off test? > > Yeah, I guess that's wise. Easiest way is probably to add a temporary > debug message here, and try it against a qemu guest that's temporarily > suspended. Yumei, I can walk you through this, too. Thank you, I've verified this by adding debug messages in the if block: if (th->ack && !(conn->events & ESTABLISHED)) tcp_update_seqack_from_tap(c, conn, ntohl(th->ack_seq)); conn->retries gets reset in tcp_update_seqack_from_tap(). > > -- > David Gibson (he or they) | I'll have my music baroque, and my code > david AT gibson.dropbear.id.au | minimalist, thank you, not the other wa= y > | around. > http://www.ozlabs.org/~dgibson --=20 Thanks, Yumei Huang