From 1d81ef9e242b8fc53fe1d94a09847b82945ce4f6 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Mon, 10 Feb 2020 15:12:49 +0100 Subject: [PATCH] gw: Proper error log on non-existing netns --- srsue/src/stack/upper/gw.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/srsue/src/stack/upper/gw.cc b/srsue/src/stack/upper/gw.cc index 5bc0d7bc6..917713631 100644 --- a/srsue/src/stack/upper/gw.cc +++ b/srsue/src/stack/upper/gw.cc @@ -347,6 +347,12 @@ int gw::init_if(char* err_str) std::string netns("/run/netns/"); netns += args.netns; netns_fd = open(netns.c_str(), O_RDONLY); + if (netns_fd == -1) { + err_str = strerror(errno); + log.error("Failed to find netns %s (%s): %s\n", + args.netns.c_str(), netns.c_str(), err_str); + return SRSLTE_ERROR_CANT_START; + } if (setns(netns_fd, CLONE_NEWNET) == -1) { err_str = strerror(errno); log.error("Failed to change netns: %s\n", err_str);