summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-netlink/sd-netlink.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2019-11-30 15:01:06 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2019-11-30 16:13:51 +0900
commite4a1e68d7ab318caa50312c022bd22a8fb81c6b7 (patch)
treee44274ed08ad90bac9faa5aadec9f7b8884397ba /src/libsystemd/sd-netlink/sd-netlink.c
parent0e7e8544712f8b0300bd28f706ab2105ea9d3c1b (diff)
downloadsystemd-e4a1e68d7ab318caa50312c022bd22a8fb81c6b7.tar.gz
sd-netlink: support NLMSGERR_ATTR_MSG
From v4.12 the kernel appends some attributes to netlink acks containing a textual description of the error and other fields. This makes sd-netlink parse the attributes.
Diffstat (limited to 'src/libsystemd/sd-netlink/sd-netlink.c')
-rw-r--r--src/libsystemd/sd-netlink/sd-netlink.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libsystemd/sd-netlink/sd-netlink.c b/src/libsystemd/sd-netlink/sd-netlink.c
index 87350e8591..5b7081089e 100644
--- a/src/libsystemd/sd-netlink/sd-netlink.c
+++ b/src/libsystemd/sd-netlink/sd-netlink.c
@@ -107,6 +107,10 @@ int sd_netlink_open_fd(sd_netlink **ret, int fd) {
rtnl->fd = fd;
rtnl->protocol = protocol;
+ r = setsockopt_int(fd, SOL_NETLINK, NETLINK_EXT_ACK, 1);
+ if (r < 0)
+ log_debug_errno(r, "sd-netlink: Failed to enable NETLINK_EXT_ACK option, ignoring: %m");
+
r = socket_bind(rtnl);
if (r < 0) {
rtnl->fd = -1; /* on failure, the caller remains owner of the fd, hence don't close it here */