Fixed the whole header setup, now correctly using the kernel headers instead of normal development ones. Ready to go on with original plan of file system hooking

This commit is contained in:
h3xduck
2022-01-06 13:31:52 -05:00
parent 4882ce790c
commit 193d9ec28f
16 changed files with 128072 additions and 50 deletions

View File

@@ -1,7 +1,8 @@
#ifndef __XDP_HELPER_H__
#define __XDP_HELPER_H__
#include <linux/types.h>
//#include <linux/types.h>
#include "newnewvmlinux.h"
#include <bpf/bpf_helpers.h>
@@ -84,7 +85,7 @@ static __always_inline struct expand_return expand_tcp_packet_payload(struct xdp
//We modify the fields we care about of the headers
bpf_printk("before: %i, checksum %u\n", ret.ip->tot_len, ret.ip->check);
ret.ip->tot_len = htons(ntohs(ret.ip->tot_len) + more_bytes);
ret.ip->tot_len = bpf_htons(bpf_ntohs(ret.ip->tot_len) + more_bytes);
__u32 csum = 0;
ret.ip->check = 0;
ipv4_csum(ret.ip, sizeof(struct iphdr), &csum);