1 parent
5da4e2e498
commit
f5231200d8
5 files changed
+608
No files matched your search
@@ -0,0 +1,32 @@
|
||||
#ifndef BRIDGE_XDP_H
|
||||
#define BRIDGE_XDP_H
|
||||
|
||||
#include <linux/bpf.h>
|
||||
#include <linux/if_ether.h>
|
||||
#include <linux/ip.h>
|
||||
#include <linux/tcp.h>
|
||||
#include <bpf/bpf_helpers.h>
|
||||
|
||||
struct bpf_map_def {
|
||||
unsigned int type;
|
||||
unsigned int key_size;
|
||||
unsigned int value_size;
|
||||
unsigned int max_entries;
|
||||
unsigned int map_flags;
|
||||
};
|
||||
|
||||
// Estrutura para estatísticas
|
||||
struct packet_stats {
|
||||
__u64 packets;
|
||||
__u64 bytes;
|
||||
};
|
||||
|
||||
// Mapa para armazenar estatísticas
|
||||
struct bpf_map_def SEC("maps") stats_map = {
|
||||
.type = BPF_MAP_TYPE_PERCPU_ARRAY,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(struct packet_stats),
|
||||
.max_entries = 1,
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user