aya_obj/programs/sk_reuseport.rs
1//! `BPF_PROG_TYPE_SK_REUSEPORT` program bindings.
2
3use crate::generated::bpf_attach_type;
4
5/// Attach types for `BPF_PROG_TYPE_SK_REUSEPORT` programs.
6#[derive(Clone, Copy, Debug)]
7pub enum SkReuseportAttachType {
8 /// Select a socket for a new packet or connection.
9 Select,
10 /// Select a socket for a new packet or connection, or migrate an
11 /// in-flight request to another listener in the reuseport group.
12 SelectOrMigrate,
13}
14
15impl From<SkReuseportAttachType> for bpf_attach_type {
16 fn from(value: SkReuseportAttachType) -> Self {
17 match value {
18 SkReuseportAttachType::Select => Self::BPF_SK_REUSEPORT_SELECT,
19 SkReuseportAttachType::SelectOrMigrate => Self::BPF_SK_REUSEPORT_SELECT_OR_MIGRATE,
20 }
21 }
22}