add protocol field

This commit is contained in:
Sahilb315
2026-07-24 22:40:35 +05:30
parent 3e1ece3257
commit da6e10d2ad
7 changed files with 76 additions and 81 deletions
+2
View File
@@ -10,6 +10,7 @@ struct event {
__u32 uid;
__u32 daddr;
__u16 dport;
__u8 proto;
__u8 comm[16]; // command
};
@@ -30,6 +31,7 @@ int connect4(struct bpf_sock_addr *ctx) {
e->uid = bpf_get_current_uid_gid();
e->daddr = ctx->user_ip4;
e->dport = bpf_ntohs(ctx->user_port);
e-> proto = ctx->protocol;
bpf_get_current_comm(&e->comm, sizeof(e->comm));
bpf_ringbuf_submit(e, 0);