]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
networkd: clean up NETLINK_PKTINFO vs. SO_PASSCRED confusion
authorLennart Poettering <lennart@poettering.net>
Wed, 27 May 2020 17:37:19 +0000 (19:37 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 27 May 2020 20:40:56 +0000 (22:40 +0200)
We actually care for NETLINK_PKTINFO, not for SO_PASSCRED, hence when
allocating the netlink socket, configure things accordingly.

Tracked down by Benjamin Robin, see:

https://github.com/systemd/systemd/pull/15571#issuecomment-633213747

src/libsystemd/sd-netlink/netlink-socket.c
units/systemd-networkd.socket

index 71b3d1e2f1f4affebe4a85308655fb89b07cd635..bcd82fe164699868d2cf62253999b7bed9996820 100644 (file)
 #include "socket-util.h"
 #include "util.h"
 
-/* For some reason we need some extra cmsg space on some kernels. It's not clear why, and one of those days
- * we need to track this down. See: https://github.com/systemd/systemd/pull/15457 */
-#define EXTRA_CMSG_SPACE 1024
-
 int socket_open(int family) {
         int fd;
 
@@ -244,7 +240,7 @@ int socket_write_message(sd_netlink *nl, sd_netlink_message *m) {
 
 static int socket_recv_message(int fd, struct iovec *iov, uint32_t *ret_mcast_group, bool peek) {
         union sockaddr_union sender;
-        CMSG_BUFFER_TYPE(CMSG_SPACE(sizeof(struct nl_pktinfo)) + EXTRA_CMSG_SPACE) control;
+        CMSG_BUFFER_TYPE(CMSG_SPACE(sizeof(struct nl_pktinfo))) control;
         struct msghdr msg = {
                 .msg_iov = iov,
                 .msg_iovlen = 1,
index 445193e8d343bb012893cf8e94fd75b6b9b16d31..bc049e5ade924cae38f72ae6040969e738ac8103 100644 (file)
@@ -17,7 +17,7 @@ Before=sockets.target
 [Socket]
 ReceiveBuffer=128M
 ListenNetlink=route 1361
-PassCredentials=yes
+PassPacketInfo=yes
 
 [Install]
 WantedBy=sockets.target