mirror of
https://github.com/xdp-project/bpf-examples.git
synced 2024-05-06 15:54:53 +00:00
Add an example to filter looping packets on (for instance) a bond interface, by recording the egress MAC+VLAN and dropping any packets that come in on other (related) interfaces with the same MAC+VLAN. Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
20 lines
317 B
C
20 lines
317 B
C
#ifndef __PKT_LOOP_FILTER_H__
|
|
#define __PKT_LOOP_FILTER_H__
|
|
|
|
#define NS_PER_SEC 1000000000ULL
|
|
#define STATE_LIFETIME (10 * NS_PER_SEC)
|
|
|
|
struct pkt_loop_key {
|
|
__u8 src_mac[6];
|
|
__u16 src_vlan;
|
|
};
|
|
|
|
struct pkt_loop_data {
|
|
__u64 expiry_time;
|
|
__u32 ifindex;
|
|
__u32 drops;
|
|
|
|
};
|
|
|
|
#endif
|