1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/tools/testing/selftests/bpf/progs/fib_lookup.c
Martin KaFai Lau c0338e609e selftests/bpf: Remove bpf_tracing_net.h usages from two networking tests
This patch removes the bpf_tracing_net.h usage from the networking tests,
fib_lookup and test_lwt_redirect. Instead of using the (copied) macro
TC_ACT_SHOT and ETH_HLEN from bpf_tracing_net.h, they can directly
use the ones defined in the network header files under linux/.

Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Link: https://lore.kernel.org/r/20240509175026.3423614-2-martin.lau@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2024-05-09 11:13:11 -07:00

22 lines
496 B
C

// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2023 Meta Platforms, Inc. and affiliates. */
#include <linux/types.h>
#include <linux/bpf.h>
#include <linux/pkt_cls.h>
#include <bpf/bpf_helpers.h>
struct bpf_fib_lookup fib_params = {};
int fib_lookup_ret = 0;
int lookup_flags = 0;
SEC("tc")
int fib_lookup(struct __sk_buff *skb)
{
fib_lookup_ret = bpf_fib_lookup(skb, &fib_params, sizeof(fib_params),
lookup_flags);
return TC_ACT_SHOT;
}
char _license[] SEC("license") = "GPL";