conf: Accept -a and -g without --config-net in pasta mode
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:cc9d16758b
("conf, pasta: With --config-net, copy all addresses by default") Fixes:da54641f14
("conf, pasta: With --config-net, copy all routes by default") Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
d034fb698f
commit
5b646b9b10
1 changed files with 7 additions and 6 deletions
13
conf.c
13
conf.c
|
@ -1195,6 +1195,7 @@ void conf(struct ctx *c, int argc, char **argv)
|
||||||
};
|
};
|
||||||
struct get_bound_ports_ns_arg ns_ports_arg = { .c = c };
|
struct get_bound_ports_ns_arg ns_ports_arg = { .c = c };
|
||||||
char userns[PATH_MAX] = { 0 }, netns[PATH_MAX] = { 0 };
|
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;
|
bool v4_only = false, v6_only = false;
|
||||||
char *runas = NULL, *logfile = NULL;
|
char *runas = NULL, *logfile = NULL;
|
||||||
struct in6_addr *dns6 = c->ip6.dns;
|
struct in6_addr *dns6 = c->ip6.dns;
|
||||||
|
@ -1360,14 +1361,14 @@ void conf(struct ctx *c, int argc, char **argv)
|
||||||
die("--no-copy-routes is for pasta mode only");
|
die("--no-copy-routes is for pasta mode only");
|
||||||
|
|
||||||
warn("--no-copy-routes will be dropped soon");
|
warn("--no-copy-routes will be dropped soon");
|
||||||
c->no_copy_routes = 1;
|
c->no_copy_routes = copy_routes_opt = true;
|
||||||
break;
|
break;
|
||||||
case 19:
|
case 19:
|
||||||
if (c->mode != MODE_PASTA)
|
if (c->mode != MODE_PASTA)
|
||||||
die("--no-copy-addrs is for pasta mode only");
|
die("--no-copy-addrs is for pasta mode only");
|
||||||
|
|
||||||
warn("--no-copy-addrs will be dropped soon");
|
warn("--no-copy-addrs will be dropped soon");
|
||||||
c->no_copy_addrs = 1;
|
c->no_copy_addrs = copy_addrs_opt = true;
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
if (c->debug)
|
if (c->debug)
|
||||||
|
@ -1661,10 +1662,10 @@ void conf(struct ctx *c, int argc, char **argv)
|
||||||
die("Options --socket and --fd are mutually exclusive");
|
die("Options --socket and --fd are mutually exclusive");
|
||||||
|
|
||||||
if (c->mode == MODE_PASTA && !c->pasta_conf_ns) {
|
if (c->mode == MODE_PASTA && !c->pasta_conf_ns) {
|
||||||
if (c->no_copy_routes)
|
if (copy_routes_opt)
|
||||||
die("Option --no-copy-routes needs --config-net");
|
die("--no-copy-routes needs --config-net");
|
||||||
if (c->no_copy_addrs)
|
if (copy_addrs_opt)
|
||||||
die("Option --no-copy-addrs needs --config-net");
|
die("--no-copy-addrs needs --config-net");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ifi4 && *c->ip4.ifname_out)
|
if (!ifi4 && *c->ip4.ifname_out)
|
||||||
|
|
Loading…
Reference in a new issue