1 // SPDX-License-Identifier: GPL-2.0 2 3 #include <linux/bpf.h> 4 #include <bpf/bpf_helpers.h> 5 #include <linux/if_ether.h> 6 #include <linux/ip.h> 7 8 /* Dummy prog to test TC-BPF API */ 9 10 SEC("tc") 11 int cls(struct __sk_buff *skb) 12 { 13 return 0; 14 } 15 16 /* Prog to verify tc-bpf without cap_sys_admin and cap_perfmon */ 17 SEC("tcx/ingress") 18 int pkt_ptr(struct __sk_buff *skb) 19 { 20 struct iphdr *iph = (void *)(long)skb->data + sizeof(struct ethhdr); 21 22 if ((long)(iph + 1) > (long)skb->data_end) 23 return 1; 24 return 0; 25 } 26