Skip to content

Commit

Permalink
Misc changes
Browse files Browse the repository at this point in the history
  • Loading branch information
hack3ric committed Mar 30, 2024
1 parent 49d43b5 commit 787a1b7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/bpf/mimic.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ extern struct mimic_settings_map {

extern struct mimic_rb_map {
__uint(type, BPF_MAP_TYPE_RINGBUF);
__uint(max_entries, sizeof(struct rb_item) * 32);
__uint(max_entries, 1 << 12);
} mimic_rb;

#define IPV4_CSUM_OFF (offsetof(struct iphdr, check))
Expand Down
4 changes: 2 additions & 2 deletions src/shared/checksum.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ static inline void update_csum_ul_neg(__u32* csum, __u32 new) {

#else

__u16 calc_csum(void* data, size_t data_len) {
__u32 calc_csum(void* data, size_t data_len) {
__u32 result = 0;
for (int i = 0; i < data_len / 2; i++) {
result += ntohs(*((__u16*)data + i));
}
if (data_len % 2 == 1) {
result += (__u16)((__u8*)data)[data_len - 1] << 8;
}
return csum_fold(result);
return result;
}

#endif // _MIMIC_BPF
Expand Down
2 changes: 1 addition & 1 deletion src/shared/misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ struct rb_item {
struct log_event log_event;
struct send_options send_options;
struct {
struct conn_tuple conn;
struct conn_tuple conn_key;
bool l4_csum_partial;
} store_packet;
};
Expand Down

0 comments on commit 787a1b7

Please sign in to comment.