Skip to content

Commit

Permalink
Update response.c
Browse files Browse the repository at this point in the history
  • Loading branch information
thebsdbox authored Sep 6, 2024
1 parent 81b8a9c commit e5a8eb6
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions eBPF/response/ebpf/response.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <bpf/bpf_endian.h>
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_tracing.h>
#include <string.h>

#pragma pack(1)

Expand Down Expand Up @@ -102,8 +101,8 @@ static inline int swap_udp(struct __sk_buff *skb) {
/* We'll store the mac addresses (L2) */
__u8 src_mac[ETH_ALEN];
__u8 dst_mac[ETH_ALEN];
memcpy(src_mac, eth->h_source, ETH_ALEN);
memcpy(dst_mac, eth->h_dest, ETH_ALEN);
__builtin_memcpy(src_mac, eth->h_source, ETH_ALEN);
__builtin_memcpy(dst_mac, eth->h_dest, ETH_ALEN);

/* ip addresses (L3) */
__be32 src_ip = iph->saddr;
Expand Down Expand Up @@ -161,4 +160,4 @@ SEC("tc_in")
int tc_ingress(struct __sk_buff *skb) { return swap_udp(skb); }

SEC("tc_egress")
int tc_egress_(struct __sk_buff *skb) { return swap_udp(skb); }
int tc_egress_(struct __sk_buff *skb) { return swap_udp(skb); }

0 comments on commit e5a8eb6

Please sign in to comment.