Skip to content

Commit

Permalink
Merge pull request #251 from aya-rs/codegen
Browse files Browse the repository at this point in the history
Update libbpf to 3a4e26307d0f9b227e3ebd28b443a1a715e4e17d
  • Loading branch information
dave-tucker committed May 4, 2022
2 parents b039ac5 + d6ca3e1 commit e1f448e
Show file tree
Hide file tree
Showing 12 changed files with 1,069 additions and 307 deletions.
254 changes: 198 additions & 56 deletions aya/src/generated/linux_bindings_aarch64.rs

Large diffs are not rendered by default.

254 changes: 198 additions & 56 deletions aya/src/generated/linux_bindings_armv7.rs

Large diffs are not rendered by default.

254 changes: 198 additions & 56 deletions aya/src/generated/linux_bindings_x86_64.rs

Large diffs are not rendered by default.

110 changes: 64 additions & 46 deletions bpf/aya-bpf-bindings/src/aarch64/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ pub const BPF_F_ANY_ALIGNMENT: u32 = 2;
pub const BPF_F_TEST_RND_HI32: u32 = 4;
pub const BPF_F_TEST_STATE_FREQ: u32 = 8;
pub const BPF_F_SLEEPABLE: u32 = 16;
pub const BPF_F_XDP_HAS_FRAGS: u32 = 32;
pub const BPF_F_KPROBE_MULTI_RETURN: u32 = 1;
pub const BPF_PSEUDO_MAP_FD: u32 = 1;
pub const BPF_PSEUDO_MAP_IDX: u32 = 5;
pub const BPF_PSEUDO_MAP_VALUE: u32 = 2;
Expand All @@ -156,6 +158,7 @@ pub const BPF_PSEUDO_CALL: u32 = 1;
pub const BPF_PSEUDO_KFUNC_CALL: u32 = 2;
pub const BPF_F_QUERY_EFFECTIVE: u32 = 1;
pub const BPF_F_TEST_RUN_ON_CPU: u32 = 1;
pub const BPF_F_TEST_XDP_LIVE_FRAMES: u32 = 2;
pub const BPF_BUILD_ID_SIZE: u32 = 20;
pub const BPF_OBJ_NAME_LEN: u32 = 16;
pub const BPF_TAG_SIZE: u32 = 8;
Expand Down Expand Up @@ -397,6 +400,11 @@ pub type _bindgen_ty_23 = ::aya_bpf_cty::c_uint;
pub const BPF_F_BROADCAST: ::aya_bpf_cty::c_uint = 8;
pub const BPF_F_EXCLUDE_INGRESS: ::aya_bpf_cty::c_uint = 16;
pub type _bindgen_ty_24 = ::aya_bpf_cty::c_uint;
pub mod _bindgen_ty_25 {
pub type Type = ::aya_bpf_cty::c_uint;
pub const BPF_SKB_TSTAMP_UNSPEC: Type = 0;
pub const BPF_SKB_TSTAMP_DELIVERY_MONO: Type = 1;
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct __sk_buff {
Expand Down Expand Up @@ -432,8 +440,9 @@ pub struct __sk_buff {
pub gso_segs: __u32,
pub __bindgen_anon_2: __sk_buff__bindgen_ty_2,
pub gso_size: __u32,
pub tstamp_type: __u8,
pub _bitfield_align_1: [u8; 0],
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize]>,
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 3usize]>,
pub hwtstamp: __u64,
}
#[repr(C)]
Expand Down Expand Up @@ -466,8 +475,8 @@ impl __sk_buff__bindgen_ty_2 {
}
impl __sk_buff {
#[inline]
pub fn new_bitfield_1() -> __BindgenBitfieldUnit<[u8; 4usize]> {
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize]> = Default::default();
pub fn new_bitfield_1() -> __BindgenBitfieldUnit<[u8; 3usize]> {
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 3usize]> = Default::default();
__bindgen_bitfield_unit
}
}
Expand Down Expand Up @@ -503,7 +512,7 @@ pub union bpf_xfrm_state__bindgen_ty_1 {
pub remote_ipv6: [__u32; 4usize],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[derive(Copy, Clone)]
pub struct bpf_sock {
pub bound_dev_if: __u32,
pub family: __u32,
Expand All @@ -514,14 +523,23 @@ pub struct bpf_sock {
pub src_ip4: __u32,
pub src_ip6: [__u32; 4usize],
pub src_port: __u32,
pub dst_port: __u32,
pub dst_port: __be16,
pub _bitfield_align_1: [u8; 0],
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize]>,
pub dst_ip4: __u32,
pub dst_ip6: [__u32; 4usize],
pub state: __u32,
pub rx_queue_mapping: __s32,
}
impl bpf_sock {
#[inline]
pub fn new_bitfield_1() -> __BindgenBitfieldUnit<[u8; 2usize]> {
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize]> = Default::default();
__bindgen_bitfield_unit
}
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[derive(Copy, Clone)]
pub struct bpf_tcp_sock {
pub snd_cwnd: __u32,
pub srtt_us: __u32,
Expand Down Expand Up @@ -562,15 +580,15 @@ pub union bpf_sock_tuple__bindgen_ty_1 {
pub ipv6: bpf_sock_tuple__bindgen_ty_1__bindgen_ty_2,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[derive(Copy, Clone)]
pub struct bpf_sock_tuple__bindgen_ty_1__bindgen_ty_1 {
pub saddr: __be32,
pub daddr: __be32,
pub sport: __be16,
pub dport: __be16,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[derive(Copy, Clone)]
pub struct bpf_sock_tuple__bindgen_ty_1__bindgen_ty_2 {
pub saddr: [__be32; 4usize],
pub daddr: [__be32; 4usize],
Expand All @@ -586,7 +604,7 @@ pub mod xdp_action {
pub const XDP_REDIRECT: Type = 4;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[derive(Copy, Clone)]
pub struct xdp_md {
pub data: __u32,
pub data_end: __u32,
Expand Down Expand Up @@ -727,7 +745,7 @@ impl sk_reuseport_md__bindgen_ty_4 {
}
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[derive(Copy, Clone)]
pub struct bpf_map_info {
pub type_: __u32,
pub id: __u32,
Expand Down Expand Up @@ -883,7 +901,7 @@ pub const BPF_SOCK_OPS_PARSE_ALL_HDR_OPT_CB_FLAG: ::aya_bpf_cty::c_uint = 16;
pub const BPF_SOCK_OPS_PARSE_UNKNOWN_HDR_OPT_CB_FLAG: ::aya_bpf_cty::c_uint = 32;
pub const BPF_SOCK_OPS_WRITE_HDR_OPT_CB_FLAG: ::aya_bpf_cty::c_uint = 64;
pub const BPF_SOCK_OPS_ALL_CB_FLAGS: ::aya_bpf_cty::c_uint = 127;
pub type _bindgen_ty_25 = ::aya_bpf_cty::c_uint;
pub type _bindgen_ty_26 = ::aya_bpf_cty::c_uint;
pub const BPF_SOCK_OPS_VOID: ::aya_bpf_cty::c_uint = 0;
pub const BPF_SOCK_OPS_TIMEOUT_INIT: ::aya_bpf_cty::c_uint = 1;
pub const BPF_SOCK_OPS_RWND_INIT: ::aya_bpf_cty::c_uint = 2;
Expand All @@ -900,7 +918,7 @@ pub const BPF_SOCK_OPS_RTT_CB: ::aya_bpf_cty::c_uint = 12;
pub const BPF_SOCK_OPS_PARSE_HDR_OPT_CB: ::aya_bpf_cty::c_uint = 13;
pub const BPF_SOCK_OPS_HDR_OPT_LEN_CB: ::aya_bpf_cty::c_uint = 14;
pub const BPF_SOCK_OPS_WRITE_HDR_OPT_CB: ::aya_bpf_cty::c_uint = 15;
pub type _bindgen_ty_26 = ::aya_bpf_cty::c_uint;
pub type _bindgen_ty_27 = ::aya_bpf_cty::c_uint;
pub const BPF_TCP_ESTABLISHED: ::aya_bpf_cty::c_uint = 1;
pub const BPF_TCP_SYN_SENT: ::aya_bpf_cty::c_uint = 2;
pub const BPF_TCP_SYN_RECV: ::aya_bpf_cty::c_uint = 3;
Expand All @@ -914,18 +932,18 @@ pub const BPF_TCP_LISTEN: ::aya_bpf_cty::c_uint = 10;
pub const BPF_TCP_CLOSING: ::aya_bpf_cty::c_uint = 11;
pub const BPF_TCP_NEW_SYN_RECV: ::aya_bpf_cty::c_uint = 12;
pub const BPF_TCP_MAX_STATES: ::aya_bpf_cty::c_uint = 13;
pub type _bindgen_ty_27 = ::aya_bpf_cty::c_uint;
pub mod _bindgen_ty_29 {
pub type _bindgen_ty_28 = ::aya_bpf_cty::c_uint;
pub mod _bindgen_ty_30 {
pub type Type = ::aya_bpf_cty::c_uint;
pub const BPF_LOAD_HDR_OPT_TCP_SYN: Type = 1;
}
pub mod _bindgen_ty_30 {
pub mod _bindgen_ty_31 {
pub type Type = ::aya_bpf_cty::c_uint;
pub const BPF_WRITE_HDR_TCP_CURRENT_MSS: Type = 1;
pub const BPF_WRITE_HDR_TCP_SYNACK_COOKIE: Type = 2;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[derive(Copy, Clone)]
pub struct bpf_perf_event_value {
pub counter: __u64,
pub enabled: __u64,
Expand All @@ -934,13 +952,13 @@ pub struct bpf_perf_event_value {
pub const BPF_DEVCG_ACC_MKNOD: ::aya_bpf_cty::c_uint = 1;
pub const BPF_DEVCG_ACC_READ: ::aya_bpf_cty::c_uint = 2;
pub const BPF_DEVCG_ACC_WRITE: ::aya_bpf_cty::c_uint = 4;
pub type _bindgen_ty_31 = ::aya_bpf_cty::c_uint;
pub type _bindgen_ty_32 = ::aya_bpf_cty::c_uint;
pub const BPF_DEVCG_DEV_BLOCK: ::aya_bpf_cty::c_uint = 1;
pub const BPF_DEVCG_DEV_CHAR: ::aya_bpf_cty::c_uint = 2;
pub type _bindgen_ty_32 = ::aya_bpf_cty::c_uint;
pub type _bindgen_ty_33 = ::aya_bpf_cty::c_uint;
pub const BPF_FIB_LOOKUP_DIRECT: ::aya_bpf_cty::c_uint = 1;
pub const BPF_FIB_LOOKUP_OUTPUT: ::aya_bpf_cty::c_uint = 2;
pub type _bindgen_ty_33 = ::aya_bpf_cty::c_uint;
pub type _bindgen_ty_34 = ::aya_bpf_cty::c_uint;
pub const BPF_FIB_LKUP_RET_SUCCESS: ::aya_bpf_cty::c_uint = 0;
pub const BPF_FIB_LKUP_RET_BLACKHOLE: ::aya_bpf_cty::c_uint = 1;
pub const BPF_FIB_LKUP_RET_UNREACHABLE: ::aya_bpf_cty::c_uint = 2;
Expand All @@ -950,7 +968,7 @@ pub const BPF_FIB_LKUP_RET_FWD_DISABLED: ::aya_bpf_cty::c_uint = 5;
pub const BPF_FIB_LKUP_RET_UNSUPP_LWT: ::aya_bpf_cty::c_uint = 6;
pub const BPF_FIB_LKUP_RET_NO_NEIGH: ::aya_bpf_cty::c_uint = 7;
pub const BPF_FIB_LKUP_RET_FRAG_NEEDED: ::aya_bpf_cty::c_uint = 8;
pub type _bindgen_ty_34 = ::aya_bpf_cty::c_uint;
pub type _bindgen_ty_35 = ::aya_bpf_cty::c_uint;
#[repr(C)]
#[derive(Copy, Clone)]
pub struct bpf_fib_lookup {
Expand Down Expand Up @@ -1008,7 +1026,7 @@ pub union bpf_redir_neigh__bindgen_ty_1 {
pub const BPF_FLOW_DISSECTOR_F_PARSE_1ST_FRAG: ::aya_bpf_cty::c_uint = 1;
pub const BPF_FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL: ::aya_bpf_cty::c_uint = 2;
pub const BPF_FLOW_DISSECTOR_F_STOP_AT_ENCAP: ::aya_bpf_cty::c_uint = 4;
pub type _bindgen_ty_35 = ::aya_bpf_cty::c_uint;
pub type _bindgen_ty_36 = ::aya_bpf_cty::c_uint;
#[repr(C)]
#[derive(Copy, Clone)]
pub struct bpf_flow_keys {
Expand All @@ -1033,25 +1051,25 @@ pub union bpf_flow_keys__bindgen_ty_1 {
pub __bindgen_anon_2: bpf_flow_keys__bindgen_ty_1__bindgen_ty_2,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[derive(Copy, Clone)]
pub struct bpf_flow_keys__bindgen_ty_1__bindgen_ty_1 {
pub ipv4_src: __be32,
pub ipv4_dst: __be32,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[derive(Copy, Clone)]
pub struct bpf_flow_keys__bindgen_ty_1__bindgen_ty_2 {
pub ipv6_src: [__u32; 4usize],
pub ipv6_dst: [__u32; 4usize],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[derive(Copy, Clone)]
pub struct bpf_spin_lock {
pub val: __u32,
}
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
#[derive(Copy, Clone)]
pub struct bpf_timer {
pub _bitfield_align_1: [u8; 0],
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 16usize]>,
Expand All @@ -1064,26 +1082,26 @@ impl bpf_timer {
}
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[derive(Copy, Clone)]
pub struct bpf_sysctl {
pub write: __u32,
pub file_pos: __u32,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[derive(Copy, Clone)]
pub struct bpf_pidns_info {
pub pid: __u32,
pub tgid: __u32,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[derive(Copy, Clone)]
pub struct btf_ptr {
pub ptr: *mut ::aya_bpf_cty::c_void,
pub type_id: __u32,
pub flags: __u32,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[derive(Copy, Clone)]
pub struct user_pt_regs {
pub regs: [__u64; 31usize],
pub sp: __u64,
Expand All @@ -1092,88 +1110,88 @@ pub struct user_pt_regs {
}
pub type sa_family_t = ::aya_bpf_cty::c_ushort;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[derive(Copy, Clone)]
pub struct sockaddr {
pub sa_family: sa_family_t,
pub sa_data: [::aya_bpf_cty::c_char; 14usize],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[derive(Copy, Clone)]
pub struct bpf_perf_event_data {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[derive(Copy, Clone)]
pub struct linux_binprm {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[derive(Copy, Clone)]
pub struct pt_regs {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[derive(Copy, Clone)]
pub struct tcphdr {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[derive(Copy, Clone)]
pub struct seq_file {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[derive(Copy, Clone)]
pub struct tcp6_sock {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[derive(Copy, Clone)]
pub struct tcp_sock {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[derive(Copy, Clone)]
pub struct tcp_timewait_sock {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[derive(Copy, Clone)]
pub struct tcp_request_sock {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[derive(Copy, Clone)]
pub struct udp6_sock {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[derive(Copy, Clone)]
pub struct unix_sock {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[derive(Copy, Clone)]
pub struct task_struct {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[derive(Copy, Clone)]
pub struct path {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[derive(Copy, Clone)]
pub struct inode {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[derive(Copy, Clone)]
pub struct socket {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[derive(Copy, Clone)]
pub struct file {
_unused: [u8; 0],
}
5 changes: 4 additions & 1 deletion bpf/aya-bpf-bindings/src/aarch64/getters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ impl __sk_buff {
pub fn gso_size(&self) -> Option<__u32> {
unsafe { crate::bpf_probe_read(&self.gso_size) }.ok()
}
pub fn tstamp_type(&self) -> Option<__u8> {
unsafe { crate::bpf_probe_read(&self.tstamp_type) }.ok()
}
pub fn hwtstamp(&self) -> Option<__u64> {
unsafe { crate::bpf_probe_read(&self.hwtstamp) }.ok()
}
Expand Down Expand Up @@ -218,7 +221,7 @@ impl bpf_sock {
pub fn src_port(&self) -> Option<__u32> {
unsafe { crate::bpf_probe_read(&self.src_port) }.ok()
}
pub fn dst_port(&self) -> Option<__u32> {
pub fn dst_port(&self) -> Option<__be16> {
unsafe { crate::bpf_probe_read(&self.dst_port) }.ok()
}
pub fn dst_ip4(&self) -> Option<__u32> {
Expand Down

0 comments on commit e1f448e

Please sign in to comment.