]> git.baikalelectronics.ru Git - kernel.git/commit
selftests/net: Fixes psock_fanout CBPF test case
authorMike Maloney <maloney@google.com>
Tue, 18 Apr 2017 15:14:16 +0000 (11:14 -0400)
committerDavid S. Miller <davem@davemloft.net>
Thu, 20 Apr 2017 19:39:19 +0000 (15:39 -0400)
commit78acc470c8b0704b09594c2ff70b286cb2e109bf
tree71f19fe662ccc3a778346ffd4c3b43c291ca0ac0
parenta19a7acc04bb28c331a009d2b50966e801d0ca47
selftests/net: Fixes psock_fanout CBPF test case

'psock_fanout' has been failing since commit 6182bd13b62a7 ("tools:
psock_lib: harden socket filter used by psock tests").  That commit
changed the CBPF filter to examine the full ethernet frame, and was
tested on 'psock_tpacket' which uses SOCK_RAW.  But 'psock_fanout' was
also using this same CBPF in two places, for filtering and fanout, on a
SOCK_DGRAM socket.

Change 'psock_fanout' to use SOCK_RAW so that the CBPF program used with
SO_ATTACH_FILTER can examine the entire frame.  Create a new CBPF
program for use with PACKET_FANOUT_DATA which ignores the header, as it
cannot see the ethernet header.

Tested: Ran tools/testing/selftests/net/psock_{fanout,tpacket} 10 times,
and they all passed.

Fixes: 6182bd13b62a7 ("tools: psock_lib: harden socket filter used by psock tests")
Signed-off-by: 'Mike Maloney <maloneykernel@gmail.com>'
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/testing/selftests/net/psock_fanout.c
tools/testing/selftests/net/psock_lib.h