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=UEDtJU7U; 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 410EA5A0271 for ; Sat, 25 Apr 2026 11:36:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1777109770; 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=wirKxCnOjdjuujrMDSgcEuAvemX40kZ7AQZMxUNotCw=; b=UEDtJU7USstjTrbNz7pxg7L7tS676QSkOwGk8Cf5gR1l6iZ0tPbSTKpAJQ2rE7ZVYQUi62 IM9gXO10f0CmifjcbBpKd9RC0ZsuCRXONWCEBpzYCTkwL9NT4Jk54j1O7pH/pUJf+C0OJ/ TbEZ9boDSUbWv6xBNZR4ixfM18h+j10= 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-235-7uUSCUX5MwWJISM_RNyOdw-1; Sat, 25 Apr 2026 05:36:08 -0400 X-MC-Unique: 7uUSCUX5MwWJISM_RNyOdw-1 X-Mimecast-MFC-AGG-ID: 7uUSCUX5MwWJISM_RNyOdw_1777109767 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-488c2aa6becso78200215e9.2 for ; Sat, 25 Apr 2026 02:36:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777109767; x=1777714567; 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=wirKxCnOjdjuujrMDSgcEuAvemX40kZ7AQZMxUNotCw=; b=rhXzFZK+p0u2B5GxRBrdEVE9eN2sRbvvXO/5mgR3YOnJkpzH+CMyDbq5rHg8HvO4wM QXJCCDOEfWo/5osLb7atVDqlvMiNTumE5L9aGWJGO9bD3dcBvDApQjQqXb1OVxnEGm0D PRNlDwunGjd9SYQhMv39K77riHyL+VjXySTZPGkpKJGlEkGsb2GZSQxz6hEK6Y+KgFbE 16X757WXYoUt4BWIWTeXpgKkZhDtDfW7+GWaRQAOogO5nR13+DKgvK2JkG8LuoQ9e0u4 1f4oq5cYq0YVWyvdsHSNyJ32/EC0SdxDuVHzQw9L1RwAV4ryPZAn2Hd7XBm8fnE5DWau WjhQ== X-Forwarded-Encrypted: i=1; AFNElJ/EGUH70cpnw5MIrKXYvUztNZhknLXNl4Qu1hjk+QJ6AojUCoytuo0tBri3ZP57BxazOttbZ9O4mg0=@passt.top X-Gm-Message-State: AOJu0YxUbVw66GmSWYB1Hm0GwDCIUgxKyCtaRFtchzl0tsLgCGAvSZb2 kqzEfoWinE9CDLWnFQX6zNwu5kf/5aMotc5J1kOsjgUjcBdFGO3/eqH1YgN3gTwsscSKzZsiiQJ ZMSNzfmYD7a4V1L6RErb4MVF1gJH5nEOtRR2Vq5k7m0+AvglRrKhGyg== X-Gm-Gg: AeBDieuplPLPldFCVHXMC4iHvtoy/GvsLV3xVhaGRbKzrY1yPnYMLUOE+4CBv2dkKjr gTx3qhTbYCbj/72ljLwEHJnRDith0SPyH68k+Qwvk48Kwsx59+xc4Dmg+nSIaSCz95tQTBY6soe Opm+PEMRh0xjL4vQ7FPcPXh1SL4jmsPZELAznyOtcbrdttGrrZ1CbKH1hsgVQxGvR8J4f2gGHUe vk7q06VKTOTWRhToIU+OuGSef1Lgpt5kEsfpj3gx2XABKQimc5VrF+lSUKqsDDz4PxLk3U0P0if MA6axf/T5c2o9TOkKGhBruXWGmEgyerNzf+sBkOiX7tLGmd22i0zxAE6oWYI1HWF0cruW2oe3P6 pZsBaOB2wPlwTmWE7BM/xkrxIclNcpG18Fq636rjfFxo= X-Received: by 2002:a05:600c:3553:b0:48a:52f2:a0f1 with SMTP id 5b1f17b1804b1-48a52f2a5f0mr310406365e9.18.1777109766957; Sat, 25 Apr 2026 02:36:06 -0700 (PDT) X-Received: by 2002:a05:600c:3553:b0:48a:52f2:a0f1 with SMTP id 5b1f17b1804b1-48a52f2a5f0mr310406065e9.18.1777109766521; Sat, 25 Apr 2026 02:36:06 -0700 (PDT) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [2a10:fc81:a806:d6a9::1]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48a5aa3ae83sm491346935e9.12.2026.04.25.02.36.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Apr 2026 02:36:05 -0700 (PDT) From: Stefano Brivio To: Jon Maloy Subject: Re: [PATCH v5 17/18] pesto, conf: Send updated rules from pesto back to passt/pasta Message-ID: <20260425113604.045c7a72@elisabeth> In-Reply-To: <9c7a09d6-b4f2-429f-b5c9-7aed19a81902@redhat.com> References: <20260421062516.2601204-1-david@gibson.dropbear.id.au> <20260421062516.2601204-18-david@gibson.dropbear.id.au> <9c7a09d6-b4f2-429f-b5c9-7aed19a81902@redhat.com> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.49; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 25jhxSrhmlIw_uH8DCJ0zy-rh7hZ4v8dpinL4IYoCAo_1777109767 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-MailFrom: sbrivio@redhat.com X-Mailman-Rule-Hits: emergency X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved Message-ID-Hash: 7RCEAF2GG62VLTJKPIVHLUZD25WTFD5C X-Message-ID-Hash: 7RCEAF2GG62VLTJKPIVHLUZD25WTFD5C X-Mailman-Approved-At: Mon, 27 Apr 2026 09:47:04 +0200 CC: David Gibson , 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: Date: Sat, 25 Apr 2026 09:36:11 X-Original-Date: Sat, 25 Apr 2026 11:36:05 +0200 (CEST) On Fri, 24 Apr 2026 18:38:57 -0400 Jon Maloy wrote: > On 2026-04-21 02:25, David Gibson wrote: > > Extend pesto to send the updated rule configuration back to passt/pasta. > > Extend passt/pasta to read the new configuration and store the new rules in > > a "pending" table. We don't yet attempt to activate them. > > > > Signed-off-by: Stefano Brivio > > Message-ID: <20260322141843.4095972-3-sbrivio@redhat.com> > > [dwg: Based on an early draft from Stefano]\ > > Signed-off-by: David Gibson > > [...] > > > > +/** > > + * conf_recv_rules() - Receive forwarding rules from configuration client > > + * @c: Execution context > > + * @fd: Socket to the client > > + * > > + * Return: 0 on success, -1 on failure > > + */ > > +static int conf_recv_rules(const struct ctx *c, int fd) > > +{ > > + while (1) { > > + struct fwd_table *fwd; > > + struct fwd_rule r; > > + uint32_t count; > > + uint8_t pif; > > + unsigned i; > > + > > + if (read_u8(fd, &pif)) > > + return -1; > > + > > + if (pif == PIF_NONE) > > + break; > > + > > + if (pif >= ARRAY_SIZE(c->fwd_pending) || > > + !(fwd = c->fwd_pending[pif])) { > > + err("Received rules for non-existent table"); > > + return -1; > > + } > > + > > + if (read_u32(fd, &count)) > > + return -1; > > + > > + if (count > MAX_FWD_RULES) { > > + err("Received %"PRIu32" rules (maximum %u)", > > + count, MAX_FWD_RULES); > > + return -1; > > + } > > + > > + for (i = 0; i < count; i++) { > > + fwd_rule_read(fd, &r); > > Since we don't check the return value I think we risk passing an only > partially initialized fwd_rule to fwd_rule_add() if the read fails. > Maybe: > if (fwd_rule_read(fd, &r)) > return -1; Right, yes, that makes sense in general, even though I think this will need a small rework (I didn't get to that yet) to implement this point of the to-do list (see cover letter): > - Don't allow a client which sends a partial configuration then > blocks also block passt ...because at that point we'll want to permit partial reads and keep a buffer with a counter of received bytes (perhaps rules / PIFs too). But actually it doesn't even need to be in this series or in a first implementation. It could simply be a limitation (in that case, I'll add the return -1 you suggest). A user who can connect to passt could anyway configure it to be useless so I don't see any particular security concern with it. -- Stefano