summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-rtnl/sd-rtnl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsystemd/sd-rtnl/sd-rtnl.c')
-rw-r--r--src/libsystemd/sd-rtnl/sd-rtnl.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libsystemd/sd-rtnl/sd-rtnl.c b/src/libsystemd/sd-rtnl/sd-rtnl.c
index 816018a6c4..367f165a1c 100644
--- a/src/libsystemd/sd-rtnl/sd-rtnl.c
+++ b/src/libsystemd/sd-rtnl/sd-rtnl.c
@@ -72,7 +72,7 @@ static bool rtnl_pid_changed(sd_rtnl *rtnl) {
int sd_rtnl_open(sd_rtnl **ret, uint32_t groups) {
_cleanup_rtnl_unref_ sd_rtnl *rtnl = NULL;
socklen_t addrlen;
- int r;
+ int r, one = 1;
assert_return(ret, -EINVAL);
@@ -84,6 +84,9 @@ int sd_rtnl_open(sd_rtnl **ret, uint32_t groups) {
if (rtnl->fd < 0)
return -errno;
+ if (setsockopt(rtnl->fd, SOL_SOCKET, SO_PASSCRED, &one, sizeof(one)) < 0)
+ return -errno;
+
rtnl->sockaddr.nl.nl_groups = groups;
addrlen = sizeof(rtnl->sockaddr);