Skip to content
This repository has been archived by the owner on Apr 28, 2024. It is now read-only.

Commit

Permalink
Fixed icmp next hop mtu is unsigned short so refactored ringbuff even…
Browse files Browse the repository at this point in the history
…t to repurpose event->sport
  • Loading branch information
r-caamano committed Jan 9, 2024
1 parent 1aaf41a commit 60995e5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/zfw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1782,8 +1782,9 @@ static int process_events(void *ctx, void *data, size_t len){
__u8 inner_ttl = evt->dest[0];
__u8 outer_ttl = evt->source[0];
if(code == 4){
/*evt->sport is use repurposed store next hop mtu*/
sprintf(message, "%s : %s : %s : %s :%s --> reported next hop mtu:%d > FRAGMENTATION NEEDED IN PATH TO:%s:%d\n", ts, ifname,
(evt->direction == INGRESS) ? "INGRESS" : "EGRESS", protocol,saddr, ntohs(evt->source[1]), daddr, ntohs(evt->dport));
(evt->direction == INGRESS) ? "INGRESS" : "EGRESS", protocol,saddr, ntohs(evt->sport), daddr, ntohs(evt->dport));
if(logging){
res = write_log(log_file_name, message);
}else{
Expand Down
3 changes: 1 addition & 2 deletions src/zfw_tc_ingress.c
Original file line number Diff line number Diff line change
Expand Up @@ -756,8 +756,7 @@ int bpf_sk_splice(struct __sk_buff *skb){
event.daddr = o_session->ipv4.daddr;
event.tracking_code = icmph->code;
if(icmph->code == 4){
event.source[1] = icmph->un.frag.mtu;
}
event.sport = icmph->un.frag.mtu;
event.dport = o_session->ipv4.dport;
send_event(&event);
bpf_sk_release(sk);
Expand Down

0 comments on commit 60995e5

Please sign in to comment.