socket-util: make socket_set_recvpktinfo control PACKET_AUXDATA sockopt on AF_PACKET

Just for the sake of completness.
This commit is contained in:
Lennart Poettering 2020-10-26 16:19:24 +01:00
parent c758bea722
commit 2d6d4136cd
2 changed files with 8 additions and 4 deletions

View file

@ -697,10 +697,11 @@
<varlistentry>
<term><varname>PassPacketInfo=</varname></term>
<listitem><para>Takes a boolean value. This controls the <constant>IP_PKTINFO</constant>,
<constant>IPV6_RECVPKTINFO</constant> and <constant>NETLINK_PKTINFO</constant> socket options, which
enable reception of additional per-packet metadata as ancillary message, on
<constant>AF_INET</constant>, <constant>AF_INET6</constant> and <constant>AF_UNIX</constant> sockets.
Defaults to <option>false</option>.</para></listitem>
<constant>IPV6_RECVPKTINFO</constant>, <constant>NETLINK_PKTINFO</constant> or
<constant>PACKET_AUXDATA</constant> socket options, which enable reception of additional per-packet
metadata as ancillary message, on <constant>AF_INET</constant>, <constant>AF_INET6</constant>,
<constant>AF_UNIX</constant> and <constant>AF_PACKET</constant> sockets. Defaults to
<option>false</option>.</para></listitem>
</varlistentry>
<varlistentry>

View file

@ -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;
}