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=I54kdMgg; 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 0C7CA5A0265 for ; Tue, 10 Mar 2026 20:33:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773171197; 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=RxvSQgziKqJpBfYld+pBDE4rUwrKfmcjSEFL92GGzkE=; b=I54kdMggAv7xnDqY2N3jsCajh7w/p6yuU+PL/QzAxYwgap+AtDHHdGAXxWgoHT6Wv6jWu1 iaz3BlunUjbJqlljmxWp0QFdUIEVJpFDN/966DCD7o2ELcGio8csgxFk9T7zjIMoQ32zad jB5gzQb+pjoyLOtmmAcCGf8HjdLcbfY= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-19-z3U9Mq-NM7ymkTfezgEIyg-1; Tue, 10 Mar 2026 15:33:15 -0400 X-MC-Unique: z3U9Mq-NM7ymkTfezgEIyg-1 X-Mimecast-MFC-AGG-ID: z3U9Mq-NM7ymkTfezgEIyg_1773171194 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4852fbfc379so39310305e9.0 for ; Tue, 10 Mar 2026 12:33:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773171194; x=1773775994; h=date:content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=RxvSQgziKqJpBfYld+pBDE4rUwrKfmcjSEFL92GGzkE=; b=guWtEiiWx6+cBH4o/9OKMbcxdrH+5HDWLkJ2Pn8Igo9F/cY7gVUYYt5t3jPA2vv6tA qmMkUDVN4lu5M/LKEab51YBA0gMP8AvaHAtH/I3lPSquj9Nhkp3vDZ3u3XcTu0oeJL4x F2SSlW55/RluVoF91pPNRjATUBzQ4cAScLc37HHGT3Or1djzGdMofTCTxwenu4wGeDAj lQ3nDUAKrmlFmqEt7x68Uh2O/XBSMs84TBhkCO6C2ud6269W3MSQ/0RYTKPlmP4ll3vR rclvuYgMvUTeuhDjdJNpSCGRbUhxpj8AVkxOmx/jp7XqiEfXS6zTVQFXFdAhot2/Z8Ea xPNQ== X-Gm-Message-State: AOJu0YzSM4xPFhzDGgRU/kjwxVxtP/DGR/712XQ8Muupii/Sk0PODdBO oM8EC/ja/73okPQxv8TxtEqfCrVP060TobzgzDKqdNNJRlA52fhQVObsqbzMXwzZqvxZYVsQHf5 O6yyMXqsSl2Ea7U5hOaXpPYW1ByUjLiLO0e6zdYrfdThKiFrDiKTLnUFsScVe56NZ X-Gm-Gg: ATEYQzxZFHN7c33GJ5GWyt2yh2TH0meLlFN0AMp8E1F/PtldKlxtcapU/ZGxxp6sG4y d4ZSGjVb3txS6ChYw3ZR++euh2hdVAl5LRR38NzaHnzu4MzmXVSimfBrFzJ1fq5XxhXvXn9N0rJ MMi/NrPFUlsvBzOp7eBRWebk3BCJWpiqCvYE344YA8tJaKgD/hKQGiIVneB+5Fo7GaJOiClXuE3 WgP0w3Q9pzH9yPM9fvbMnwjPc+EWBWYrrruIkJSfltQcB0n6qTNnRJ6WGsJbtInynrMKGycLSO+ O94ZvE9KRSLLWBlIAMCuihGvJPnttwKsLGJFILCmQfas5d4Q57+EsyYsU+48lMlLG7Mud/fnLWY 8jm5UV29/5/zenn03JLguM0DWW33P736KRUKI3fYAt3UuN6MM9A== X-Received: by 2002:a05:600c:c8f:b0:483:703e:4ad9 with SMTP id 5b1f17b1804b1-4852695b63emr281220255e9.19.1773171193971; Tue, 10 Mar 2026 12:33:13 -0700 (PDT) X-Received: by 2002:a05:600c:c8f:b0:483:703e:4ad9 with SMTP id 5b1f17b1804b1-4852695b63emr281219205e9.19.1773171193022; Tue, 10 Mar 2026 12:33:13 -0700 (PDT) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [176.103.220.4]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-439f818d37fsm366225f8f.6.2026.03.10.12.33.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Mar 2026 12:33:12 -0700 (PDT) From: Stefano Brivio To: David Gibson Subject: Re: [PATCH 1/6] conf, fwd: Make overall forwarding mode local to conf path Message-ID: <20260310203307.732079b9@elisabeth> In-Reply-To: <20260310041605.1322552-2-david@gibson.dropbear.id.au> References: <20260310041605.1322552-1-david@gibson.dropbear.id.au> <20260310041605.1322552-2-david@gibson.dropbear.id.au> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.49; x86_64-pc-linux-gnu) MIME-Version: 1.0 Date: Tue, 10 Mar 2026 20:33:11 +0100 (CET) X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: ZNIWGHCphee2JVrZ7byEfSyJQAF2RBGFawN9SNQ03Aw_1773171194 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: 6P57IFKX62QZBQMHDOTEPBLE5HCLNN4T X-Message-ID-Hash: 6P57IFKX62QZBQMHDOTEPBLE5HCLNN4T 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, 10 Mar 2026 15:16:00 +1100 David Gibson wrote: > The 'mode' field of struct fwd_ports records the overall forwarding mode. > Now that runtime forwarding decisions are made based on the forwarding > table, this is almost unused outside conf(). > > The only exception is the auto-port scanning code, which uses it to > determine if a port scan is necessary. We can instead derive that from the > forwarding table itself by checking if there are any entries with the > FWD_SCAN flag. > > Once that's done, make the mode purely local to conf(). While we're there > rename the constants to FWD_MODE_* to avoid confusion with the forwarding > rule flag bits, which are also prefixed with FWD_. > > Signed-off-by: David Gibson > --- > conf.c | 82 ++++++++++++++++++++++++++++++++++++---------------------- > fwd.c | 27 ++++++++++++++----- > fwd.h | 10 ------- > 3 files changed, 72 insertions(+), 47 deletions(-) > > diff --git a/conf.c b/conf.c > index 11d84536..c436b88e 100644 > --- a/conf.c > +++ b/conf.c > @@ -199,15 +199,27 @@ static void conf_ports_range_except(const struct ctx *c, char optname, > } > } > > +/** > + * enum fwd_mode - Overall forwarding mode for a direction and protocol > + */ Nit: I'm actually trying to document enums in the matching kerneldoc style when it comes to it, see for example enum udp_iov_idx. I don't think it's so much of a problem to omit it here, even though "SPEC" and "ALL" might not be that obvious. If you respin, maybe: * @FWD_MODE_UNSET Initial value, not parsed/configured yet * @FWD_MODE_SPEC Forward specified ports * @FWD_MODE_NONE No forwarded ports * @FWD_MODE_AUTO Automatic detection and forwarding based on bound ports * @FWD_MODE_ALL Bind all free ports ? -- Stefano