Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

integration-test: Use veth pair instead of lo #915

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions aya-obj/include/linux_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <linux/pkt_cls.h>
#include <linux/pkt_sched.h>
#include <linux/rtnetlink.h>
#include <linux/veth.h>

/* workaround the fact that bindgen can't parse the IOC macros */
int AYA_PERF_EVENT_IOC_ENABLE = PERF_EVENT_IOC_ENABLE;
Expand Down
19 changes: 19 additions & 0 deletions aya-obj/src/generated/linux_bindings_aarch64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2384,6 +2384,15 @@ pub const __TCA_BPF_MAX: _bindgen_ty_152 = 12;
pub type _bindgen_ty_152 = ::core::ffi::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ifaddrmsg {
pub ifa_family: __u8,
pub ifa_prefixlen: __u8,
pub ifa_flags: __u8,
pub ifa_scope: __u8,
pub ifa_index: __u32,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ifinfomsg {
pub ifi_family: ::core::ffi::c_uchar,
pub __ifi_pad: ::core::ffi::c_uchar,
Expand Down Expand Up @@ -2421,6 +2430,16 @@ pub const TCA_EGRESS_BLOCK: _bindgen_ty_172 = 14;
pub const TCA_DUMP_FLAGS: _bindgen_ty_172 = 15;
pub const __TCA_MAX: _bindgen_ty_172 = 16;
pub type _bindgen_ty_172 = ::core::ffi::c_uint;
pub const VETH_INFO_UNSPEC: _bindgen_ty_175 = _bindgen_ty_175::VETH_INFO_UNSPEC;
pub const VETH_INFO_PEER: _bindgen_ty_175 = _bindgen_ty_175::VETH_INFO_PEER;
pub const __VETH_INFO_MAX: _bindgen_ty_175 = _bindgen_ty_175::__VETH_INFO_MAX;
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum _bindgen_ty_175 {
VETH_INFO_UNSPEC = 0,
VETH_INFO_PEER = 1,
__VETH_INFO_MAX = 2,
}
pub const AYA_PERF_EVENT_IOC_ENABLE: ::core::ffi::c_int = 9216;
pub const AYA_PERF_EVENT_IOC_DISABLE: ::core::ffi::c_int = 9217;
pub const AYA_PERF_EVENT_IOC_SET_BPF: ::core::ffi::c_int = 1074013192;
19 changes: 19 additions & 0 deletions aya-obj/src/generated/linux_bindings_armv7.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2384,6 +2384,15 @@ pub const __TCA_BPF_MAX: _bindgen_ty_152 = 12;
pub type _bindgen_ty_152 = ::core::ffi::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ifaddrmsg {
pub ifa_family: __u8,
pub ifa_prefixlen: __u8,
pub ifa_flags: __u8,
pub ifa_scope: __u8,
pub ifa_index: __u32,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ifinfomsg {
pub ifi_family: ::core::ffi::c_uchar,
pub __ifi_pad: ::core::ffi::c_uchar,
Expand Down Expand Up @@ -2421,6 +2430,16 @@ pub const TCA_EGRESS_BLOCK: _bindgen_ty_172 = 14;
pub const TCA_DUMP_FLAGS: _bindgen_ty_172 = 15;
pub const __TCA_MAX: _bindgen_ty_172 = 16;
pub type _bindgen_ty_172 = ::core::ffi::c_uint;
pub const VETH_INFO_UNSPEC: _bindgen_ty_175 = _bindgen_ty_175::VETH_INFO_UNSPEC;
pub const VETH_INFO_PEER: _bindgen_ty_175 = _bindgen_ty_175::VETH_INFO_PEER;
pub const __VETH_INFO_MAX: _bindgen_ty_175 = _bindgen_ty_175::__VETH_INFO_MAX;
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum _bindgen_ty_175 {
VETH_INFO_UNSPEC = 0,
VETH_INFO_PEER = 1,
__VETH_INFO_MAX = 2,
}
pub const AYA_PERF_EVENT_IOC_ENABLE: ::core::ffi::c_int = 9216;
pub const AYA_PERF_EVENT_IOC_DISABLE: ::core::ffi::c_int = 9217;
pub const AYA_PERF_EVENT_IOC_SET_BPF: ::core::ffi::c_int = 1074013192;
19 changes: 19 additions & 0 deletions aya-obj/src/generated/linux_bindings_riscv64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2384,6 +2384,15 @@ pub const __TCA_BPF_MAX: _bindgen_ty_152 = 12;
pub type _bindgen_ty_152 = ::core::ffi::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ifaddrmsg {
pub ifa_family: __u8,
pub ifa_prefixlen: __u8,
pub ifa_flags: __u8,
pub ifa_scope: __u8,
pub ifa_index: __u32,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ifinfomsg {
pub ifi_family: ::core::ffi::c_uchar,
pub __ifi_pad: ::core::ffi::c_uchar,
Expand Down Expand Up @@ -2421,6 +2430,16 @@ pub const TCA_EGRESS_BLOCK: _bindgen_ty_172 = 14;
pub const TCA_DUMP_FLAGS: _bindgen_ty_172 = 15;
pub const __TCA_MAX: _bindgen_ty_172 = 16;
pub type _bindgen_ty_172 = ::core::ffi::c_uint;
pub const VETH_INFO_UNSPEC: _bindgen_ty_175 = _bindgen_ty_175::VETH_INFO_UNSPEC;
pub const VETH_INFO_PEER: _bindgen_ty_175 = _bindgen_ty_175::VETH_INFO_PEER;
pub const __VETH_INFO_MAX: _bindgen_ty_175 = _bindgen_ty_175::__VETH_INFO_MAX;
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum _bindgen_ty_175 {
VETH_INFO_UNSPEC = 0,
VETH_INFO_PEER = 1,
__VETH_INFO_MAX = 2,
}
pub const AYA_PERF_EVENT_IOC_ENABLE: ::core::ffi::c_int = 9216;
pub const AYA_PERF_EVENT_IOC_DISABLE: ::core::ffi::c_int = 9217;
pub const AYA_PERF_EVENT_IOC_SET_BPF: ::core::ffi::c_int = 1074013192;
19 changes: 19 additions & 0 deletions aya-obj/src/generated/linux_bindings_x86_64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2384,6 +2384,15 @@ pub const __TCA_BPF_MAX: _bindgen_ty_152 = 12;
pub type _bindgen_ty_152 = ::core::ffi::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ifaddrmsg {
pub ifa_family: __u8,
pub ifa_prefixlen: __u8,
pub ifa_flags: __u8,
pub ifa_scope: __u8,
pub ifa_index: __u32,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ifinfomsg {
pub ifi_family: ::core::ffi::c_uchar,
pub __ifi_pad: ::core::ffi::c_uchar,
Expand Down Expand Up @@ -2421,6 +2430,16 @@ pub const TCA_EGRESS_BLOCK: _bindgen_ty_172 = 14;
pub const TCA_DUMP_FLAGS: _bindgen_ty_172 = 15;
pub const __TCA_MAX: _bindgen_ty_172 = 16;
pub type _bindgen_ty_172 = ::core::ffi::c_uint;
pub const VETH_INFO_UNSPEC: _bindgen_ty_175 = _bindgen_ty_175::VETH_INFO_UNSPEC;
pub const VETH_INFO_PEER: _bindgen_ty_175 = _bindgen_ty_175::VETH_INFO_PEER;
pub const __VETH_INFO_MAX: _bindgen_ty_175 = _bindgen_ty_175::__VETH_INFO_MAX;
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum _bindgen_ty_175 {
VETH_INFO_UNSPEC = 0,
VETH_INFO_PEER = 1,
__VETH_INFO_MAX = 2,
}
pub const AYA_PERF_EVENT_IOC_ENABLE: ::core::ffi::c_int = 9216;
pub const AYA_PERF_EVENT_IOC_DISABLE: ::core::ffi::c_int = 9217;
pub const AYA_PERF_EVENT_IOC_SET_BPF: ::core::ffi::c_int = 1074013192;
5 changes: 4 additions & 1 deletion aya/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,7 @@ pub use bpf::*;
pub use obj::btf::{Btf, BtfError};
pub use object::Endianness;
#[doc(hidden)]
pub use sys::netlink_set_link_up;
pub use sys::{
netlink_add_ip_addr, netlink_add_veth_pair, netlink_delete_link, netlink_set_link_down,
netlink_set_link_up,
};
7 changes: 5 additions & 2 deletions aya/src/sys/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ pub(crate) use bpf::*;
#[cfg(test)]
pub(crate) use fake::*;
use libc::{pid_t, SYS_bpf, SYS_perf_event_open};
#[doc(hidden)]
pub use netlink::netlink_set_link_up;
pub(crate) use netlink::*;
#[doc(hidden)]
pub use netlink::{
netlink_add_ip_addr, netlink_add_veth_pair, netlink_delete_link, netlink_set_link_down,
netlink_set_link_up,
};
pub(crate) use perf_event::*;
use thiserror::Error;

Expand Down