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=R9qhOaHQ; 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 835B05A026D for ; Wed, 25 Mar 2026 01:56:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1774400204; 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=5FNcznN/zwmzR2pulo8HcP7THt8SwH+/h6JGiLVJ5Eo=; b=R9qhOaHQe5Pl4fKkl92f/mtJG0YFKQYADIu31REgCKuzBdxELKzosa4m1QSes+0qSKRWul Rc2LIHDdueCneAD2TLF+vdveTS/FDKm9y8TwLBP3JSZwMzQSO9vmsNtLsrk9wKy/5G1VGr u/LeNArQ3nw88bmzSgVjdLIsHdqj5VA= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-13-qNUSvN2dPUaqdFXl72Bt-g-1; Tue, 24 Mar 2026 20:56:42 -0400 X-MC-Unique: qNUSvN2dPUaqdFXl72Bt-g-1 X-Mimecast-MFC-AGG-ID: qNUSvN2dPUaqdFXl72Bt-g_1774400201 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-439b8bc43aeso4645060f8f.1 for ; Tue, 24 Mar 2026 17:56:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774400201; x=1775005001; 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=5FNcznN/zwmzR2pulo8HcP7THt8SwH+/h6JGiLVJ5Eo=; b=bjIHv4sfyKR9+EJkw2FkOA/8RJiqzM1gEz0q49WGQm9v+9pzW3KQoXYY9grpd+poGm RNMAxV3nFfWNNtrOLzBKgKWZlDitIhzO1xTGKnnTWTdFMecdPLwCVChLqKPASOasI0uG 9MPJJ9ivIRzAd/zMzLPR/C80XMJvF6qbtfwkE40LaioFz5H4fd4olowVLceaqzdoPBMa +IuSiHz/kYSKZpm019SMd3zGVT+ZnKGgybedLuwtoOUiv9tsV1/veNIZ+Sal50eKBDEB VuMczQeWkblFMe705iy5vBMuccFKLb2VYM12uSvV9o/Sh5agjTi2R9CiaOcey5E+tsEE ws0A== X-Gm-Message-State: AOJu0YyH6FgU4H1U393c8WB6XoN84AwhGGJSXBUIUAyzvlydQAp62WFr /vNUHjZdhGJxSOztZV5/yN6QYAwqDYry20nSQgqGKYE9P2g7b7pXij/u86ZB7Yrij9AoIhHJeB5 kmNOOY/U6++Tb/wuC5xBhu8pQI9tBSxusb2ysKIYfcJViAkZnX4felp8NCdkuITLE X-Gm-Gg: ATEYQzxYYhyAhT6DddrlwlhZwAWUlzT9f5qoFAOmP2vhu7uX01uBfItqlzm69G3GQ+X IGM4za9y55OTDkcLKC8gp/9xRFl6h7ZST51LmxUvcJoSDYm8sR3x9RKwzHn7nYsVJEzGEJL/O/F gBcMRoyNmAa/5DQvj/PBm0yU2+RYckLZIO/+CIJmI+Njy2TZFy47qRM33l1n0I+mzzn8Sez2SA2 Nk6a8ySbyuvw7IF73oD3CixNg5pHNAybPCtghJcgw0yeQEvDKfup+ArenHNfQNwvLyi77n+R5Zh OlhmkYEra597IBNaEae8xb7WwrJO6kGbUQU5gPQvBZOD4TEoePiuEJizXApJWQda6uiDKqo6RC9 bsuAn0tGhWtv24ksVvfhx//B6MnChI0wkWm5QWjXCqI21Q/Yslw== X-Received: by 2002:a05:6000:2c03:b0:43b:493c:884b with SMTP id ffacd0b85a97d-43b889c4c92mr2034564f8f.12.1774400200828; Tue, 24 Mar 2026 17:56:40 -0700 (PDT) X-Received: by 2002:a05:6000:2c03:b0:43b:493c:884b with SMTP id ffacd0b85a97d-43b889c4c92mr2034533f8f.12.1774400200291; Tue, 24 Mar 2026 17:56:40 -0700 (PDT) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [176.103.220.4]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43b644ae37dsm43981035f8f.2.2026.03.24.17.56.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2026 17:56:39 -0700 (PDT) From: Stefano Brivio To: David Gibson Subject: Re: [PATCH v3 21/25] pesto: Read current ruleset from passt/pasta and display it Message-ID: <20260325015638.0760a30d@elisabeth> In-Reply-To: <20260323073732.3158468-22-david@gibson.dropbear.id.au> References: <20260323073732.3158468-1-david@gibson.dropbear.id.au> <20260323073732.3158468-22-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: Wed, 25 Mar 2026 01:56:39 +0100 (CET) X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: qgQidMWOKQOxQloQ1HFvVJo8QgooYiZ6xlXQTTa_uaw_1774400201 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: 2GKRWVNRHM5ZMRAKGYQ57MBP5BWAN6VP X-Message-ID-Hash: 2GKRWVNRHM5ZMRAKGYQ57MBP5BWAN6VP 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 Mon, 23 Mar 2026 18:37:28 +1100 David Gibson wrote: > Implement serialisation of our current forwarding rules in conf.c, > deserialising it to display in the pesto client. > > Signed-off-by: David Gibson > --- > conf.c | 44 +++++++++++++++++++++++++++++++ > fwd_rule.c | 40 ++++++++++++++++++++++++++++ > fwd_rule.h | 3 +++ > pesto.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++--- > 4 files changed, 160 insertions(+), 4 deletions(-) > > diff --git a/conf.c b/conf.c > index b878db94..7f311914 100644 > --- a/conf.c > +++ b/conf.c > @@ -2338,6 +2338,47 @@ static int conf_send_pifs(const struct ctx *c, int fd) > return 0; > } > > +/** > + * conf_send_rules() - Send current forwarding rules to dynamic update client (pesto) What about: * conf_send_rules() - Send forwarding rules to configuration client (pesto) ? > + * @c: Execution context > + * @fd: Socket to the client > + * > + * Return: 0 on success, -1 on failure > + */ > +static int conf_send_rules(const struct ctx *c, int fd) > +{ > + unsigned pif; > + > + for (pif = 0; pif < PIF_NUM_TYPES; pif++) { > + const struct fwd_table *fwd = c->fwd[pif]; > + unsigned i; > + > + if (!fwd) > + continue; > + > + assert(pif); > + > + /* PIF id */ > + if (write_u8(fd, pif)) > + return -1; > + > + /* Number of rules */ > + if (write_u32(fd, fwd->count)) > + return -1; > + > + for (i = 0; i < fwd->count; i++) { > + if (fwd_rule_write(fd, &fwd->rules[i].rule)) > + return -1; > + } > + } > + > + /* Write 0 PIF id to finish */ > + if (write_u8(fd, 0)) We have PIF_NONE, shouldn't we use that to make it obvious that it's an invalid value? > + return -1; > + > + return 0; > +} > > [...] I stopped reviewing here, the next patches in my series are anyway mine and after those I guess it doesn't make sense, yet, that I review in fine detail, as we'll probably need to change a bunch of things. -- Stefano