WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
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
11 changes: 0 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -161,17 +161,6 @@ config.json
#output file
.vscode/
/node_modules
docker-compose.yaml
admission-webhook-with-cert.yaml
proxy-injector-with-cert.yaml
kafka.rs
node-debugger.yaml
notes.txt
dev-notes.txt
skbuff.rs
admission-webhook.yaml
certificate-manager.yaml
client-deployment.yaml

# Claude AI assistant working files
CLAUDE.md
Expand Down
111,665 changes: 0 additions & 111,665 deletions core/src/components/conntracker/src/bindings.rs

This file was deleted.

46 changes: 41 additions & 5 deletions core/src/components/conntracker/src/data_structures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@ use aya_ebpf::{
maps::{LruPerCpuHashMap, PerfEventArray,HashMap},
};

// docs:
// PacketLog structure used to track an incoming network packet
//
// proto: packet protol (ex. TCP,UDP,ICMP)
// src_ip: source address ip
// src_port: source address port
// dst_ip: destination ip
// dst_port: destination port
// pid: kernel process ID
//


#[repr(C)]
#[derive(Clone, Copy)]
pub struct PacketLog {
Expand All @@ -11,10 +23,10 @@ pub struct PacketLog {
pub src_port: u16,
pub dst_ip: u32,
pub dst_port: u16,
pub pid: u32
pub pid: u32,
}

// This structure is only for active connections
// This structure is only for active connections (TODO: investigate if this is really useful)
#[repr(C)]
#[derive(Clone, Copy)]
pub struct ConnArray {
Expand All @@ -25,26 +37,50 @@ pub struct ConnArray {
pub proto: u8,
}


// docs:
// VethLog structure used to track virtual ethernet interfaces creation and deletion
//
// name: veth name
// state: socket state
// dev_addr: veth device addresses
// event_type: creation or deletion
// netns: veth network namespace
// pid: kernel process ID
//

#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct VethLog {
pub name: [u8; 16],
pub state: u64, //state var type: long unsigned int
pub state: u64, // state var type: long unsigned int
pub dev_addr: [u32; 8],
pub event_type: u8, //i choose 1 for veth creation or 2 for veth destruction
pub event_type: u8, // i choose 1 for veth creation or 2 for veth destruction
pub netns: u32,
pub pid: u32

}

// docs:
//
// BPF maps used in the conntracker programs
//
// VETH_EVENTS: PerfEventArray used in the veth_tracer functions (veth_tracer.rs module)
//
// BLOCKLIST: an hashmap used to block addresses -----> TODO: key and values are the same for semplicity but we need to
// investigate the possibility to save the service name or the timestamp registered when the command was executed or a simple int index
//


#[map(name = "EventsMap", pinning = "by_name")]
pub static mut EVENTS: PerfEventArray<PacketLog> = PerfEventArray::new(0);

//TODO: ConnectionMap needs a rework after implementing issue #105
// FIXME: this might be useless
#[map(name = "ConnectionMap")]
pub static mut ACTIVE_CONNECTIONS: LruPerCpuHashMap<u16, ConnArray> =
LruPerCpuHashMap::with_max_entries(65536, 0);

// FIXME: this might be useless
#[map(name = "ConnectionTrackerMap")]
pub static mut CONNTRACKER: LruPerCpuHashMap<ConnArray, u8> =
LruPerCpuHashMap::with_max_entries(65536, 0);
Expand Down
Loading