[Openvpn-devel] dco-linux: remove M_ERRNO flag when printing netlink error message

Message ID 20230320195820.6675-1-a@unstable.cc
State Accepted
Headers show
Series [Openvpn-devel] dco-linux: remove M_ERRNO flag when printing netlink error message | expand

Commit Message

Antonio Quartulli March 20, 2023, 7:58 p.m. UTC
Netlink has its own error space and reports errors via the return
value of its functions.

For this reason remove the M_ERRNO flag when printing its errors.
At the moment we get something like this:

netlink reports error (-7): Invalid input data or parameter: Interrupted system call (errno=4)

where the errno=4 (and its human readable representation) is a leftover
from the previous recv() interrupted by a signal and it is totally
unrelated to this netlink failure.

Signed-off-by: Antonio Quartulli <a@unstable.cc>
---
 src/openvpn/dco_linux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Gert Doering March 21, 2023, 8:22 a.m. UTC | #1
Acked-by: Gert Doering <gert@greenie.muc.de>

"Trivially correct" :-) - compile-tested on a DCO enabled linux.

Your patch has been applied to the master and release/2.6 branch.

commit 23903fd579353c9892415a750f17a9832a79cced (master)
commit 047f772b84843344b6131e9e915472d14adcea2b (release/2.6)
Author: Antonio Quartulli
Date:   Mon Mar 20 20:58:20 2023 +0100

     dco-linux: remove M_ERRNO flag when printing netlink error message

     Signed-off-by: Antonio Quartulli <a@unstable.cc>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Message-Id: <20230320195820.6675-1-a@unstable.cc>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg26452.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpn/dco_linux.c b/src/openvpn/dco_linux.c
index 98b2aae3..0e479beb 100644
--- a/src/openvpn/dco_linux.c
+++ b/src/openvpn/dco_linux.c
@@ -154,7 +154,7 @@  ovpn_nl_recvmsgs(dco_context_t *dco, const char *prefix)
         default:
             if (ret)
             {
-                msg(M_NONFATAL|M_ERRNO, "%s: netlink reports error (%d): %s", prefix, ret, nl_geterror(-ret));
+                msg(M_NONFATAL, "%s: netlink reports error (%d): %s", prefix, ret, nl_geterror(-ret));
             }
             break;
     }