• Mike Maloney's avatar
    selftests/net: Fixes psock_fanout CBPF test case · c1f8d0f9
    Mike Maloney authored
    'psock_fanout' has been failing since commit 4d7b9dc1 ("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: 4d7b9dc1 ("tools: psock_lib: harden socket filter used by psock tests")
    Signed-off-by: 'Mike Maloney <maloneykernel@gmail.com>'
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    c1f8d0f9
psock_lib.h 4.09 KB