Skip to content

Commit

Permalink
aya: Export program modules
Browse files Browse the repository at this point in the history
This allows access to XdpLink, XdpLinkId etc... which is currently
unavailable since these modules are private

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
  • Loading branch information
dave-tucker committed May 24, 2022
1 parent c385d18 commit 89a1612
Show file tree
Hide file tree
Showing 14 changed files with 35 additions and 20 deletions.
1 change: 1 addition & 0 deletions aya/src/programs/cgroup_skb.rs
@@ -1,3 +1,4 @@
//! CGroup SKB programs.
use std::{
hash::Hash,
os::unix::prelude::{AsRawFd, RawFd},
Expand Down
1 change: 1 addition & 0 deletions aya/src/programs/cgroup_sock_addr.rs
@@ -1,3 +1,4 @@
//! CGroup Sock Addr programs.
use thiserror::Error;

use crate::generated::bpf_attach_type;
Expand Down
1 change: 1 addition & 0 deletions aya/src/programs/cgroup_sockopt.rs
@@ -1,3 +1,4 @@
//! CGroup Sock Opt programs.
use thiserror::Error;

use std::{
Expand Down
1 change: 1 addition & 0 deletions aya/src/programs/cgroup_sysctl.rs
@@ -1,3 +1,4 @@
//! CGroup Sysctl programs.
use std::{
hash::Hash,
os::unix::prelude::{AsRawFd, RawFd},
Expand Down
1 change: 1 addition & 0 deletions aya/src/programs/extension.rs
@@ -1,3 +1,4 @@
//! Extension programs.
use std::os::unix::prelude::{AsRawFd, RawFd};
use thiserror::Error;

Expand Down
1 change: 1 addition & 0 deletions aya/src/programs/lirc_mode2.rs
@@ -1,3 +1,4 @@
//! Lirc programs
use std::os::unix::prelude::{AsRawFd, RawFd};

use crate::{
Expand Down
40 changes: 20 additions & 20 deletions aya/src/programs/mod.rs
Expand Up @@ -36,31 +36,31 @@
//! [`Bpf::program`]: crate::Bpf::program
//! [`Bpf::program_mut`]: crate::Bpf::program_mut
//! [`maps`]: crate::maps
mod cgroup_skb;
mod cgroup_sock_addr;
mod cgroup_sockopt;
mod cgroup_sysctl;
mod extension;
mod fentry;
mod fexit;
mod kprobe;
pub mod cgroup_skb;
pub mod cgroup_sock_addr;
pub mod cgroup_sockopt;
pub mod cgroup_sysctl;
pub mod extension;
pub mod fentry;
pub mod fexit;
pub mod kprobe;
mod links;
mod lirc_mode2;
mod lsm;
mod perf_attach;
pub mod lirc_mode2;
pub mod lsm;
pub mod perf_attach;
pub mod perf_event;
mod probe;
mod raw_trace_point;
mod sk_msg;
mod sk_skb;
mod sock_ops;
mod socket_filter;
pub mod raw_trace_point;
pub mod sk_msg;
pub mod sk_skb;
pub mod sock_ops;
pub mod socket_filter;
pub mod tc;
mod tp_btf;
mod trace_point;
mod uprobe;
pub mod tp_btf;
pub mod trace_point;
pub mod uprobe;
mod utils;
mod xdp;
pub mod xdp;

use libc::ENOSPC;
use std::{
Expand Down
3 changes: 3 additions & 0 deletions aya/src/programs/perf_attach.rs
@@ -1,3 +1,4 @@
//! Perf Attach Links
use libc::close;
use std::os::unix::io::RawFd;

Expand All @@ -7,9 +8,11 @@ use crate::{
PERF_EVENT_IOC_DISABLE, PERF_EVENT_IOC_ENABLE, PERF_EVENT_IOC_SET_BPF,
};

/// PerfLinkId is the identifer of a PerfLink
#[derive(Debug, Hash, Eq, PartialEq)]
pub struct PerfLinkId(RawFd);

/// PerfLink is the attachment type of PerfEvent programs
#[derive(Debug)]
pub struct PerfLink {
perf_fd: RawFd,
Expand Down
1 change: 1 addition & 0 deletions aya/src/programs/sk_msg.rs
@@ -1,3 +1,4 @@
//! SkMsg program.
use crate::{
generated::{bpf_attach_type::BPF_SK_MSG_VERDICT, bpf_prog_type::BPF_PROG_TYPE_SK_MSG},
maps::sock::SocketMap,
Expand Down
1 change: 1 addition & 0 deletions aya/src/programs/sk_skb.rs
@@ -1,3 +1,4 @@
//! SkSkb program.
use crate::{
generated::{
bpf_attach_type::{BPF_SK_SKB_STREAM_PARSER, BPF_SK_SKB_STREAM_VERDICT},
Expand Down
1 change: 1 addition & 0 deletions aya/src/programs/sock_ops.rs
@@ -1,3 +1,4 @@
//! Sock Ops Program.
use std::os::unix::io::AsRawFd;

use crate::{
Expand Down
1 change: 1 addition & 0 deletions aya/src/programs/socket_filter.rs
@@ -1,3 +1,4 @@
//! Socket Filter program.
use libc::{setsockopt, SOL_SOCKET};
use std::{
io, mem,
Expand Down
1 change: 1 addition & 0 deletions aya/src/programs/trace_point.rs
@@ -1,3 +1,4 @@
//! Tracepoint programs.
use std::{fs, io};
use thiserror::Error;

Expand Down
1 change: 1 addition & 0 deletions aya/src/programs/xdp.rs
@@ -1,3 +1,4 @@
//! eXpress Data Path (XDP) programs.
use bitflags;
use libc::if_nametoindex;
use std::{ffi::CString, hash::Hash, io, os::unix::io::RawFd};
Expand Down

0 comments on commit 89a1612

Please sign in to comment.