]> git.ipfire.org Git - thirdparty/systemd.git/commit
netlink: port to recvmsg_safe()
authorLennart Poettering <lennart@poettering.net>
Thu, 23 Apr 2020 17:47:38 +0000 (19:47 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 12 May 2020 08:47:06 +0000 (10:47 +0200)
commit9e45fb09bfbbf79b340b3303f810834b33cde109
tree1cf4663ea50783dfe1f06de06ef116b901196c75
parentd423294394a411a3fe98884993f9c1686edffb1b
netlink: port to recvmsg_safe()

This also makes sure the control buffer is properly aligned. This
matters, as otherwise the control buffer might not be aligned and the
cmsg buffer counting might be off. The incorrect alignment is becoming
visible by using recvmsg_safe() as we suddenly notice the MSG_CTRUNC bit
set because of this.

That said, apparently this isn't enough to make this work on all
kernels. Since I couldn't figure this out, we now add 1K to the buffer
to be sure. We do this once already, also for a pktinfo structure
(though an IPv4/IPv6) one. I am puzzled by this, but this shouldn't
matter much. it works locally just fine, except for those ubuntu CI
kernels...

While we are at it, make some other changes too, to simplify and
modernize the function.
src/libsystemd/sd-netlink/netlink-socket.c
src/resolve/resolved-manager.h