From patchwork Sat Nov 18 01:07:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ihar Hrachyshka X-Patchwork-Id: 1865343 X-Patchwork-Delegate: horms@verge.net.au Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=bz+Qof34; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SXFx55GDBz1yRb for ; Sat, 18 Nov 2023 12:07:21 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 8715561367; Sat, 18 Nov 2023 01:07:18 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 8715561367 Authentication-Results: smtp3.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=bz+Qof34 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 31Q23CW8w2yK; Sat, 18 Nov 2023 01:07:17 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 9928160BEC; Sat, 18 Nov 2023 01:07:16 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 9928160BEC Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 8B8D4C0DD3; Sat, 18 Nov 2023 01:07:15 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 0D7C3C0DD2 for ; Sat, 18 Nov 2023 01:07:15 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id D047060C10 for ; Sat, 18 Nov 2023 01:07:14 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org D047060C10 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NHUgrBjEQbi0 for ; Sat, 18 Nov 2023 01:07:12 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id AE0F360BD4 for ; Sat, 18 Nov 2023 01:07:12 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org AE0F360BD4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700269631; 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=wIAtlRYjuLStpSA8py51CnoY79zYr7C+0qM80WmB9qI=; b=bz+Qof34PAtCHi2nXL4rbnDcmzfd3CpwlAa1RL5CbW1gKKbds2TJrKa7Z3I5N5OBTcL/at WESbZFoqi1dbJP06eShBhVQ9jeC7dkhYRutwvYYHiTVLbzNNI3zFYI8gc4RqT4ehMIFAGi L3JmVX7spRkVkvD1H/0twjGFBZJEp8g= Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-452-vEv9m7ydOdKcZD9PwbjFqA-1; Fri, 17 Nov 2023 20:07:10 -0500 X-MC-Unique: vEv9m7ydOdKcZD9PwbjFqA-1 Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-41cca916954so31234041cf.2 for ; Fri, 17 Nov 2023 17:07:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700269629; x=1700874429; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wIAtlRYjuLStpSA8py51CnoY79zYr7C+0qM80WmB9qI=; b=tm1brYPw8mzUjmj4uC3k2KzrJAzeq2NMqe5SGr/dupg5LDQln/Sv+9nqs8mhFY6dtV cNyoWdOMFZkrLmvBU2QYSgqh5PBjchjVd45+OktvStAbEXfiZEMLc0UwTEIwrRBHQlDq cqGb1JkHPvB6qVAs7IuJY7bQJcV8NO/JeNbmhnhc91pWF6oEGEkNsqydLSEuEufcomWO 7s1U8q5udUjZ/KP1UdmDMnbVGHf1AIm8vQM2CFJgqnt9P4n2VVxmdj8WA262dZgkl4m4 kLuEZjGFGpevGA2TNTWgPulMJ5gXc1xKAAPOfgbEWbyMAqOt63JUdylVMwanr1HT7nmv j5KA== X-Gm-Message-State: AOJu0YzTPVxlkybqjdU4od+Eu+ZWOi/WzOf/8+4ReUqsRlRbj0sIbcl9 LJHHELCr+tbsJ5LePEITW5rJ4UZWJUoVvh73cg1GodLAXtTs3jponw23iH+LpGl+aHmE0igRQ7H yfdJ2cZPhafvdlqLwa1BC/cGcwjYXtcZXsGPJI8LIhmAlvPQv7Z7cI0nXySfpzvBqcU9gJ1ks X-Received: by 2002:a05:622a:13cc:b0:41e:415c:728f with SMTP id p12-20020a05622a13cc00b0041e415c728fmr1531076qtk.38.1700269628847; Fri, 17 Nov 2023 17:07:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IGTUniCTbOGZvprrygGg6kPBXHFRcJ8/GJEgLOD2/1mhQYB6OIlva0EztmCUIg73KeeQULxSA== X-Received: by 2002:a05:622a:13cc:b0:41e:415c:728f with SMTP id p12-20020a05622a13cc00b0041e415c728fmr1531048qtk.38.1700269628280; Fri, 17 Nov 2023 17:07:08 -0800 (PST) Received: from fedora38.localdomain.com (cpe-172-73-180-250.carolina.res.rr.com. [172.73.180.250]) by smtp.gmail.com with ESMTPSA id b3-20020ac86783000000b004196a813639sm965694qtp.17.2023.11.17.17.07.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 17:07:06 -0800 (PST) From: Ihar Hrachyshka To: dev@openvswitch.org Date: Sat, 18 Nov 2023 01:07:00 +0000 Message-ID: <20231118010703.4154866-2-ihrachys@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231118010703.4154866-1-ihrachys@redhat.com> References: <20231118010703.4154866-1-ihrachys@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH v2 1/4] Use listen backlog = 64 for all connections X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Before the patch, the size of the backlog depended on the type of socket (UNIX vs INET) as well as on the language (C vs Python), specifically: - python used backlog size = 10 for all sockets; - C used 64 for UNIX sockets but 10 for INET sockets. This consolidates the values across the board. It effectively bumps the number of simultaneous connections to python unixctl servers to 64. Also for INET C servers too. Signed-off-by: Ihar Hrachyshka --- lib/socket-util.c | 2 +- python/ovs/stream.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/socket-util.c b/lib/socket-util.c index 3eb3a3816..2d89fce85 100644 --- a/lib/socket-util.c +++ b/lib/socket-util.c @@ -760,7 +760,7 @@ inet_open_passive(int style, const char *target, int default_port, } /* Listen. */ - if (style == SOCK_STREAM && listen(fd, 10) < 0) { + if (style == SOCK_STREAM && listen(fd, 64) < 0) { error = sock_errno(); VLOG_ERR("%s: listen: %s", target, sock_strerror(error)); goto error; diff --git a/python/ovs/stream.py b/python/ovs/stream.py index 82fbb0d68..dbb6b2e1f 100644 --- a/python/ovs/stream.py +++ b/python/ovs/stream.py @@ -620,7 +620,7 @@ class PassiveStream(object): raise Exception('Unknown connection string') try: - sock.listen(10) + sock.listen(64) except socket.error as e: vlog.err("%s: listen: %s" % (name, os.strerror(e.error))) sock.close() From patchwork Sat Nov 18 01:07:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ihar Hrachyshka X-Patchwork-Id: 1865344 X-Patchwork-Delegate: horms@verge.net.au Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=bhkWyXIj; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SXFx646Mkz1ySF for ; Sat, 18 Nov 2023 12:07:22 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 0F77A415DC; Sat, 18 Nov 2023 01:07:20 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 0F77A415DC Authentication-Results: smtp2.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=bhkWyXIj X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9s46iC6t9xve; Sat, 18 Nov 2023 01:07:19 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id BEE394157F; Sat, 18 Nov 2023 01:07:17 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org BEE394157F Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 4403EC0DD0; Sat, 18 Nov 2023 01:07:17 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 497C8C0DCE for ; Sat, 18 Nov 2023 01:07:15 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 241B083C68 for ; Sat, 18 Nov 2023 01:07:15 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 241B083C68 Authentication-Results: smtp1.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=bhkWyXIj X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Gm5iEAFnMSRL for ; Sat, 18 Nov 2023 01:07:14 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id 632DA83C64 for ; Sat, 18 Nov 2023 01:07:14 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 632DA83C64 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700269633; 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=F7Ljz/OX0E7i8Sl0hVEJdXXKeGaZC+gf8QOY6eXQdLI=; b=bhkWyXIjRye5Gh1vivqWeqP1viSPTZBzLRWNuzFy16Mhk6UhA1Au0QrYA+NMF/4apMrxex c7alf88BzRwTyaHge/ra31bE5LbbUXvd7qxoGLGDOUIcVf9Wdu4NGHcYLH9LIJTia1mK/Z PzNwrYzNhgQ4ADX1PKkBBDZYsHSIhsQ= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-54-W5BOCGmoPciJiVYtQ04Nxg-1; Fri, 17 Nov 2023 20:07:12 -0500 X-MC-Unique: W5BOCGmoPciJiVYtQ04Nxg-1 Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-41cb577d45aso27512801cf.3 for ; Fri, 17 Nov 2023 17:07:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700269631; x=1700874431; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=F7Ljz/OX0E7i8Sl0hVEJdXXKeGaZC+gf8QOY6eXQdLI=; b=lGUGHG+fqrOjOIYdBAvv22nnqAqoCGhBvU7kXXlhflcT5UMe1Q1oiMGrn+aU8mbAvD PQgVMmviMJxUCTRdLjk+mqeGXJqz9YklYfbch0Tizn8G4idM95SEwCSLwiC233siXm8u 3OS2iVFLaPX1nxWg21vo6Gr7VRno6uU5P+le6Sm7EfHjB4Uopm8cEyNWLRsds/ixvHCV +hATGZT5on70BMQYdJqhAXtjpG666cva0JJCVSk7hvNppZZcgXXpu8pTLrbo2D0S2nID dfR98AOLbKbdcyeatkmboBYjdoISImtg4Zi55PiFd/2kNuS/TGQlMFS2l5wkpd2dqUPL H4cA== X-Gm-Message-State: AOJu0YzFuGm33OXzEustrHttcpqlWkzfKroT8yNFnniDrwQZb6qxpCNe x1IMe0f+iQhTnwADGj6whV8xu+mNa5w34xhOwpSuSJq2ewQNeWsTAlNCrZmQknqrli5h2UkejYD hT7iBMeD9dH0L1eUGzNwZP9uibRAdlgQhMhvN3/wXrROdeS5MW4jLBhrXVAt9NDzffazkiVxO X-Received: by 2002:ac8:5dcf:0:b0:419:6391:6bef with SMTP id e15-20020ac85dcf000000b0041963916befmr1551325qtx.0.1700269630975; Fri, 17 Nov 2023 17:07:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IHrGe06yXuEClG6VEXuTwQdLjtNYDLubo0DEz0KwX9bNnDoc4bRtbpdrDZ8y7SL4QRbRN8oYg== X-Received: by 2002:ac8:5dcf:0:b0:419:6391:6bef with SMTP id e15-20020ac85dcf000000b0041963916befmr1551306qtx.0.1700269630680; Fri, 17 Nov 2023 17:07:10 -0800 (PST) Received: from fedora38.localdomain.com (cpe-172-73-180-250.carolina.res.rr.com. [172.73.180.250]) by smtp.gmail.com with ESMTPSA id b3-20020ac86783000000b004196a813639sm965694qtp.17.2023.11.17.17.07.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 17:07:08 -0800 (PST) From: Ihar Hrachyshka To: dev@openvswitch.org Date: Sat, 18 Nov 2023 01:07:01 +0000 Message-ID: <20231118010703.4154866-3-ihrachys@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231118010703.4154866-1-ihrachys@redhat.com> References: <20231118010703.4154866-1-ihrachys@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH v2 2/4] Don't convert EAGAIN to EPROTO for unix sockets X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Unix sockets also have listener backlog. Returning EAGAIN is valid to allow the caller handle the non-blocking temporary failure to connect() gracefully. Signed-off-by: Ihar Hrachyshka --- lib/socket-util-unix.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/socket-util-unix.c b/lib/socket-util-unix.c index 59f63fcce..0053a61b1 100644 --- a/lib/socket-util-unix.c +++ b/lib/socket-util-unix.c @@ -376,9 +376,6 @@ make_unix_socket(int style, bool nonblock, return fd; error: - if (error == EAGAIN) { - error = EPROTO; - } if (bind_path) { fatal_signal_unlink_file_now(bind_path); } From patchwork Sat Nov 18 01:07:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ihar Hrachyshka X-Patchwork-Id: 1865345 X-Patchwork-Delegate: horms@verge.net.au Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Rub91oaC; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SXFx86tqVz1yRb for ; Sat, 18 Nov 2023 12:07:24 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 2A64C60FCD; Sat, 18 Nov 2023 01:07:22 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 2A64C60FCD Authentication-Results: smtp3.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Rub91oaC X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sUDKSAwDQh9G; Sat, 18 Nov 2023 01:07:20 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id 549BA61381; Sat, 18 Nov 2023 01:07:19 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 549BA61381 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id CFE9AC0DCE; Sat, 18 Nov 2023 01:07:18 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 1BA73C0DDA for ; Sat, 18 Nov 2023 01:07:18 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id DAD33415DC for ; Sat, 18 Nov 2023 01:07:17 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org DAD33415DC Authentication-Results: smtp2.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Rub91oaC X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BvSp-0Jlz-bY for ; Sat, 18 Nov 2023 01:07:17 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id A851E415B5 for ; Sat, 18 Nov 2023 01:07:16 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org A851E415B5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700269635; 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=WKXCPi55QxZ9aMPTDGYcFkLvmbnFMaMOSfPxaLa9T28=; b=Rub91oaCPCZeIrdfX16CWxQjTpzCc/M/q2pE7mT58lKZ0/cgKhfxwRF+pD4XA1SyuzVm27 1wH8B3CaDNYfUnSXFCTf5iba9fND8Oe4bkN+u4xz1d1fBlX/c/rOshz38DY2Q8DRjYPXrH YxUEd/h3d93P3bbMesl/NHMfVFPBUhI= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-685-WnOJkxq2NKaeS8PlTtk-cw-1; Fri, 17 Nov 2023 20:07:14 -0500 X-MC-Unique: WnOJkxq2NKaeS8PlTtk-cw-1 Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-421b4bc2a80so31147791cf.3 for ; Fri, 17 Nov 2023 17:07:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700269633; x=1700874433; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WKXCPi55QxZ9aMPTDGYcFkLvmbnFMaMOSfPxaLa9T28=; b=em1A943tyas/BYXZp/sFG18iiWO0bKJDyaeNsLqAVaYstwu0vELlQQ0/rfttjU8hEZ IFTQPezpQPnNWItIHnO0uXZDAAxm18eP3/APlojqETNCjCFHuEYkli4W9wmpS/PDALat eaHLucGQp+RfPsmfBtKQU9zGoOpVyPNtrmqqOxflGiFpe9zKxIbANvPaJjIx0CYuQpp+ /VaBOifHnY9MIM7yrcsB9bBiTZfh7gxE9EPwwC/fI5dTpHd4DyGF++r3qfb4FIdTGWz1 4TkEbbnlSmqauGWIetszVBP1lVW6mYXpUY018em0ZM4n0GDwlcfGsZViQMDTyBWqggQe F5og== X-Gm-Message-State: AOJu0Yx9vygJQe9faugBwJbxItLSem8Nm9eWTGGOZh4V3S8YwVZme/aZ cifiIIIPGbiwoyucMALaW94K7dj93qhQFUz/g68XsA6PZjGQFW9sQfeRbyLJ+G6ONxaJ9HvBvOc nwKggqjiOR/kNeljHCdpsRgaku6ljpenM1wZKHD1eD+b3KIF2kC2dSJP5WUQSaX3Jecz2XAIm X-Received: by 2002:a05:622a:148e:b0:41e:37cf:8661 with SMTP id t14-20020a05622a148e00b0041e37cf8661mr1743545qtx.12.1700269633252; Fri, 17 Nov 2023 17:07:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IFHfthONSzL546Lk0KfGFKEpm5IhvI8lIJYfbW1/OosdMLrWYhsCDNIDOAsII6gUvWcpEblUQ== X-Received: by 2002:a05:622a:148e:b0:41e:37cf:8661 with SMTP id t14-20020a05622a148e00b0041e37cf8661mr1743517qtx.12.1700269632860; Fri, 17 Nov 2023 17:07:12 -0800 (PST) Received: from fedora38.localdomain.com (cpe-172-73-180-250.carolina.res.rr.com. [172.73.180.250]) by smtp.gmail.com with ESMTPSA id b3-20020ac86783000000b004196a813639sm965694qtp.17.2023.11.17.17.07.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 17:07:11 -0800 (PST) From: Ihar Hrachyshka To: dev@openvswitch.org Date: Sat, 18 Nov 2023 01:07:02 +0000 Message-ID: <20231118010703.4154866-4-ihrachys@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231118010703.4154866-1-ihrachys@redhat.com> References: <20231118010703.4154866-1-ihrachys@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH v2 3/4] Loop to connect unix socket until success X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" In nonblocking mode, a POSIX socket may temporarily fail to connect(), which is indicated by returning EINPROGRESS. This patch will loop waiting for connect() to succeed, or until EINPROGRESS happens. An alternative - and probably a better - path to deal with this error would be to extend unix stream_class to support connect API, that would allow the caller to repeat connect() attempts asynchronously. Signed-off-by: Ihar Hrachyshka --- lib/socket-util-unix.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/socket-util-unix.c b/lib/socket-util-unix.c index 0053a61b1..230705ba3 100644 --- a/lib/socket-util-unix.c +++ b/lib/socket-util-unix.c @@ -361,10 +361,16 @@ make_unix_socket(int style, bool nonblock, int dirfd; error = make_sockaddr_un(connect_path, &un, &un_len, &dirfd, linkname); - if (!error - && connect(fd, (struct sockaddr*) &un, un_len) - && errno != EINPROGRESS) { - error = errno; + if (!error) { + for (;;) { + if (!connect(fd, (struct sockaddr *)&un, un_len)) { + break; + } + if (errno != EINPROGRESS) { + error = errno; + break; + } + } } free_sockaddr_un(dirfd, linkname); From patchwork Sat Nov 18 01:07:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ihar Hrachyshka X-Patchwork-Id: 1865346 X-Patchwork-Delegate: horms@verge.net.au Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=jV7w+Cki; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SXFxB1ZbSz1yRb for ; Sat, 18 Nov 2023 12:07:26 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id EB7EE42D4F; Sat, 18 Nov 2023 01:07:23 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org EB7EE42D4F Authentication-Results: smtp4.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=jV7w+Cki X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id J5TTtDqTecGR; Sat, 18 Nov 2023 01:07:23 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id A218E42CAD; Sat, 18 Nov 2023 01:07:21 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org A218E42CAD Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 77DDFC0DCE; Sat, 18 Nov 2023 01:07:21 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 4E539C0DCF for ; Sat, 18 Nov 2023 01:07:20 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 6BF0561383 for ; Sat, 18 Nov 2023 01:07:19 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 6BF0561383 Authentication-Results: smtp3.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=jV7w+Cki X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xztjjpHZWReA for ; Sat, 18 Nov 2023 01:07:18 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id 7448B61341 for ; Sat, 18 Nov 2023 01:07:18 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 7448B61341 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700269637; 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=3/stcMrrwCm8d+Bvf/eJzYForIMTSSfqmjkcl+wSRcU=; b=jV7w+CkiiFNHKDFnj3fJ2pVuSG9xSJ7+z865jEu7JZIrQf4spsVMleEZe5NXjBvGCvU3A3 efokSyTcOOG7ukcq2XZGu6T63UQLy6Ww/nCodWdP6oWCvJ99uDdBv7zRJWnHmWJMV2f9Tq oTuTsUGFOqJobSX41yMNJlf34qL7lQA= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-186-uoV6HnY9MRi_IgUzaNjyRg-1; Fri, 17 Nov 2023 20:07:16 -0500 X-MC-Unique: uoV6HnY9MRi_IgUzaNjyRg-1 Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-41cbb2970f4so31734881cf.2 for ; Fri, 17 Nov 2023 17:07:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700269635; x=1700874435; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3/stcMrrwCm8d+Bvf/eJzYForIMTSSfqmjkcl+wSRcU=; b=TqIpo1wKLdNQPUmzGGnDnEoAxkvns0t++2pRlW7RYZlUVoBxpz6lDLoYCUyTUgZvYN hBwttoAtqQ0RgyYIAbZIN/63M0o5mjxjX1VcRGJCtrB9DxnDJv2aVU9G4pJGTvgwhnCq hqc5CindDlkRdPg7HNzu3X0pWGD1bMgEu4tb0KFJ/8xn/y0OBch2viSv0xtWu1jZpVpc 3l/6ucAKiAS2CV8rBhqCGe/ROFW0h1v8DNsgHZdIHBNr+bYneJ2NKatf6IN0Ay2I3Dhl 453j7nboqRwFyFoZwlXUMDcmxPeGjNP2X5NP0eK6Bw6Buj3myDQR6g24jjzD1Bb34HhL NWdg== X-Gm-Message-State: AOJu0YwP47la3nmmeXEzGzBLqv8ZaJmeLspG/WJ4a/U1Hd6o3wYK2UMy H5EtsL6kBL8uRVoP6v32noGQ+2UJYrC1BsWwYeH2oh4qiWeaXProZ4xL/P0xbvjNNvbCcuR+GAc cclv08E5imtOe3rlSbMJK3ZXAVkqAwpHrr3+JB3idevHr3wdLO6yGzaMZbf9LPTjuZaSWI1CF X-Received: by 2002:ac8:7f89:0:b0:417:c16a:c2c9 with SMTP id z9-20020ac87f89000000b00417c16ac2c9mr1937489qtj.62.1700269635407; Fri, 17 Nov 2023 17:07:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IGpoWz4d57NYX1FcDavgaIIRNpsBnqgAOPFKqZwTB5kEZ5sVmqmnNGm8n963h01s/DCweRKuA== X-Received: by 2002:ac8:7f89:0:b0:417:c16a:c2c9 with SMTP id z9-20020ac87f89000000b00417c16ac2c9mr1937469qtj.62.1700269635047; Fri, 17 Nov 2023 17:07:15 -0800 (PST) Received: from fedora38.localdomain.com (cpe-172-73-180-250.carolina.res.rr.com. [172.73.180.250]) by smtp.gmail.com with ESMTPSA id b3-20020ac86783000000b004196a813639sm965694qtp.17.2023.11.17.17.07.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 17:07:13 -0800 (PST) From: Ihar Hrachyshka To: dev@openvswitch.org Date: Sat, 18 Nov 2023 01:07:03 +0000 Message-ID: <20231118010703.4154866-5-ihrachys@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231118010703.4154866-1-ihrachys@redhat.com> References: <20231118010703.4154866-1-ihrachys@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH v2 4/4] Handle EAGAIN on unix socket connect() failure X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" While POSIX document EINPROGRESS, Linux connect() system call returns EAGAIN for nonblocking Unix sockets instead. This patch handles this case by repeating connect() attempts. Signed-off-by: Ihar Hrachyshka --- lib/socket-util-unix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/socket-util-unix.c b/lib/socket-util-unix.c index 230705ba3..44ec16bce 100644 --- a/lib/socket-util-unix.c +++ b/lib/socket-util-unix.c @@ -366,7 +366,7 @@ make_unix_socket(int style, bool nonblock, if (!connect(fd, (struct sockaddr *)&un, un_len)) { break; } - if (errno != EINPROGRESS) { + if (errno != EAGAIN && errno != EINPROGRESS) { error = errno; break; }