summaryrefslogtreecommitdiffstats
path: root/include/libnetlink.h
diff options
context:
space:
mode:
authorStephen Hemminger <stephen@networkplumber.org>2017-08-04 09:52:15 -0700
committerStephen Hemminger <stephen@networkplumber.org>2017-08-04 09:54:00 -0700
commitb6432e68ac2f1f6b4ea50aa0d6d47e72c445c71c (patch)
treec2e38d42ed549a944e0d6ad179dbf1c0a4f895b5 /include/libnetlink.h
parent620fc6696d4f4e9ad540a45892873b0382907739 (diff)
iproute: Add support for extended ack to rtnl_talk
Add support for extended ack error reporting via libmnl. Add a new function rtnl_talk_extack that takes a callback as an input arg. If a netlink response contains extack attributes, the callback is is invoked with the the err string, offset in the message and a pointer to the message returned by the kernel. If iproute2 is built without libmnl, it will still work but extended error reports from kernel will not be available. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Diffstat (limited to 'include/libnetlink.h')
-rw-r--r--include/libnetlink.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/libnetlink.h b/include/libnetlink.h
index 643c3bc5..69257f0e 100644
--- a/include/libnetlink.h
+++ b/include/libnetlink.h
@@ -76,6 +76,9 @@ typedef int (*rtnl_listen_filter_t)(const struct sockaddr_nl *,
struct rtnl_ctrl_data *,
struct nlmsghdr *n, void *);
+typedef int (*nl_ext_ack_fn_t)(const char *errmsg, uint32_t off,
+ const struct nlmsghdr *inner_nlh);
+
struct rtnl_dump_filter_arg {
rtnl_filter_t filter;
void *arg1;
@@ -92,6 +95,9 @@ int rtnl_dump_filter_nc(struct rtnl_handle *rth,
int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n,
struct nlmsghdr *answer, size_t len)
__attribute__((warn_unused_result));
+int rtnl_talk_extack(struct rtnl_handle *rtnl, struct nlmsghdr *n,
+ struct nlmsghdr *answer, size_t len, nl_ext_ack_fn_t errfn)
+ __attribute__((warn_unused_result));
int rtnl_talk_suppress_rtnl_errmsg(struct rtnl_handle *rtnl, struct nlmsghdr *n,
struct nlmsghdr *answer, size_t len)
__attribute__((warn_unused_result));