]> git.baikalelectronics.ru Git - kernel.git/commit
ipv4: accept u8 in IP_TOS ancillary data
authorEric Dumazet <edumazet@google.com>
Thu, 8 Sep 2016 04:52:56 +0000 (21:52 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 9 Sep 2016 00:45:57 +0000 (17:45 -0700)
commit81a0986d1046ba868d1d389ea34b28e7cddf9f70
tree59fb73c7597f6a72969991254145dc5ca1a4817d
parentd4f8a0313b098bc70ea419b6b9d3db86d24cda92
ipv4: accept u8 in IP_TOS ancillary data

In commit 96dff8701acc ("ipv4: IP_TOS and IP_TTL can be specified as
ancillary data") Francesco added IP_TOS values specified as integer.

However, kernel sends to userspace (at recvmsg() time) an IP_TOS value
in a single byte, when IP_RECVTOS is set on the socket.

It can be very useful to reflect all ancillary options as given by the
kernel in a subsequent sendmsg(), instead of aborting the sendmsg() with
EINVAL after Francesco patch.

So this patch extends IP_TOS ancillary to accept an u8, so that an UDP
server can simply reuse same ancillary block without having to mangle
it.

Jesper can then augment
https://github.com/netoptimizer/network-testing/blob/master/src/udp_example02.c
to add TOS reflection ;)

Fixes: 96dff8701acc ("ipv4: IP_TOS and IP_TTL can be specified as ancillary data")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Francesco Fusco <ffusco@redhat.com>
Cc: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/ip_sockglue.c