This patch tests the bpf_fib_lookup helper when looking up a neigh in NUD_FAILED and NUD_STALE state. It also adds test for the new BPF_FIB_LOOKUP_SKIP_NEIGH flag. Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20230217205515.3583372-2-martin.lau@linux.dev
23 lines
498 B
C
23 lines
498 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 <bpf/bpf_helpers.h>
|
|
#include "bpf_tracing_net.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";
|