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=I1ZUtLn7; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTPS id D61555A026F for ; Thu, 25 Sep 2025 22:30:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1758832202; 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=0SsLfbTIz4f/ZffKDslplKxWv9Xh6vXkbAwMX5dLFnE=; b=I1ZUtLn7bLtsnChVRRSxdt2Q3MKvWhglPHNkjFCEgaYx8Z0wTjO+MBIbtsAzucgLMwRRDD w/flONeO7Cva2D6rP1eJdBhOKh7c8lWGK/HrS2uhFvn7n0NgeBjFWaLNqVxzFtdRFG64sb LPBQogWdteLKklwfdCe6pCtL3sGEWkY= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-17-yxAAHB4APTGiAizKtA3Xug-1; Thu, 25 Sep 2025 16:30:01 -0400 X-MC-Unique: yxAAHB4APTGiAizKtA3Xug-1 X-Mimecast-MFC-AGG-ID: yxAAHB4APTGiAizKtA3Xug_1758832200 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-46e1a2a28f4so7480555e9.2 for ; Thu, 25 Sep 2025 13:30:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758832200; x=1759437000; h=content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=0SsLfbTIz4f/ZffKDslplKxWv9Xh6vXkbAwMX5dLFnE=; b=XV966K2/aswsy1SrBzNeDBQ6vFXTTDbOymUx2ZQJHVjtwwwcW30vfLBhhcKmMu2Gus 1MnWXgYaUN9amDI5zGcEGxl8yf6tGNkLbec62c4zYKPUot9NJvXyc6G/LjPnJtKGjGzF qsMnJngJ97Porzn2jPLxwMjaDI+jNehyhku6iiFIXExq8u4CkEUR9HnnVt54zcU39HiP tWcfAibeGiqhIZEnsOqelL5QvyHoGv5SSVyqnr4cDddTqcezGrOudOr9NGMI3fHcgMXJ tDFFOr/XsPkZzTnrDzgbxF+L0hW0wNb61S4eZkN3Zq4ILfzk+7YRaocn3MX/8Tttl8vx EEwg== X-Gm-Message-State: AOJu0Ywa+SbPYemcj5yOGbOT3hIP04QtQ9GocUh/jh1SuxxV3B5gYgx5 Tf2bFItA+DhUT8nvXjyFj3YGACZ22fxCA/FVLkC7HXWbhxk9UOWVyM9CFYWlDPwYaUfCsUNYVex 70ozYE1B5BHUkVdw3Y7fQE0MXBW3ULd+28zgdoYXpVnyHvhv/PG5LbQ== X-Gm-Gg: ASbGncvHKnNlF6L/9g/RgDj62U86uU6XoSnLXRydIa2oJc/I/KR1d8eG6SE6iwt7Ydr D6YkZT2sndE85JQDW/dZ5Mv4hvv/ztz+awsvrXFet5k+M+vjuR5BqtIfAv85Dqeaj8re2nncWqG m7i8xbO1X0NAMME/nR4baoKX1o6H/K3dn953gEulB6vaQxvN4CJEmF0Sa0V5v242MuTo1DAr9dh qJ724hYDwzoGNQS1X0Fe1v0OV1RSw1jaHuMOlV+G+j8ptJh8WbzwT2Xtw3vMbLfeUVZPmiSjVfe zjQpTA+TvcKfv5EQZztgJc+JJIM4UGRuSOH2wqYxBc12cK0At2kyCQ8LUzb5VG7Z4/hm X-Received: by 2002:a05:600c:1f0d:b0:458:a559:a693 with SMTP id 5b1f17b1804b1-46e329f8ab5mr48594775e9.18.1758832199759; Thu, 25 Sep 2025 13:29:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGpT1Vmp6j8aGaXm5XehJwS8muuk/XXo9FozSsPQXZhT/gCobFUR9LRQwkkV3zl3JFKmTbwDA== X-Received: by 2002:a05:600c:1f0d:b0:458:a559:a693 with SMTP id 5b1f17b1804b1-46e329f8ab5mr48594625e9.18.1758832199260; Thu, 25 Sep 2025 13:29:59 -0700 (PDT) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [176.103.220.4]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-46e2ab6a514sm88662925e9.22.2025.09.25.13.29.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Sep 2025 13:29:58 -0700 (PDT) Date: Thu, 25 Sep 2025 22:29:52 +0200 From: Stefano Brivio To: Yumei Huang Subject: Re: [PATCH v2] tap: Drop frames if no client connected Message-ID: <20250925222952.4ea81b82@elisabeth> In-Reply-To: <20250912081705.20796-1-yuhuang@redhat.com> References: <20250912081705.20796-1-yuhuang@redhat.com> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.49; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: wb_3TGaEg-rie5hFCR-I_6hd-f5XpG8Qfa898Lbnrb8_1758832200 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: 4WGVUBZMEX2AT44V2RIT7AUVVK6PDQJK X-Message-ID-Hash: 4WGVUBZMEX2AT44V2RIT7AUVVK6PDQJK X-MailFrom: sbrivio@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: passt-dev@passt.top, david@gibson.dropbear.id.au, lvivier@redhat.com 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, 12 Sep 2025 16:17:05 +0800 Yumei Huang wrote: > If no client is attached, discard outgoing frames and report them as > sent. Without this we will get an EBADF in either writev() (pasta) or > sendmsg() (passt). That's basically harmless, but a bit ugly. > Explicitly catching this case results in behaviour that's probably a > bit clearer to debug if we hit it. > > There are several different approaches we can take here. Here's some > reasoning as David explained: > > * Don't listen() until the tap connection is ready > > - It's not clear that the host rejecting the connection is better > than the host accepting, then the connection stalling until the > guest is ready. > - Would require substantial rework because we currently listen() as > we parse the command line and don't store the information we'd need > to do it later. > > * Don't accept() until the tap connection is ready > > - To the peer, will behave basically the same as this patch - the > host will complete the TCP handshake, then the connection will stall > until the guest is ready. > - More work to implement, because essentially every sock-side handler > has to check fd_tap and abort early > > * Drop packets in tap_send_frames(), but return 0 > > - To the peer, would behave basically the same > - Would make the TCP code do a bunch of busy work attempting to > resend, probably to no avail > - Handling of errors returned by tap_send_frames() is on the basis > that it's probably a transient fault (buffer full) and we want to > resend very soon. That approach doesn't make sense for a missing > guest. > > Suggested-by: David Gibson > Signed-off-by: Yumei Huang Applied. Sorry for the delay. -- Stefano