chiark / gitweb /
rtnl: message - read group membership of incoming messages
[elogind.git] / src / libsystemd / sd-rtnl / sd-rtnl.c
index 4ee360c0a87fe5060c4b1e2077cbe9cc6847b011..b91d08012ad78aaf52a621fcf59691be876e2a7c 100644 (file)
@@ -22,6 +22,7 @@
 #include <sys/socket.h>
 #include <poll.h>
 
 #include <sys/socket.h>
 #include <poll.h>
 
+#include "missing.h"
 #include "macro.h"
 #include "util.h"
 #include "hashmap.h"
 #include "macro.h"
 #include "util.h"
 #include "hashmap.h"
@@ -109,7 +110,12 @@ int sd_rtnl_open(sd_rtnl **ret, unsigned n_groups, ...) {
         if (rtnl->fd < 0)
                 return -errno;
 
         if (rtnl->fd < 0)
                 return -errno;
 
-        if (setsockopt(rtnl->fd, SOL_SOCKET, SO_PASSCRED, &one, sizeof(one)) < 0)
+        r = setsockopt(rtnl->fd, SOL_SOCKET, SO_PASSCRED, &one, sizeof(one));
+        if (r < 0)
+                return -errno;
+
+        r = setsockopt(rtnl->fd, SOL_NETLINK, NETLINK_PKTINFO, &one, sizeof(one));
+        if (r < 0)
                 return -errno;
 
         va_start(ap, n_groups);
                 return -errno;
 
         va_start(ap, n_groups);