aboutgitcodebugslistschat
path: root/pasta.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2024-08-06 19:24:40 +0200
committerStefano Brivio <sbrivio@redhat.com>2024-08-07 09:15:25 +0200
commitfbb0c9523e416a5c1ecf42287d867fc799fbf0f9 (patch)
tree431dd7e83ef7bf0ea71fcbf39e6154924b7e0825 /pasta.c
parentee36266a55478672ad2c5f4efbd6ca0bef3d37cd (diff)
downloadpasst-fbb0c9523e416a5c1ecf42287d867fc799fbf0f9.tar
passt-fbb0c9523e416a5c1ecf42287d867fc799fbf0f9.tar.gz
passt-fbb0c9523e416a5c1ecf42287d867fc799fbf0f9.tar.bz2
passt-fbb0c9523e416a5c1ecf42287d867fc799fbf0f9.tar.lz
passt-fbb0c9523e416a5c1ecf42287d867fc799fbf0f9.tar.xz
passt-fbb0c9523e416a5c1ecf42287d867fc799fbf0f9.tar.zst
passt-fbb0c9523e416a5c1ecf42287d867fc799fbf0f9.zip
conf, pasta: Make -g and -a skip route/addresses copy for matching IP version only
Paul reports that setting IPv4 address and gateway manually, using --address and --gateway, causes pasta to fail inserting IPv6 routes in a setup where multiple, inter-dependent IPv6 routes are present on the host. That's because, currently, any -g option implies --no-copy-routes altogether, and any -a implies --no-copy-addrs. Limit this implication to the matching IP version, instead, by having two copies of no_copy_routes and no_copy_addrs in the context structure, separately for IPv4 and IPv6. While at it, change them to 'bool': we had them as 'int' because getopt_long() used to set them directly, but it hasn't been the case for a while already. Reported-by: Paul Holzinger <pholzing@redhat.com> Signed-off-by: Stefano Brivio <sbrivio@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'pasta.c')
-rw-r--r--pasta.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/pasta.c b/pasta.c
index b4a3d99..615ff7b 100644
--- a/pasta.c
+++ b/pasta.c
@@ -306,7 +306,7 @@ void pasta_ns_conf(struct ctx *c)
nl_link_up(nl_sock_ns, c->pasta_ifi, c->mtu);
if (c->ifi4) {
- if (c->no_copy_addrs) {
+ if (c->ip4.no_copy_addrs) {
rc = nl_addr_set(nl_sock_ns, c->pasta_ifi,
AF_INET,
&c->ip4.addr,
@@ -322,7 +322,7 @@ void pasta_ns_conf(struct ctx *c)
strerror(-rc));
}
- if (c->no_copy_routes) {
+ if (c->ip4.no_copy_routes) {
rc = nl_route_set_def(nl_sock_ns, c->pasta_ifi,
AF_INET, &c->ip4.gw);
} else {
@@ -337,7 +337,7 @@ void pasta_ns_conf(struct ctx *c)
}
if (c->ifi6) {
- if (c->no_copy_addrs) {
+ if (c->ip6.no_copy_addrs) {
rc = nl_addr_set(nl_sock_ns, c->pasta_ifi,
AF_INET6, &c->ip6.addr, 64);
} else {
@@ -351,7 +351,7 @@ void pasta_ns_conf(struct ctx *c)
strerror(-rc));
}
- if (c->no_copy_routes) {
+ if (c->ip6.no_copy_routes) {
rc = nl_route_set_def(nl_sock_ns, c->pasta_ifi,
AF_INET6, &c->ip6.gw);
} else {