History

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.

Willem de Bruijn committed 11 years ago

Commit 47dceb81 parent a1c234f3 files · +104 −2Browse files

Showing the changes to include/uapi (1 of 3 files). Show all

Unified · Split

include/uapi/linux/if_packet.h+2−0
@@ -55,6 +55,7 @@ struct sockaddr_ll { · 54 unmodified lines
55#define PACKET_TX_HAS_OFF 1955#define PACKET_TX_HAS_OFF 19
56#define PACKET_QDISC_BYPASS 2056#define PACKET_QDISC_BYPASS 20
57#define PACKET_ROLLOVER_STATS 2157#define PACKET_ROLLOVER_STATS 21
58#define PACKET_FANOUT_DATA 22
58 59
59#define PACKET_FANOUT_HASH 060#define PACKET_FANOUT_HASH 0
60#define PACKET_FANOUT_LB 161#define PACKET_FANOUT_LB 1
@@ -62,6 +63,7 @@ struct sockaddr_ll { · 1 unmodified line
62#define PACKET_FANOUT_ROLLOVER 363#define PACKET_FANOUT_ROLLOVER 3
63#define PACKET_FANOUT_RND 464#define PACKET_FANOUT_RND 4
64#define PACKET_FANOUT_QM 565#define PACKET_FANOUT_QM 5
66#define PACKET_FANOUT_CBPF 6
65#define PACKET_FANOUT_FLAG_ROLLOVER 0x100067#define PACKET_FANOUT_FLAG_ROLLOVER 0x1000
66#define PACKET_FANOUT_FLAG_DEFRAG 0x800068#define PACKET_FANOUT_FLAG_DEFRAG 0x8000
67 69