From: Stefano Brivio <sbrivio@redhat.com>
To: passt-dev@passt.top
Cc: Gianluca Stivan <me@yawnt.com>,
David Gibson <david@gibson.dropbear.id.au>
Subject: [PATCH] conf: Accept -a and -g without --config-net in pasta mode
Date: Fri, 23 Jun 2023 10:14:37 +0200 [thread overview]
Message-ID: <20230623081437.2065482-1-sbrivio@redhat.com> (raw)
While --no-copy-addrs and --no-copy-routes only make sense with
--config-net, and they are implied on -g and -a, respectively, that
doesn't mean we should refuse -a or -g without --config-net: they are
still relevant for a number of things (including DHCP/DHCPv6/NDP
configuration).
Reported-by: Gianluca Stivan <me@yawnt.com>
Fixes: cc9d16758be6 ("conf, pasta: With --config-net, copy all addresses by default")
Fixes: da54641f140e ("conf, pasta: With --config-net, copy all routes by default")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
---
This is based on my previous patch:
"conf: Make -a/--address really imply --no-copy-addrs"
conf.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/conf.c b/conf.c
index 16a3e64..820d597 100644
--- a/conf.c
+++ b/conf.c
@@ -1197,6 +1197,7 @@ void conf(struct ctx *c, int argc, char **argv)
};
struct get_bound_ports_ns_arg ns_ports_arg = { .c = c };
char userns[PATH_MAX] = { 0 }, netns[PATH_MAX] = { 0 };
+ bool copy_addrs_opt = false, copy_routes_opt = false;
bool v4_only = false, v6_only = false;
char *runas = NULL, *logfile = NULL;
struct in6_addr *dns6 = c->ip6.dns;
@@ -1362,14 +1363,14 @@ void conf(struct ctx *c, int argc, char **argv)
die("--no-copy-routes is for pasta mode only");
warn("--no-copy-routes will be dropped soon");
- c->no_copy_routes = 1;
+ c->no_copy_routes = copy_routes_opt = true;
break;
case 19:
if (c->mode != MODE_PASTA)
die("--no-copy-addrs is for pasta mode only");
warn("--no-copy-addrs will be dropped soon");
- c->no_copy_addrs = 1;
+ c->no_copy_addrs = copy_addrs_opt = true;
break;
case 20:
if (logfile)
@@ -1682,10 +1683,10 @@ void conf(struct ctx *c, int argc, char **argv)
die("Options --socket and --fd are mutually exclusive");
if (c->mode == MODE_PASTA && !c->pasta_conf_ns) {
- if (c->no_copy_routes)
- die("Option --no-copy-routes needs --config-net");
- if (c->no_copy_addrs)
- die("Option --no-copy-addrs needs --config-net");
+ if (copy_routes_opt)
+ die("--no-copy-routes needs --config-net");
+ if (copy_addrs_opt)
+ die("--no-copy-addrs needs --config-net");
}
if (!ifi4 && *c->ip4.ifname_out)
--
@@ -1197,6 +1197,7 @@ void conf(struct ctx *c, int argc, char **argv)
};
struct get_bound_ports_ns_arg ns_ports_arg = { .c = c };
char userns[PATH_MAX] = { 0 }, netns[PATH_MAX] = { 0 };
+ bool copy_addrs_opt = false, copy_routes_opt = false;
bool v4_only = false, v6_only = false;
char *runas = NULL, *logfile = NULL;
struct in6_addr *dns6 = c->ip6.dns;
@@ -1362,14 +1363,14 @@ void conf(struct ctx *c, int argc, char **argv)
die("--no-copy-routes is for pasta mode only");
warn("--no-copy-routes will be dropped soon");
- c->no_copy_routes = 1;
+ c->no_copy_routes = copy_routes_opt = true;
break;
case 19:
if (c->mode != MODE_PASTA)
die("--no-copy-addrs is for pasta mode only");
warn("--no-copy-addrs will be dropped soon");
- c->no_copy_addrs = 1;
+ c->no_copy_addrs = copy_addrs_opt = true;
break;
case 20:
if (logfile)
@@ -1682,10 +1683,10 @@ void conf(struct ctx *c, int argc, char **argv)
die("Options --socket and --fd are mutually exclusive");
if (c->mode == MODE_PASTA && !c->pasta_conf_ns) {
- if (c->no_copy_routes)
- die("Option --no-copy-routes needs --config-net");
- if (c->no_copy_addrs)
- die("Option --no-copy-addrs needs --config-net");
+ if (copy_routes_opt)
+ die("--no-copy-routes needs --config-net");
+ if (copy_addrs_opt)
+ die("--no-copy-addrs needs --config-net");
}
if (!ifi4 && *c->ip4.ifname_out)
--
2.39.2
reply other threads:[~2023-06-23 8:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230623081437.2065482-1-sbrivio@redhat.com \
--to=sbrivio@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=me@yawnt.com \
--cc=passt-dev@passt.top \
/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).