Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kern: rodata map not supported on kernel 4.19 or older #223

Merged
merged 1 commit into from
Sep 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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