Skip to content

Commit

Permalink
adding packet_Sz and direction in structs
Browse files Browse the repository at this point in the history
  • Loading branch information
yash97 committed Oct 2, 2024
1 parent 77d9673 commit 1c15d06
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions pkg/ebpf/c/tc.v4egress.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ struct data_t {
__u32 dest_port;
__u32 protocol;
__u32 verdict;
__u32 packet_sz;
__u8 is_egress;
};

struct bpf_map_def_pvt SEC("maps") egress_map = {
Expand Down
6 changes: 4 additions & 2 deletions pkg/ebpf/c/tc.v4ingress.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ struct data_t {
__u32 dest_port;
__u32 protocol;
__u32 verdict;
__u32 packet_sz;
__u8 is_egress;
};

struct bpf_map_def_pvt SEC("maps") ingress_map = {
Expand Down Expand Up @@ -170,8 +172,8 @@ int handle_ingress(struct __sk_buff *skb)
evt.dest_ip = flow_key.dest_ip;
evt.dest_port = flow_key.dest_port;
evt.protocol = flow_key.protocol;
evt.packet_sz = skb->len
evt.is_egress = 0
evt.packet_sz = skb->len;
evt.is_egress = 0;

//Check for the reverse flow entry in the conntrack table
reverse_flow_key.src_ip = ip->daddr;
Expand Down

0 comments on commit 1c15d06

Please sign in to comment.