File: empty_skb.c

package info (click to toggle)
linux 6.16.6-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,724,504 kB
  • sloc: ansic: 26,560,901; asm: 271,339; sh: 144,033; python: 72,469; makefile: 57,129; perl: 36,821; xml: 19,553; cpp: 5,820; yacc: 4,915; lex: 2,955; awk: 1,667; sed: 28; ruby: 25
file content (37 lines) | stat: -rw-r--r-- 692 bytes parent folder | download | duplicates (20)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
#include <linux/bpf.h>
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_endian.h>

char _license[] SEC("license") = "GPL";

int ifindex;
int ret;

SEC("lwt_xmit")
int redirect_ingress(struct __sk_buff *skb)
{
	ret = bpf_clone_redirect(skb, ifindex, BPF_F_INGRESS);
	return 0;
}

SEC("lwt_xmit")
int redirect_egress(struct __sk_buff *skb)
{
	ret = bpf_clone_redirect(skb, ifindex, 0);
	return 0;
}

SEC("tc")
int tc_redirect_ingress(struct __sk_buff *skb)
{
	ret = bpf_clone_redirect(skb, ifindex, BPF_F_INGRESS);
	return 0;
}

SEC("tc")
int tc_redirect_egress(struct __sk_buff *skb)
{
	ret = bpf_clone_redirect(skb, ifindex, 0);
	return 0;
}