packet: add classic BPF fanout mode
authorWillem de Bruijn <willemb@google.com>
Sat, 15 Aug 2015 02:31:34 +0000 (22:31 -0400)
committerDavid S. Miller <davem@davemloft.net>
Mon, 17 Aug 2015 21:22:47 +0000 (14:22 -0700)
commit47dceb8ecdc1c3ad1818dfea3d659a05b74c3fc2
tree6329539935535b2b5ed438612464e168b02f03ce
parenta1c234f95cae2d293047bb6c36e7a4840dbac815
packet: add classic BPF fanout mode

Add fanout mode PACKET_FANOUT_CBPF that accepts a classic BPF program
to select a socket.

This avoids having to keep adding special case fanout modes. One
example use case is application layer load balancing. The QUIC
protocol, for instance, encodes a connection ID in UDP payload.

Also add socket option SOL_PACKET/PACKET_FANOUT_DATA that updates data
associated with the socket group. Fanout mode PACKET_FANOUT_CBPF is the
only user so far.

Signed-off-by: Willem de Bruijn <willemb@google.com>
Acked-by: Alexei Starovoitov <ast@plumgrid.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/uapi/linux/if_packet.h
net/packet/af_packet.c
net/packet/internal.h