From 6920adda0dce8cc9fb585da658dd983833c2a928 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Wed, 2 Aug 2023 13:15:40 +1000 Subject: util: Make ns_enter() a void function and report setns() errors ns_enter() returns an integer... but it's always zero. If we actually fail the function doesn't return. Therefore it makes more sense for this to be a function returning void, and we can remove the cases where we pointlessly checked its return value. In addition ns_enter() is usually called from an ephemeral thread created by NS_CALL(). That means that the exit(EXIT_FAILURE) there usually won't be reported (since NS_CALL() doesn't wait() for the thread). So, use die() instead to print out some information in the unlikely event that our setns() here does fail. Signed-off-by: David Gibson Signed-off-by: Stefano Brivio --- udp.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'udp.c') diff --git a/udp.c b/udp.c index f749f5f..5a852fb 100644 --- a/udp.c +++ b/udp.c @@ -473,8 +473,7 @@ static int udp_splice_new_ns(void *arg) a = (struct udp_splice_new_ns_arg *)arg; - if (ns_enter(a->c)) - return 0; + ns_enter(a->c); a->s = udp_splice_new(a->c, a->v6, a->src, true); @@ -1064,8 +1063,7 @@ int udp_sock_init_ns(void *arg) struct ctx *c = (struct ctx *)arg; unsigned dst; - if (ns_enter(c)) - return 0; + ns_enter(c); for (dst = 0; dst < NUM_PORTS; dst++) { if (!bitmap_isset(c->udp.fwd_out.f.map, dst)) -- cgit v1.2.3