Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 28 additions & 28 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repository = "https://github.com/pythops/oryx"
homepage = "https://github.com/pythops/oryx"

[workspace.dependencies]
network-types = "0.1.0"
network-types = { git = "https://github.com/vadorovsky/network-types", rev = "b78424c" }

[profile.release]
lto = "fat"
Expand Down
4 changes: 2 additions & 2 deletions oryx-common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use core::mem;

use network_types::{
arp::ArpHdr, eth::EthHdr, icmp::IcmpHdr, ip::IpHdr, sctp::SctpHdr, tcp::TcpHdr, udp::UdpHdr,
arp::ArpHdr, eth::EthHdr, icmp::Icmp, ip::IpHdr, sctp::SctpHdr, tcp::TcpHdr, udp::UdpHdr,
};

pub mod protocols;
Expand Down Expand Up @@ -64,5 +64,5 @@ pub enum ProtoHdr {
Tcp(TcpHdr),
Udp(UdpHdr),
Sctp(SctpHdr),
Icmp(IcmpHdr),
Icmp(Icmp),
}
12 changes: 8 additions & 4 deletions oryx-common/src/protocols.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl TransportProtocol {

// Network Protocols

pub const NB_NETWORK_PROTOCOL: u16 = 3;
pub const NB_NETWORK_PROTOCOL: u16 = 4;

#[derive(Debug, Copy, Clone, PartialEq, AsRefStr, Display, EnumString)]
#[repr(C)]
Expand All @@ -52,15 +52,19 @@ pub enum NetworkProtocol {
Ipv6 = 1,

#[strum(ascii_case_insensitive)]
Icmp = 2,
Icmpv4 = 2,

#[strum(ascii_case_insensitive)]
Icmpv6 = 3,
}

impl NetworkProtocol {
pub fn all() -> [NetworkProtocol; 3] {
pub fn all() -> [NetworkProtocol; 4] {
[
NetworkProtocol::Ipv4,
NetworkProtocol::Ipv6,
NetworkProtocol::Icmp,
NetworkProtocol::Icmpv4,
NetworkProtocol::Icmpv6,
]
}
}
Expand Down
3 changes: 1 addition & 2 deletions oryx-ebpf/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion oryx-ebpf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ homepage = "https://github.com/pythops/oryx"
[dependencies]
aya-ebpf = "0.1.1"
oryx-common = { path = "../oryx-common" }
network-types = "0.1.0"
network-types = { git = "https://github.com/vadorovsky/network-types", rev = "b78424c" }

[[bin]]
name = "oryx"
Expand Down
14 changes: 7 additions & 7 deletions oryx-ebpf/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use core::mem;
use network_types::{
arp::ArpHdr,
eth::{EthHdr, EtherType},
icmp::IcmpHdr,
icmp::{Icmp, IcmpHdr, IcmpV6Hdr},
ip::{IpHdr, IpProto, Ipv4Hdr, Ipv6Hdr},
sctp::SctpHdr,
tcp::TcpHdr,
Expand Down Expand Up @@ -285,7 +285,7 @@ fn process(ctx: TcContext) -> Result<i32, ()> {
}
}
IpProto::Icmp => {
if filter_packet(Protocol::Network(NetworkProtocol::Icmp)) {
if filter_packet(Protocol::Network(NetworkProtocol::Icmpv4)) {
return Ok(TC_ACT_PIPE);
}
let icmp_header: *const IcmpHdr = ptr_at(&ctx, EthHdr::LEN + Ipv4Hdr::LEN)?;
Expand All @@ -296,7 +296,7 @@ fn process(ctx: TcContext) -> Result<i32, ()> {
header: *eth_header,
payload: RawPacket::Ip(
IpHdr::V4(*ipv4_header),
ProtoHdr::Icmp(*icmp_header),
ProtoHdr::Icmp(Icmp::V4(*icmp_header)),
),
},
pid,
Expand Down Expand Up @@ -421,19 +421,19 @@ fn process(ctx: TcContext) -> Result<i32, ()> {
});
}
}
IpProto::Icmp => {
if filter_packet(Protocol::Network(NetworkProtocol::Icmp)) {
IpProto::Ipv6Icmp => {
if filter_packet(Protocol::Network(NetworkProtocol::Icmpv6)) {
return Ok(TC_ACT_PIPE);
}
let icmp_header: *const IcmpHdr = ptr_at(&ctx, EthHdr::LEN + Ipv6Hdr::LEN)?;
let icmp_header: *const IcmpV6Hdr = ptr_at(&ctx, EthHdr::LEN + Ipv6Hdr::LEN)?;

unsafe {
submit(RawData {
frame: RawFrame {
header: *eth_header,
payload: RawPacket::Ip(
IpHdr::V6(*ipv6_header),
ProtoHdr::Icmp(*icmp_header),
ProtoHdr::Icmp(Icmp::V6(*icmp_header)),
),
},
pid,
Expand Down
1 change: 1 addition & 0 deletions oryx-tui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ serde_json = "1"
serde = { version = "1", features = ["derive"] }
regex = "1"
chrono = "0.4"
strum = { version = "0.27", features = ["derive"] }

[[bin]]
name = "oryx"
Expand Down
6 changes: 3 additions & 3 deletions oryx-tui/src/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::{
app::AppResult,
packet::{
AppPacket, NetworkPacket,
network::{IpPacket, IpProto},
network::{IpPacket, ip::IpProto},
},
};

Expand Down Expand Up @@ -112,7 +112,7 @@ pub fn export(packets: &[AppPacket]) -> AppResult<()> {
writeln!(
file,
"{:39} {:^11} {:39} {:^11} {:10} {:10} {:10}",
ipv4_packet.src_ip, "-", ipv4_packet.dst_ip, "-", "ICMP", pid, date
ipv4_packet.src_ip, "-", ipv4_packet.dst_ip, "-", "ICMPv4", pid, date
)?;
}
},
Expand Down Expand Up @@ -160,7 +160,7 @@ pub fn export(packets: &[AppPacket]) -> AppResult<()> {
writeln!(
file,
"{:39} {:^11} {:39} {:^11} {:10} {:10} {:10}",
ipv6_packet.src_ip, "-", ipv6_packet.dst_ip, "-", "ICMP", pid, date
ipv6_packet.src_ip, "-", ipv6_packet.dst_ip, "-", "ICMPv6", pid, date
)?;
}
},
Expand Down
Loading
Loading