summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-05-27 19:37:19 +0200
committerLennart Poettering <lennart@poettering.net>2020-05-27 22:40:56 +0200
commit43007b302efae90897b62095a6995f43c60c1ff1 (patch)
tree4f324a55b3ab850863866314ee0741584ad68e9b
parenta3d19f5d99c44940831a33df8b5bece4aaf749f7 (diff)
downloadsystemd-43007b302efae90897b62095a6995f43c60c1ff1.tar.gz
networkd: clean up NETLINK_PKTINFO vs. SO_PASSCRED confusion
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
-rw-r--r--src/libsystemd/sd-netlink/netlink-socket.c6
-rw-r--r--units/systemd-networkd.socket2
2 files changed, 2 insertions, 6 deletions
diff --git a/src/libsystemd/sd-netlink/netlink-socket.c b/src/libsystemd/sd-netlink/netlink-socket.c
index 71b3d1e2f1..bcd82fe164 100644
--- a/src/libsystemd/sd-netlink/netlink-socket.c
+++ b/src/libsystemd/sd-netlink/netlink-socket.c
@@ -16,10 +16,6 @@
#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,
diff --git a/units/systemd-networkd.socket b/units/systemd-networkd.socket
index 445193e8d3..bc049e5ade 100644
--- a/units/systemd-networkd.socket
+++ b/units/systemd-networkd.socket
@@ -17,7 +17,7 @@ Before=sockets.target
[Socket]
ReceiveBuffer=128M
ListenNetlink=route 1361
-PassCredentials=yes
+PassPacketInfo=yes
[Install]
WantedBy=sockets.target