Commit 31de410
bpf: Add BPF_FIB_LOOKUP_SKIP_NEIGH for bpf_fib_lookup
The bpf_fib_lookup() also looks up the neigh table.
This was done before bpf_redirect_neigh() was added.
In the use case that does not manage the neigh table
and requires bpf_fib_lookup() to lookup a fib to
decide if it needs to redirect or not, the bpf prog can
depend only on using bpf_redirect_neigh() to lookup the
neigh. It also keeps the neigh entries fresh and connected.
This patch adds a bpf_fib_lookup flag, SKIP_NEIGH, to avoid
the double neigh lookup when the bpf prog always call
bpf_redirect_neigh() to do the neigh lookup. The params->smac
output is skipped together when SKIP_NEIGH is set because
bpf_redirect_neigh() will figure out the smac also.
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-1-martin.lau@linux.dev1 parent 49b5e77 commit 31de410
3 files changed
Lines changed: 38 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3134 | 3134 | | |
3135 | 3135 | | |
3136 | 3136 | | |
| 3137 | + | |
| 3138 | + | |
| 3139 | + | |
| 3140 | + | |
| 3141 | + | |
3137 | 3142 | | |
3138 | 3143 | | |
3139 | 3144 | | |
| |||
6750 | 6755 | | |
6751 | 6756 | | |
6752 | 6757 | | |
| 6758 | + | |
6753 | 6759 | | |
6754 | 6760 | | |
6755 | 6761 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5722 | 5722 | | |
5723 | 5723 | | |
5724 | 5724 | | |
5725 | | - | |
5726 | | - | |
5727 | | - | |
| 5725 | + | |
5728 | 5726 | | |
5729 | | - | |
5730 | | - | |
5731 | 5727 | | |
5732 | 5728 | | |
5733 | 5729 | | |
| |||
5838 | 5834 | | |
5839 | 5835 | | |
5840 | 5836 | | |
5841 | | - | |
5842 | | - | |
5843 | | - | |
5844 | 5837 | | |
5845 | 5838 | | |
5846 | 5839 | | |
5847 | 5840 | | |
5848 | 5841 | | |
5849 | | - | |
5850 | 5842 | | |
5851 | 5843 | | |
| 5844 | + | |
| 5845 | + | |
| 5846 | + | |
| 5847 | + | |
| 5848 | + | |
| 5849 | + | |
| 5850 | + | |
| 5851 | + | |
| 5852 | + | |
5852 | 5853 | | |
5853 | 5854 | | |
| 5855 | + | |
| 5856 | + | |
5854 | 5857 | | |
5855 | | - | |
| 5858 | + | |
| 5859 | + | |
5856 | 5860 | | |
5857 | 5861 | | |
5858 | 5862 | | |
| |||
5960 | 5964 | | |
5961 | 5965 | | |
5962 | 5966 | | |
| 5967 | + | |
| 5968 | + | |
| 5969 | + | |
5963 | 5970 | | |
5964 | 5971 | | |
5965 | 5972 | | |
5966 | 5973 | | |
5967 | 5974 | | |
5968 | 5975 | | |
| 5976 | + | |
| 5977 | + | |
5969 | 5978 | | |
5970 | | - | |
| 5979 | + | |
| 5980 | + | |
5971 | 5981 | | |
5972 | 5982 | | |
5973 | 5983 | | |
| 5984 | + | |
| 5985 | + | |
| 5986 | + | |
5974 | 5987 | | |
5975 | 5988 | | |
5976 | 5989 | | |
5977 | 5990 | | |
5978 | 5991 | | |
5979 | 5992 | | |
5980 | | - | |
| 5993 | + | |
5981 | 5994 | | |
5982 | 5995 | | |
5983 | 5996 | | |
| |||
6015 | 6028 | | |
6016 | 6029 | | |
6017 | 6030 | | |
6018 | | - | |
| 6031 | + | |
6019 | 6032 | | |
6020 | 6033 | | |
6021 | 6034 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3134 | 3134 | | |
3135 | 3135 | | |
3136 | 3136 | | |
| 3137 | + | |
| 3138 | + | |
| 3139 | + | |
| 3140 | + | |
| 3141 | + | |
3137 | 3142 | | |
3138 | 3143 | | |
3139 | 3144 | | |
| |||
6750 | 6755 | | |
6751 | 6756 | | |
6752 | 6757 | | |
| 6758 | + | |
6753 | 6759 | | |
6754 | 6760 | | |
6755 | 6761 | | |
| |||
0 commit comments