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>
This commit is contained in:

committed by
David S. Miller

parent
a1c234f95c
commit
47dceb8ecd
@@ -79,7 +79,10 @@ struct packet_fanout {
|
||||
u16 id;
|
||||
u8 type;
|
||||
u8 flags;
|
||||
atomic_t rr_cur;
|
||||
union {
|
||||
atomic_t rr_cur;
|
||||
struct bpf_prog __rcu *bpf_prog;
|
||||
};
|
||||
struct list_head list;
|
||||
struct sock *arr[PACKET_FANOUT_MAX];
|
||||
spinlock_t lock;
|
||||
|
Reference in New Issue
Block a user