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
#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;
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,
[Socket]
ReceiveBuffer=128M
ListenNetlink=route 1361
-PassCredentials=yes
+PassPacketInfo=yes
[Install]
WantedBy=sockets.target