xref: /linux/tools/testing/selftests/bpf/progs/fib_lookup.c (revision af8e51644a70f612974a6e767fa7d896d3c23f88)
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2023 Meta Platforms, Inc. and affiliates. */
3 
4 #include <linux/types.h>
5 #include <linux/bpf.h>
6 #include <linux/pkt_cls.h>
7 #include <bpf/bpf_helpers.h>
8 
9 struct bpf_fib_lookup fib_params = {};
10 int fib_lookup_ret = 0;
11 int lookup_flags = 0;
12 
13 SEC("tc")
14 int fib_lookup(struct __sk_buff *skb)
15 {
16 	fib_lookup_ret = bpf_fib_lookup(skb, &fib_params, sizeof(fib_params),
17 					lookup_flags);
18 
19 	return TC_ACT_SHOT;
20 }
21 
22 char _license[] SEC("license") = "GPL";
23