github.com/inspektor-gadget/inspektor-gadget@v0.28.1/pkg/tchandler/bpf/dispatcher.bpf.c (about) 1 // SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR Apache-2.0 2 /* Copyright (c) 2024 The Inspektor Gadget authors */ 3 4 #include <linux/bpf.h> 5 #include <bpf/bpf_helpers.h> 6 #include <linux/pkt_cls.h> 7 8 const volatile __u32 current_netns = 0; 9 10 // Keep in sync with dispatcherMapSpec in tracer.go 11 struct { 12 __uint(type, BPF_MAP_TYPE_PROG_ARRAY); 13 __type(key, __u32); 14 __type(value, __u32); 15 __uint(max_entries, 1); 16 } gadget_tail_call SEC(".maps"); 17 18 SEC("classifier/dispatcher") 19 int ig_net_disp(struct __sk_buff *skb) 20 { 21 skb->cb[0] = current_netns; 22 bpf_tail_call(skb, &gadget_tail_call, 0); 23 return TC_ACT_UNSPEC; // Use the default action configured from tc. 24 } 25 26 char _license[] SEC("license") = "GPL";