From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=fail (p=quarantine dis=none) header.from=redhat.com 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 6E1775A0269 for ; Fri, 20 Nov 2026 20:24:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1795202684; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1Uf9FxD24S3R+WwTgwBsPfQzMbwvlf9HsEnGguYZL7I=; b=N6lbRfTzDLUSnMhc27r4+unSVycUTDcMGcjm3uYGX1lPPGppF8zejG3tlCurG/e+LIXqMN 4EGNepVpX0LOhiFoDxzRHUSzQy3ToR7x2159J2uqWrTMm8ApPLv30dUwTI8i7rYVRy5p42 lxzQLNmOpwKn5uMZnfbYKmTR6Uqei+E= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-390--1A7dBbOPqW8yLINmPZVDg-1; Fri, 20 Nov 2026 19:24:43 +0000 X-MC-Unique: -1A7dBbOPqW8yLINmPZVDg-1 X-Mimecast-MFC-AGG-ID: -1A7dBbOPqW8yLINmPZVDg_1795202682 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 98C911954237; Fri, 20 Nov 2026 19:24:41 +0000 (UTC) Received: from jmaloy-thinkpadp16vgen1.redhat.corp (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5CD8818011D9; Fri, 20 Nov 2026 19:24:40 +0000 (UTC) From: Jon Maloy To: sbrivio@redhat.com, david@gibson.dropbear.id.au, jmaloy@redhat.com, passt-dev@passt.top Subject: [PATCH v9 1/5] tap, conf: Replace addr_fixed with CONF_ADDR_USER flag check Date: Fri, 20 Nov 2026 14:24:33 -0500 Message-ID: <20261120192437.1860855-2-jmaloy@redhat.com> In-Reply-To: <20261120192437.1860855-1-jmaloy@redhat.com> References: <20261120192437.1860855-1-jmaloy@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: vIl5OfplRcrcsIz3uuwTpna1bijmz3Z6hBlZyNlLtj4_1795202682 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: P3JKQ6IL2KP5GUBFNVDMBIKDCMOY4POH X-Message-ID-Hash: P3JKQ6IL2KP5GUBFNVDMBIKDCMOY4POH X-MailFrom: jmaloy@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 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: The addr_fixed boolean (per address family) was introduced to prevent observed traffic from overwriting addr_seen when the user explicitly set an address with -a/--address. The unified address array already tracks this: fwd_set_addr() marks user-provided addresses with CONF_ADDR_USER. We now replace all addr_fixed checks with fwd_get_addr() lookups for CONF_ADDR_USER and remove the now-redundant field from ip4_ctx and ip6_ctx. Signed-off-by: Jon Maloy --- v9: -Adapted to changes due to rebase -Adapted to change in fwd_get_addr() --- conf.c | 7 ++----- passt.h | 6 ------ tap.c | 6 +++--- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/conf.c b/conf.c index fd9f0771..27656271 100644 --- a/conf.c +++ b/conf.c @@ -1266,13 +1266,10 @@ static bool conf_addr(struct ctx *c, char *arg, uint8_t opt_n) goto bad; fwd_set_addr(c, &addr, CONF_ADDR_USER, prefix_len); - if (a4) { + if (a4) c->ip4.no_copy_addrs = true; - c->ip4.addr_fixed = true; - } else { + else c->ip6.no_copy_addrs = true; - c->ip6.addr_fixed = true; - } return is_prefix; diff --git a/passt.h b/passt.h index d4661d81..40d22bba 100644 --- a/passt.h +++ b/passt.h @@ -101,8 +101,6 @@ struct guest_addr { * @ifname_out: Optional interface name to bind outbound sockets to * @no_copy_routes: Don't copy all routes when configuring target namespace * @no_copy_addrs: Don't copy all addresses when configuring namespace - * @addr_fixed: Address was given explicitly (-a): don't update - * addr_seen from traffic observed on tap */ struct ip4_ctx { /* PIF_TAP addresses */ @@ -122,7 +120,6 @@ struct ip4_ctx { bool no_copy_routes; bool no_copy_addrs; - bool addr_fixed; }; /** @@ -143,8 +140,6 @@ struct ip4_ctx { * @ifname_out: Optional interface name to bind outbound sockets to * @no_copy_routes: Don't copy all routes when configuring target namespace * @no_copy_addrs: Don't copy all addresses when configuring namespace - * @addr_fixed: Address was given explicitly (-a): don't update - * addr_seen from traffic observed on tap */ struct ip6_ctx { /* PIF_TAP addresses */ @@ -166,7 +161,6 @@ struct ip6_ctx { bool no_copy_routes; bool no_copy_addrs; - bool addr_fixed; }; #include diff --git a/tap.c b/tap.c index 100afc83..cc2dfbcc 100644 --- a/tap.c +++ b/tap.c @@ -756,7 +756,7 @@ resume: continue; } - if (!c->ip4.addr_fixed && + if (!fwd_get_addr(c, AF_INET, true, CONF_ADDR_USER) && iph->saddr && c->ip4.addr_seen.s_addr != iph->saddr) c->ip4.addr_seen.s_addr = iph->saddr; @@ -1000,7 +1000,7 @@ resume: if (IN6_IS_ADDR_LINKLOCAL(saddr)) { c->ip6.addr_ll_seen = *saddr; - if (!c->ip6.addr_fixed && + if (!fwd_get_addr(c, AF_INET6, true, CONF_ADDR_USER) && IN6_IS_ADDR_UNSPECIFIED(&c->ip6.addr_seen)) { c->ip6.addr_seen = *saddr; } @@ -1011,7 +1011,7 @@ resume: fwd_set_addr(c, &addr, CONF_ADDR_GEN, 64); } - } else if (!c->ip6.addr_fixed && + } else if (!fwd_get_addr(c, AF_INET6, true, CONF_ADDR_USER) && !IN6_IS_ADDR_UNSPECIFIED(saddr)) { c->ip6.addr_seen = *saddr; } -- 2.56.1