aboutgitcodebugslistschat
path: root/pasta.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2023-08-03 17:19:56 +1000
committerStefano Brivio <sbrivio@redhat.com>2023-08-04 01:32:32 +0200
commit02b30e7871410e54d1adfa7deb4943493d0a020e (patch)
tree4ead400a8376b8ea20c46f1d74249e44c40d19c9 /pasta.c
parent5103811e2df397c2f3165ac065e1e92cfa4eae31 (diff)
downloadpasst-02b30e7871410e54d1adfa7deb4943493d0a020e.tar
passt-02b30e7871410e54d1adfa7deb4943493d0a020e.tar.gz
passt-02b30e7871410e54d1adfa7deb4943493d0a020e.tar.bz2
passt-02b30e7871410e54d1adfa7deb4943493d0a020e.tar.lz
passt-02b30e7871410e54d1adfa7deb4943493d0a020e.tar.xz
passt-02b30e7871410e54d1adfa7deb4943493d0a020e.tar.zst
passt-02b30e7871410e54d1adfa7deb4943493d0a020e.zip
netlink: Propagate errors for "dup" operations
We now detect errors on netlink "set" operations while configuring the pasta namespace with --config-net. However in many cases rather than a simple "set" we use a more complex "dup" function to copy configuration from the host to the namespace. We're not yet properly detecting and reporting netlink errors for that case. Change the "dup" operations to propagate netlink errors to their caller, pasta_ns_conf() and report them there. Link: https://bugs.passt.top/show_bug.cgi?id=60 Signed-off-by: David Gibson <david@gibson.dropbear.id.au> [sbrivio: Minor formatting changes in pasta_ns_conf()] Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'pasta.c')
-rw-r--r--pasta.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/pasta.c b/pasta.c
index 02635b3..1e84680 100644
--- a/pasta.c
+++ b/pasta.c
@@ -298,8 +298,9 @@ void pasta_ns_conf(struct ctx *c)
&c->ip4.addr,
c->ip4.prefix_len);
} else {
- nl_addr_dup(nl_sock, c->ifi4,
- nl_sock_ns, c->pasta_ifi, AF_INET);
+ rc = nl_addr_dup(nl_sock, c->ifi4,
+ nl_sock_ns, c->pasta_ifi,
+ AF_INET);
}
if (rc < 0) {
@@ -311,8 +312,8 @@ void pasta_ns_conf(struct ctx *c)
rc = nl_route_set_def(nl_sock_ns, c->pasta_ifi,
AF_INET, &c->ip4.gw);
} else {
- nl_route_dup(nl_sock, c->ifi4, nl_sock_ns,
- c->pasta_ifi, AF_INET);
+ rc = nl_route_dup(nl_sock, c->ifi4, nl_sock_ns,
+ c->pasta_ifi, AF_INET);
}
if (rc < 0) {
@@ -326,9 +327,9 @@ void pasta_ns_conf(struct ctx *c)
rc = nl_addr_set(nl_sock_ns, c->pasta_ifi,
AF_INET6, &c->ip6.addr, 64);
} else {
- nl_addr_dup(nl_sock, c->ifi6,
- nl_sock_ns, c->pasta_ifi,
- AF_INET6);
+ rc = nl_addr_dup(nl_sock, c->ifi6,
+ nl_sock_ns, c->pasta_ifi,
+ AF_INET6);
}
if (rc < 0) {
@@ -340,9 +341,9 @@ void pasta_ns_conf(struct ctx *c)
rc = nl_route_set_def(nl_sock_ns, c->pasta_ifi,
AF_INET6, &c->ip6.gw);
} else {
- nl_route_dup(nl_sock, c->ifi6,
- nl_sock_ns, c->pasta_ifi,
- AF_INET6);
+ rc = nl_route_dup(nl_sock, c->ifi6,
+ nl_sock_ns, c->pasta_ifi,
+ AF_INET6);
}
if (rc < 0) {