summaryrefslogtreecommitdiff
path: root/src/platform/nm-netlink.h
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2018-03-08 17:01:35 +0100
committerBeniamino Galvani <bgalvani@redhat.com>2018-03-09 17:52:43 +0100
commitb107e121b0f6d8a30c3dba7aa0ac04036934eb00 (patch)
tree27e836183ab6b7f40911eb0941084b4d56761648 /src/platform/nm-netlink.h
parent26c215e22dcfff9e61a58e9348991ed77c3f8861 (diff)
platform: print error message from netlink extended ack
From v4.12 the kernel appends some attributes to netlink acks containing a textual description of the error and other fields (see commit [1]). Parse those attributes and print the error message. Examples: platform-linux: netlink: recvmsg: error message from kernel: Network is unreachable (101) "Nexthop has invalid gateway" for request 12 platform-linux: netlink: recvmsg: error message from kernel: Invalid argument (22) "Local address cannot be multicast" for request 21 [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2d4bc93368f5a0ddb57c8c885cdad9c9b7a10ed5
Diffstat (limited to 'src/platform/nm-netlink.h')
-rw-r--r--src/platform/nm-netlink.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/platform/nm-netlink.h b/src/platform/nm-netlink.h
index 42e46d6c69..bd8a9cfaf0 100644
--- a/src/platform/nm-netlink.h
+++ b/src/platform/nm-netlink.h
@@ -26,7 +26,6 @@
#include <linux/genetlink.h>
/*****************************************************************************/
-
#define _NLE_BASE 100000
#define NLE_UNSPEC (_NLE_BASE + 0)
#define NLE_BUG (_NLE_BASE + 1)
@@ -42,6 +41,16 @@
#define _NLE_BASE_END (_NLE_BASE + 11)
+#define NLMSGERR_ATTR_UNUSED 0
+#define NLMSGERR_ATTR_MSG 1
+#define NLMSGERR_ATTR_OFFS 2
+#define NLMSGERR_ATTR_COOKIE 3
+#define NLMSGERR_ATTR_MAX 3
+
+#ifndef NLM_F_ACK_TLVS
+#define NLM_F_ACK_TLVS 0x200
+#endif
+
static inline int
nl_errno (int err)
{
@@ -484,6 +493,8 @@ int nl_recvmsgs (struct nl_sock *sk, const struct nl_cb *cb);
int nl_wait_for_ack (struct nl_sock *sk,
const struct nl_cb *cb);
+int nl_socket_set_ext_ack (struct nl_sock *sk, gboolean enable);
+
/*****************************************************************************/
#endif /* __NM_NETLINK_H__ */