blob: 1529c111f4aa42641ff2a13f3d816b3db5659e80 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
// SPDX-License-Identifier: GPL-2.0
#include "vmlinux.h"
#include <bpf/bpf_helpers.h>
int redirect_ifindex = 1;
__u64 verdict_calls = 0;
__u64 helper_calls = 0;
SEC("tc")
int qevent_redirect_verdict(struct __sk_buff *skb)
{
__sync_fetch_and_add(&verdict_calls, 1);
return TCX_REDIRECT;
}
SEC("tc")
int qevent_redirect_helper(struct __sk_buff *skb)
{
__sync_fetch_and_add(&helper_calls, 1);
return bpf_redirect(redirect_ifindex, 0);
}
char _license[] SEC("license") = "GPL";
|