From: Jon Maloy <jmaloy@redhat.com>
To: sbrivio@redhat.com, david@gibson.dropbear.id.au,
jmaloy@redhat.com, passt-dev@passt.top
Subject: [PATCH v8 03/14] tap, conf: Replace addr_fixed with CONF_ADDR_USER flag check
Date: Thu, 25 Jun 2026 22:45:08 -0400 [thread overview]
Message-ID: <20260626024519.3701556-4-jmaloy@redhat.com> (raw)
In-Reply-To: <20260626024519.3701556-1-jmaloy@redhat.com>
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 <jmaloy@redhat.com>
---
conf.c | 7 ++-----
passt.h | 6 ------
tap.c | 9 ++++-----
3 files changed, 6 insertions(+), 16 deletions(-)
diff --git a/conf.c b/conf.c
index ac8facc8..1c0c1786 100644
--- a/conf.c
+++ b/conf.c
@@ -1598,13 +1598,10 @@ void conf(struct ctx *c, int argc, char **argv)
/* Legacy behaviour: replace existing address if any */
fwd_set_addr(c, &addr, CONF_ADDR_USER, prefix_len);
- if (inany_v4(&addr)) {
+ if (inany_v4(&addr))
c->ip4.no_copy_addrs = true;
- c->ip4.addr_fixed = true;
- } else {
+ else
c->ip6.no_copy_addrs = true;
- c->ip6.addr_fixed = true;
- }
break;
}
case 'n': {
diff --git a/passt.h b/passt.h
index cafa35ea..11ccff05 100644
--- a/passt.h
+++ b/passt.h
@@ -100,8 +100,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 */
@@ -121,7 +119,6 @@ struct ip4_ctx {
bool no_copy_routes;
bool no_copy_addrs;
- bool addr_fixed;
};
/**
@@ -141,8 +138,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 */
@@ -163,7 +158,6 @@ struct ip6_ctx {
bool no_copy_routes;
bool no_copy_addrs;
- bool addr_fixed;
};
#include <netinet/if_ether.h>
diff --git a/tap.c b/tap.c
index 12630f58..573a3f10 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, CONF_ADDR_USER, 0) &&
iph->saddr && c->ip4.addr_seen.s_addr != iph->saddr)
c->ip4.addr_seen.s_addr = iph->saddr;
@@ -1000,18 +1000,17 @@ 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, CONF_ADDR_USER, 0) &&
IN6_IS_ADDR_UNSPECIFIED(&c->ip6.addr_seen)) {
c->ip6.addr_seen = *saddr;
}
- if (!c->ip6.addr_fixed &&
- !fwd_get_addr(c, AF_INET6, CONF_ADDR_ANY, 0)) {
+ if (!fwd_get_addr(c, AF_INET6, CONF_ADDR_USER, 0)) {
union inany_addr addr = { .a6 = *saddr };
fwd_set_addr(c, &addr, CONF_ADDR_LINKLOCAL, 64);
}
- } else if (!c->ip6.addr_fixed &&
+ } else if (!fwd_get_addr(c, AF_INET6, CONF_ADDR_USER, 0) &&
!IN6_IS_ADDR_UNSPECIFIED(saddr)) {
c->ip6.addr_seen = *saddr;
}
--
2.52.0
next prev parent reply other threads:[~2026-06-26 2:45 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-26 2:45 [PATCH v8 00/14] Introduce multiple addresses Jon Maloy
2026-06-26 2:45 ` [PATCH v8 01/14] dhcpv6: Fix reply destination to match client's source address Jon Maloy
2026-06-26 2:45 ` [PATCH v8 02/14] passt, pasta: Introduce unified multi-address data structures Jon Maloy
2026-06-26 2:45 ` Jon Maloy [this message]
2026-06-26 2:45 ` [PATCH v8 04/14] fwd: Unify guest accessibility checks with unified address array Jon Maloy
2026-06-26 2:45 ` [PATCH v8 05/14] arp: Check all configured addresses in ARP filtering Jon Maloy
2026-06-26 2:45 ` [PATCH v8 06/14] conf: Allow multiple -a/--address options per address family Jon Maloy
2026-06-26 2:45 ` [PATCH v8 07/14] netlink, conf: Read all addresses from template interface at startup Jon Maloy
2026-06-26 2:45 ` [PATCH v8 08/14] netlink, pasta: refactor function pasta_ns_conf() Jon Maloy
2026-06-26 2:45 ` [PATCH v8 09/14] conf, pasta: Track observed guest IPv4 addresses in unified address array Jon Maloy
2026-06-26 2:45 ` [PATCH v8 10/14] conf, pasta: Track observed guest IPv6 " Jon Maloy
2026-06-26 2:45 ` [PATCH v8 11/14] dhcp: Select address for DHCP distribution Jon Maloy
2026-06-26 2:45 ` [PATCH v8 12/14] dhcpv6: Select addresses for DHCPv6 distribution Jon Maloy
2026-06-26 2:45 ` [PATCH v8 13/14] ndp: Support advertising multiple prefixes in Router Advertisements Jon Maloy
2026-06-26 2:45 ` [PATCH v8 14/14] migrate: Update protocol to v3 for multi-address support Jon Maloy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260626024519.3701556-4-jmaloy@redhat.com \
--to=jmaloy@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=passt-dev@passt.top \
--cc=sbrivio@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).