From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=none 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=LnL3XMC8; 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 ESMTP id 2FB265A004C for ; Tue, 26 Nov 2024 05:48:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732596490; 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=k6nD4RBn88BRd+9hx/IMqn0sjI+LaX8oWbK7rYGAQTY=; b=LnL3XMC89pkB79VI7NNwjYxGt0JtA4kxIEtNvEAFeflb8eLKxGJFoLAiW4RJyWrGpKb6UP QVbYG0+9cxFBi3s3Jh8BNTzD/QtUkHz6PgGMZ1qAcFrvo+mKJ2tA++9z5p72yh0ziKOlqo kyrQM3mq3eyZbZyCYHWClckx9Xf1Mu8= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-572--rGkSmItPbGrJSRsEnMDjQ-1; Mon, 25 Nov 2024 23:48:08 -0500 X-MC-Unique: -rGkSmItPbGrJSRsEnMDjQ-1 X-Mimecast-MFC-AGG-ID: -rGkSmItPbGrJSRsEnMDjQ Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4349eeeb841so13148725e9.3 for ; Mon, 25 Nov 2024 20:48:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732596486; x=1733201286; 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=k6nD4RBn88BRd+9hx/IMqn0sjI+LaX8oWbK7rYGAQTY=; b=SAUDpJfIN7sxNZ6/sDXneH3sY/scUpycqAB9705ITwBXfM+Pe2iwZGQpgdGQd9LTz/ KF5DDBLDpuvbWvXTn+X1vzzt9XcIszKd/BG7pQ0DJTbpSsn1lG+D3PASFCavuvnYTSTn BbiRhIJWCAf5q+gtmHjnyk53mQJdeVzpFGMrPjfqv0nTio97OTC0Ynwxwxp1R0Hmj4Px Yd4DprPiWwOMS8gMaOQkFAet4TdAfqjVha30MFEUyaEzgj7GV84HE3KRjWoEgdDiJIQo LtWuHgjg6vRR/kTxAVt7+gXEbJLmuIswRNLTbqe/uCvteV1bNXh+Q4Z0V0VTly7r/dHT Qkqw== X-Gm-Message-State: AOJu0YwUStN301t5HEU37xqTeHfOgyRNYMFzFji0wOLf31OcAqM+AX1w G1sBbq+eYwn1j4uHZVQPLG3hw6vzQPazOBI2TdDko8GFuES9mfEsQ1KUKRLczEyu4BwDMPDSLzl 18Up1BDtD4kxh5bH2AnqJshiXrLPmkh+SxpKOSttHP+qo+aBPR7Q60M+cvw== X-Gm-Gg: ASbGnctxrCjZp4YPD2JyV8IdYfw1KuovD7tkDOiiriMToaQs38Eq+xoGxEphYZmtKZ9 26YXwdrhl3qcyKgZM8Ju8bjRVte+nUjmmxi73lzH7Ni714S9CsOM+0Thz8mK0DP5oV7R/0+P27N NKub/LrbsA2dLs1/PzZ9t0P02tVR20UlBM+SLiUL7RJP92nGNn98yELR0NIx3VmvSMNSgyMoe+Z 6ZBu9qLz4PXFXabKQZTJYBdLdxJjDm9NLWiPDGz8KRLJiYM9ewBa3zItZuKTqnHyOBPBlLNVw6W wXU= X-Received: by 2002:a05:600c:c0d:b0:434:a7b6:10e9 with SMTP id 5b1f17b1804b1-434a7b613femr1128665e9.17.1732596486606; Mon, 25 Nov 2024 20:48:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IEXRppOD2c9/oq2VxRmoe6GKJ7duLjpJXVTW3HIqNvNegyoeo/kpAA14QYkGcpobFDqtB9lxg== X-Received: by 2002:a05:600c:c0d:b0:434:a7b6:10e9 with SMTP id 5b1f17b1804b1-434a7b613femr1128505e9.17.1732596486332; Mon, 25 Nov 2024 20:48:06 -0800 (PST) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [176.103.220.4]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434a10208c2sm42216345e9.12.2024.11.25.20.48.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Nov 2024 20:48:04 -0800 (PST) Date: Tue, 26 Nov 2024 05:48:03 +0100 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH] ndp: Don't send first periodic router advertisement right after guest connects Message-ID: <20241126054803.33a7999a@elisabeth> In-Reply-To: References: <20241125080905.118341-1-sbrivio@redhat.com> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: LwOMhgwd_KzA-izdsRuofq6ThKYD5JZQO---pZD2Wgs_1732596487 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: SNG5P2QUKOB6IQTDTRRKJFGAGVCX7BKM X-Message-ID-Hash: SNG5P2QUKOB6IQTDTRRKJFGAGVCX7BKM 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 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 Tue, 26 Nov 2024 15:22:38 +1100 David Gibson wrote: > On Mon, Nov 25, 2024 at 09:09:05AM +0100, Stefano Brivio wrote: > > > > [...] > > > > @@ -420,9 +420,13 @@ void ndp_timer(const struct ctx *c, const struct timespec *now) > > interval = min_rtr_adv_interval + > > random() % (max_rtr_adv_interval - min_rtr_adv_interval); > > > > + if (!next_ra) > > + goto first; > > I don't think avoiding re-indenting two lines is sufficient reason to > introduce yet another goto, though.. > > > + > > info("NDP: sending unsolicited RA, next in %llds", (long long)interval); > > > > ndp_ra(c, &in6addr_ll_all_nodes); > > > > +first: > > next_ra = now->tv_sec + interval; > > } At the cost of one additional line (and zero non-blank lines): -- $ git diff --patch --stat ndp.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/ndp.c b/ndp.c index 37bf7a3..d1ba867 100644 --- a/ndp.c +++ b/ndp.c @@ -420,13 +420,12 @@ void ndp_timer(const struct ctx *c, const struct timespec *now) interval = min_rtr_adv_interval + random() % (max_rtr_adv_interval - min_rtr_adv_interval); - if (!next_ra) - goto first; + if (next_ra) { + info("NDP: sending unsolicited RA, next in %llds", + (long long)interval); - info("NDP: sending unsolicited RA, next in %llds", (long long)interval); - - ndp_ra(c, &in6addr_ll_all_nodes); + ndp_ra(c, &in6addr_ll_all_nodes); + } -first: next_ra = now->tv_sec + interval; } -- we get: - clarity about the fact that 'next_ra' happens to be 0 on the *first* run (the label says it) - clarity about the fact that it's a special case (it's a goto) - no wrapped lines -- Stefano