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.
Showing the changes to include/uapi (1 of 3 files). Show all
Unified · Split
| @@ -55,6 +55,7 @@ struct sockaddr_ll { · 54 unmodified lines | |||
| 55 | #define PACKET_TX_HAS_OFF 19 | 55 | #define PACKET_TX_HAS_OFF 19 |
| 56 | #define PACKET_QDISC_BYPASS 20 | 56 | #define PACKET_QDISC_BYPASS 20 |
| 57 | #define PACKET_ROLLOVER_STATS 21 | 57 | #define PACKET_ROLLOVER_STATS 21 |
| 58 | #define PACKET_FANOUT_DATA 22 | ||
| 58 | 59 | ||
| 59 | #define PACKET_FANOUT_HASH 0 | 60 | #define PACKET_FANOUT_HASH 0 |
| 60 | #define PACKET_FANOUT_LB 1 | 61 | #define PACKET_FANOUT_LB 1 |
| @@ -62,6 +63,7 @@ struct sockaddr_ll { · 1 unmodified line | |||
| 62 | #define PACKET_FANOUT_ROLLOVER 3 | 63 | #define PACKET_FANOUT_ROLLOVER 3 |
| 63 | #define PACKET_FANOUT_RND 4 | 64 | #define PACKET_FANOUT_RND 4 |
| 64 | #define PACKET_FANOUT_QM 5 | 65 | #define PACKET_FANOUT_QM 5 |
| 66 | #define PACKET_FANOUT_CBPF 6 | ||
| 65 | #define PACKET_FANOUT_FLAG_ROLLOVER 0x1000 | 67 | #define PACKET_FANOUT_FLAG_ROLLOVER 0x1000 |
| 66 | #define PACKET_FANOUT_FLAG_DEFRAG 0x8000 | 68 | #define PACKET_FANOUT_FLAG_DEFRAG 0x8000 |
| 67 | 69 | ||