From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id C3D416EC56; Thu, 18 Mar 2021 22:37:56 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C3D416EC56 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1616096276; bh=+fJCwe+xq2bsgrqNTwGn+6CoN4i1e9nQb/QFy/0IPgk=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=xlwN+26VzbP4VM98IEnMpLHNbKrxoA30dtkktyY+NAG316G5MYeL4yd6kqgNTYD8g zorsAD4QBOQqI466g+mImzJBAcjIGalr3r3Ja6aYm89vuPzRyw37NbCORguKJLM4mH /aToVZkoZr1V1MEJVeUeGfm1KyQHqN17jfwKjBds= Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id C3C2D6EC56 for ; Thu, 18 Mar 2021 22:37:55 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C3C2D6EC56 Received: by mail-lj1-f177.google.com with SMTP id f16so9044111ljm.1 for ; Thu, 18 Mar 2021 12:37:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Y0KYfzN1nl3EkAFaUyN9kbKpjAxFzpPgNg70Vc0uiUE=; b=I0jf2YtXEM+i3ACIs67atieD0G3sTVrQyygcWaYCoKgxAMsOFMeY8fUyBI+1JYhnaW tEW67XcYsrpIYR217VZTy8czVB8To77jq5oHqo39oC/3b7QvMCQDtYPHovjeVJtHC+Qw gvFtYE9edvyYSUqOWKrsfr9xfpiHoHbg17Zw5kD0zpthVBduK4lgAM2UnlkXglnAHAre 2/VH8+gmzuVqUAjbaC3AxPC+f2eBXGQXT1/57+a/sBHeUjaJKu9F06qOQ6edj1gSR2fs aZePcQQyc4/CdqAFphBBh8Sv840SXh71ADmX8PAv09/w2GoCNh+F0aplN6T0xLxI4qeZ KeIw== X-Gm-Message-State: AOAM533XMjkHTb+0fcw3sACx4q6HFEhT5b8TWsOOwLuLWUDoWCGfVfnw iyXSZMq+O11QTL5dUesJb2XhVj1nhH0= X-Google-Smtp-Source: ABdhPJyOKollf/1/48oEXGkQjLl5+GXv7e75efdxpsyS4jC3Ebf9IGWYcG/H53uQQROxLlRjw310Cg== X-Received: by 2002:a2e:9cc4:: with SMTP id g4mr6383596ljj.34.1616096274620; Thu, 18 Mar 2021 12:37:54 -0700 (PDT) Received: from grain.localdomain ([5.18.171.94]) by smtp.gmail.com with ESMTPSA id t13sm391096ljk.47.2021.03.18.12.37.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Mar 2021 12:37:52 -0700 (PDT) Received: by grain.localdomain (Postfix, from userid 1000) id D3D8F560133; Thu, 18 Mar 2021 22:37:51 +0300 (MSK) Date: Thu, 18 Mar 2021 22:37:51 +0300 To: Vladislav Shpilevoy Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/2.0.5 (2021-01-21) Subject: Re: [Tarantool-patches] [PATCH 1/2] swim: add SO_BROADCAST option X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Cyrill Gorcunov via Tarantool-patches Reply-To: Cyrill Gorcunov Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" On Thu, Mar 18, 2021 at 01:02:03AM +0100, Vladislav Shpilevoy wrote: > Swim node couldn't talk to broadcast network interfaces because > the option SO_BROADCAST wasn't set. > > It worked fine for localhost broadcast, but failed for all the > other IPs. There is no a test, because the tests work for the > localhost only anyway. > > It still fails on Mac though in case the swim node was bound to > 127.0.0.1. Then somewhy sendto() raises EADDRNOTAVAIL on attempt > to broadcast beyond the local machine. Not present on Linux, where > such an error simply can't be returned from sendto(). This error > is ignored on Mac, because it is not critical. > > Part of #5906 > --- > src/lib/swim/swim_io.c | 19 +++++++++++++++++-- > src/lib/swim/swim_transport_udp.c | 23 ++++++++++++++--------- > 2 files changed, 31 insertions(+), 11 deletions(-) > > diff --git a/src/lib/swim/swim_io.c b/src/lib/swim/swim_io.c > index c8558c43e..45df36ba4 100644 > --- a/src/lib/swim/swim_io.c > +++ b/src/lib/swim/swim_io.c > @@ -512,8 +512,23 @@ static inline void > swim_complete_send(struct swim_scheduler *scheduler, struct swim_task *task, > ssize_t size) > { > - if (size < 0) > - diag_log(); > + if (size < 0) { > + bool is_critical = false; > +#if TARGET_OS_DARWIN > + /* > + * On Mac this error happens regularly if SWIM is bound to > + * the localhost and tries to broadcast out of the machine. This > + * is not critical, because will happen in the tests a lot, and > + * in prod it simply should not bind to localhost if there are > + * multiple machines in the cluster. Besides, Mac as a platform > + * is not supposed to be used in prod. > + */ > + struct error *last = diag_last_error(diag_get()); > + is_critical = (last->saved_errno == EADDRNOTAVAIL); > +#endif > + if (is_critical) > + diag_log(); > + } > if (task->complete != NULL) > task->complete(task, scheduler, size); Vlad, I don't understand. For non-mac users this @is_critical will always be false, maybe we better move the whoe branch to TARGET_OS_DARWIN then? Ie if (size < 0) { #if TARGET_OS_DARWIN if (is_critical) diag_log(); #endif } or you made it this way to escape unused parameter compiler warning?