From 2d6d4136cdad5cde1f7fa8b54e427383645ab5fe Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 26 Oct 2020 16:19:24 +0100 Subject: [PATCH] socket-util: make socket_set_recvpktinfo control PACKET_AUXDATA sockopt on AF_PACKET Just for the sake of completness. --- man/systemd.socket.xml | 9 +++++---- src/basic/socket-util.c | 3 +++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/man/systemd.socket.xml b/man/systemd.socket.xml index a1e4284763b..8ec662c3acb 100644 --- a/man/systemd.socket.xml +++ b/man/systemd.socket.xml @@ -697,10 +697,11 @@ PassPacketInfo= Takes a boolean value. This controls the IP_PKTINFO, - IPV6_RECVPKTINFO and NETLINK_PKTINFO socket options, which - enable reception of additional per-packet metadata as ancillary message, on - AF_INET, AF_INET6 and AF_UNIX sockets. - Defaults to . + IPV6_RECVPKTINFO, NETLINK_PKTINFO or + PACKET_AUXDATA socket options, which enable reception of additional per-packet + metadata as ancillary message, on AF_INET, AF_INET6, + AF_UNIX and AF_PACKET sockets. Defaults to + . diff --git a/src/basic/socket-util.c b/src/basic/socket-util.c index f2e1148e874..6f57b2a3c4c 100644 --- a/src/basic/socket-util.c +++ b/src/basic/socket-util.c @@ -1240,6 +1240,9 @@ int socket_set_recvpktinfo(int fd, int af, bool b) { case AF_NETLINK: return setsockopt_int(fd, SOL_NETLINK, NETLINK_PKTINFO, b); + case AF_PACKET: + return setsockopt_int(fd, SOL_PACKET, PACKET_AUXDATA, b); + default: return -EAFNOSUPPORT; } -- 2.47.3