Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at master 44 lines 817 B view raw
1// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause 2#include <linux/bpf.h> 3#include <bpf/bpf_helpers.h> 4#include <bpf/bpf_endian.h> 5 6char _license[] SEC("license") = "GPL"; 7 8int ifindex; 9int ret; 10 11SEC("lwt_xmit") 12int redirect_ingress(struct __sk_buff *skb) 13{ 14 ret = bpf_clone_redirect(skb, ifindex, BPF_F_INGRESS); 15 return 0; 16} 17 18SEC("lwt_xmit") 19int redirect_egress(struct __sk_buff *skb) 20{ 21 ret = bpf_clone_redirect(skb, ifindex, 0); 22 return 0; 23} 24 25SEC("tc") 26int tc_redirect_ingress(struct __sk_buff *skb) 27{ 28 ret = bpf_clone_redirect(skb, ifindex, BPF_F_INGRESS); 29 return 0; 30} 31 32SEC("tc") 33int tc_redirect_egress(struct __sk_buff *skb) 34{ 35 ret = bpf_clone_redirect(skb, ifindex, 0); 36 return 0; 37} 38 39SEC("tc") 40int tc_adjust_room(struct __sk_buff *skb) 41{ 42 ret = bpf_skb_adjust_room(skb, 4, BPF_ADJ_ROOM_NET, 0); 43 return 0; 44}