Skip to content

Commit

Permalink
kern: rodata map not supported on kernel 4.19 or older
Browse files Browse the repository at this point in the history
fixes : #222

.rodata: map create: read- and write-only maps not supported

Signed-off-by: CFC4N <cfc4n.cs@gmail.com>
  • Loading branch information
cfc4n committed Sep 29, 2022
1 parent 7b1e8e5 commit dc3bbe1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions kern/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
#define ETH_P_IP 0x0800 /* Internet Protocol packet */
#define SKB_MAX_DATA_SIZE 2048

// alawyse, we used it in openssl_tc.h
const volatile u32 target_port = 443;

// Optional Target PID
// .rodata section bug via : https://github.com/ehids/ecapture/issues/39
#ifndef KERNEL_LESS_5_2
// alawyse, we used it in openssl_tc.h
const volatile u32 target_port = 443;
// Optional Target PID
const volatile u64 target_pid = 0;
const volatile u64 target_uid = 0;
const volatile int target_errno = BASH_ERRNO_DEFAULT;
Expand Down
3 changes: 2 additions & 1 deletion kern/openssl_tc.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,12 @@ int capture_packets(struct __sk_buff *skb, bool is_ingress) {
}
struct tcphdr *tcp = (struct tcphdr *)(data_start + l4_hdr_off);

#ifndef KERNEL_LESS_5_2
if (tcp->source != bpf_htons(target_port) &&
tcp->dest != bpf_htons(target_port)) {
return TC_ACT_OK;
}

#endif
// debug_bpf_printk("capture_packets port : %d, dest port :%d\n",
// bpf_ntohs(tcp->source), bpf_ntohs(tcp->dest));
// get the skb data event
Expand Down

0 comments on commit dc3bbe1

Please sign in to comment.