From: Antonio Quartulli Date: Sat, 18 Apr 2020 01:18:49 +0000 (+0200) Subject: sitnl: fix failure reporting by keeping error negative X-Git-Tag: v2.5_beta1~162 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74fadcf4ebe860c15d12cb4e065c7ca0e0dc4497;p=thirdparty%2Fopenvpn.git sitnl: fix failure reporting by keeping error negative The err->errno value reported by netlink is already negative. Prepending ierr->errno with '-' when forwarding it to the caller results in a positive value and thus not detected as error. Fix error handling in sitnl by not negating the sign of the value returned by sitnl_send() in case of generic error. While at it, print the errno in decimal form along with its string represenation. Reported-by: Richard Bonhomme Signed-off-by: Antonio Quartulli Acked-by: Gert Doering Message-Id: <20200418011849.382-1-a@unstable.cc> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg19773.html Signed-off-by: Gert Doering --- diff --git a/src/openvpn/networking_sitnl.c b/src/openvpn/networking_sitnl.c index b93697e90..7adcb64c7 100644 --- a/src/openvpn/networking_sitnl.c +++ b/src/openvpn/networking_sitnl.c @@ -365,9 +365,9 @@ sitnl_send(struct nlmsghdr *payload, pid_t peer, unsigned int groups, } else { - msg(M_WARN, "%s: rtnl: generic error: %s", - __func__, strerror(-err->error)); - ret = -err->error; + msg(M_WARN, "%s: rtnl: generic error (%d): %s", + __func__, err->error, strerror(-err->error)); + ret = err->error; } } goto out;