diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2018-03-08 17:01:35 +0100 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2018-03-08 17:49:18 +0100 |
commit | 5e27a30e1d7b64f056d666463aa6c6894531462d (patch) | |
tree | 530ce6634fd7545b7bf2ebe15889f305e6a246c1 /src/platform/nm-netlink.h | |
parent | 39fde61a5a160ac8be644290226d3cff94c4b342 (diff) | |
download | NetworkManager-bg/extack.tar.gz |
platform: print error message from netlink extended ackbg/extack
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.
Example:
platform-linux: netlink: recvmsg: error message from kernel: Network is unreachable (101) "Nexthop has invalid gateway" for request 12
[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.h | 13 |
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__ */ |