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=Av+hoGDe; 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 ESMTPS id 07DDC5A0619 for ; Thu, 02 Apr 2026 22:34:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1775162044; 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=jkPwTQZzwoF/MZbZ7UM9pUEKQufgl9jzqD413u8MJ4I=; b=Av+hoGDefioED47Nz1kQyS6pExRynZ42g2+NnuFuEGnGJF3iZ+wNGbV3mzJfpEjEEhsJK9 w9J0kmi8MVrfMnwjwQT/Dydsq+7dNwIL0WbJXnaIwBFw/dCipqQ9RWIU4jXfY+knqe9eDR G2TJQYukYj4aFs+uctO1GknLzDPBgc8= 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-310-e3agTARxNcGPl8k5EDwu6g-1; Thu, 02 Apr 2026 16:34:03 -0400 X-MC-Unique: e3agTARxNcGPl8k5EDwu6g-1 X-Mimecast-MFC-AGG-ID: e3agTARxNcGPl8k5EDwu6g_1775162042 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4837bfcfe0dso17419875e9.1 for ; Thu, 02 Apr 2026 13:34:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775162042; x=1775766842; 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=jkPwTQZzwoF/MZbZ7UM9pUEKQufgl9jzqD413u8MJ4I=; b=AbwOnSLY+9awcdEum1iwraWdR+9Zk6ZeLl1IuIkruHKGWIJfn9o3PgyCwH9viHiui7 jx/cEsCepbqyFQIInXfU8TUa5f21Gt6OeK8WWvaqocPgRFNxEPqUpIk4KcDADMgDrptz v5cFbDnHglQ/Ca8ywAvk9nTLjYdGaO9ulJptxwzOcfcLP8BrsCGyDjGIcV5frsO2PUAW 88T5tsZWvuaK7LDV4yubbyvy2BZrYHwpQzdPDmS+8xxE+sNMYKIsIi5h+cG+wpWF+H1W 3wq/MhNorGAbr5SkEXwNQCirNzhjBFQj1bvUeuHRACgsXAPE/PcABjCd+uqQQCnNN52t pdWQ== X-Forwarded-Encrypted: i=1; AJvYcCVSBKx8sd6MQzsIMPK4HS4g9ptYd0Qy7LMP+lnak2lHicjkJtHQDGlgNJmx7SyAqQahjsiPBCtqADo=@passt.top X-Gm-Message-State: AOJu0YwiqBx+2blbSR/TkIHBKoKTnoXSL698t/8agR65h7oQJpbU54IS Z60YTkLxi8GyfeefZa5PYMrVhxPB+9yLd77gReVeN4BuiZ2tteLU8JaiaaRuTRGXiNeNzIb/7kL 9uqmywsQzFRFtHoZkJQNIuV3lThMGL+2yyVPOePUUqAWkwioiYLMFDQ== X-Gm-Gg: ATEYQzytgxswdxQtjipuB1ZdioeRO5sAaMyRAY1AzXz2NHuVIzodSXzWn9LK0kj5L+l CMLC7P7iVH1P9JOlVCaV8+zX2n+Xd8lc/hKYq7eWoHHkH0FcDQWbfPUCuC8fNAeKq2dA5GUkbt9 uqFoTIeOeHDskmBKgXr2U5Y0ieL57vxrnmO83RaiRyKaCXFv5Yr6Yv79xrzzF/Oj0W8oCSBv5Rt 0TaI2jTpNr/io6DCX6pNc+JZ18CqQ+p7uCbh3TS6RDiaXCGyQb7vFafJRSrJAIZa/e2rrHWjXfC Rk++tMNMyJbOduiTJoR/QXdMK5UMgn/b9blwMynNM0SR28U6VNxrrwWw3OOnFiEP8Tr03p8eoIt IdBov2wlpu6B0oCoBubFOs+nLH7PbAna+53qnebmbhhwr2d0Lug== X-Received: by 2002:a05:600c:6099:b0:485:3f72:324d with SMTP id 5b1f17b1804b1-488997b229cmr6171925e9.14.1775162042171; Thu, 02 Apr 2026 13:34:02 -0700 (PDT) X-Received: by 2002:a05:600c:6099:b0:485:3f72:324d with SMTP id 5b1f17b1804b1-488997b229cmr6171545e9.14.1775162041630; Thu, 02 Apr 2026 13:34:01 -0700 (PDT) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [176.103.220.4]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4887e952b0bsm198232005e9.12.2026.04.02.13.34.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2026 13:34:01 -0700 (PDT) From: Stefano Brivio To: Jon Maloy Subject: Re: [PATCH v6 08/13] ip: Track observed guest IPv4 addresses in unified address array Message-ID: <20260402223400.511267fd@elisabeth> In-Reply-To: <20260322004333.365713-9-jmaloy@redhat.com> References: <20260322004333.365713-1-jmaloy@redhat.com> <20260322004333.365713-9-jmaloy@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 Date: Thu, 02 Apr 2026 22:34:00 +0200 (CEST) X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: hSAjtsAvhK541A6SVpSsFG_hYBK4bOBWh4wt3mNRKCI_1775162042 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: SYS7YKE3RKDDKA3ZDSR2PBSUNEN4V7TM X-Message-ID-Hash: SYS7YKE3RKDDKA3ZDSR2PBSUNEN4V7TM 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: david@gibson.dropbear.id.au, 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 Sat, 21 Mar 2026 20:43:28 -0400 Jon Maloy wrote: > [...] > > @@ -987,6 +1034,38 @@ static bool is_dns_flow(uint8_t proto, const struct flowside *ini) > ((ini->oport == 53) || (ini->oport == 853)); > } > > +/** > + * fwd_select_addr() - Select address with priority-based search > + * @c: Execution context > + * @af: Address family (AF_INET or AF_INET6) > + * @primary: Primary flags to match (or 0 to skip) > + * @secondary: Secondary flags to match (or 0 to skip) > + * @skip: Flags to exclude from search > + * > + * Search for address entries in priority order. > + * > + * Return: pointer to selected address entry, or NULL if none found > + */ > +const struct guest_addr *fwd_select_addr(const struct ctx *c, int af, > + int primary, int secondary, int skip) Looking at 9/13 I start finding this quite confusing: instead of having a function doing two lookups with a preferred set of flags first, couldn't we simply call fwd_get_addr() multiple (up to 2) times if we have "secondary" flags? Does it really add much code? I think that even if it adds some lines it would be still preferable as it looks much more natural. -- Stefano