Skip to content

Commit

Permalink
tmp use folder
Browse files Browse the repository at this point in the history
  • Loading branch information
astoycos committed Nov 3, 2022
1 parent f75c48e commit 8bdf053
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 7 deletions.
7 changes: 1 addition & 6 deletions bpf/xdp_udp.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ static __always_inline __u16 udp_checksum(struct iphdr *ip, struct udphdr * udp,

// So we can overflow a bit make this __u32
__u32 csum_total = 0;
__u16 csum;
__u16 *buf = (void *)udp;

csum_total += (__u16)ip->saddr;
Expand Down Expand Up @@ -86,11 +85,7 @@ static __always_inline __u16 udp_checksum(struct iphdr *ip, struct udphdr * udp,
csum_total += (*(__u8 *)buf);
}

// Add any cksum overflow back into __u16
csum = (__u16)csum_total + (__u16)(csum_total >> 16);

csum = ~csum;
return csum;
return csum_fold_helper(csum_total);
}

struct backend {
Expand Down
Binary file modified userspace-go/bpf_bpfeb.o
Binary file not shown.
Binary file modified userspace-go/bpf_bpfel.o
Binary file not shown.
Binary file modified userspace-go/userspace-go
Binary file not shown.
2 changes: 1 addition & 1 deletion userspace-go/xdp_udp.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func main() {
Shwaddr: hwaddr2bytes("06:56:87:ec:fd:1f"),
// Container-Side Veth Mac
Dhwaddr: hwaddr2bytes("86:ad:33:29:ff:5e"),
Nocksum: 1,
Nocksum: 0,
Ifindex: 8,
}

Expand Down

0 comments on commit 8bdf053

Please sign in to comment.