Commit 67f3ea8
bpf_fib_lookup: optionally skip neighbour lookup
The bpf_fib_lookup() helper performs a neighbour lookup for the destination
IP and returns BPF_FIB_LKUP_NO_NEIGH if this fails, with the expectation
that the BPF program will pass the packet up the stack in this case.
However, with the addition of bpf_redirect_neigh() that can be used instead
to perform the neighbour lookup, at the cost of a bit of duplicated work.
For that we still need the target ifindex, and since bpf_fib_lookup()
already has that at the time it performs the neighbour lookup, there is
really no reason why it can't just return it in any case. So let's just
always return the ifindex, and also add a flag that lets the caller turn
off the neighbour lookup entirely in bpf_fib_lookup().
v2:
- Add flag (Daniel)
- Remove misleading code example from commit message (David)
Cc: David Ahern <dsahern@gmail.com>
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>1 parent 624f270 commit 67f3ea8
3 files changed
+24
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4813 | 4813 | | |
4814 | 4814 | | |
4815 | 4815 | | |
4816 | | - | |
4817 | | - | |
| 4816 | + | |
| 4817 | + | |
| 4818 | + | |
4818 | 4819 | | |
4819 | 4820 | | |
4820 | | - | |
4821 | | - | |
| 4821 | + | |
| 4822 | + | |
| 4823 | + | |
4822 | 4824 | | |
4823 | 4825 | | |
4824 | 4826 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5196 | 5196 | | |
5197 | 5197 | | |
5198 | 5198 | | |
5199 | | - | |
5200 | 5199 | | |
5201 | 5200 | | |
5202 | 5201 | | |
| |||
5293 | 5292 | | |
5294 | 5293 | | |
5295 | 5294 | | |
| 5295 | + | |
| 5296 | + | |
| 5297 | + | |
| 5298 | + | |
5296 | 5299 | | |
5297 | 5300 | | |
5298 | 5301 | | |
| |||
5418 | 5421 | | |
5419 | 5422 | | |
5420 | 5423 | | |
| 5424 | + | |
| 5425 | + | |
| 5426 | + | |
| 5427 | + | |
5421 | 5428 | | |
5422 | 5429 | | |
5423 | 5430 | | |
| |||
5436 | 5443 | | |
5437 | 5444 | | |
5438 | 5445 | | |
5439 | | - | |
| 5446 | + | |
| 5447 | + | |
5440 | 5448 | | |
5441 | 5449 | | |
5442 | 5450 | | |
| |||
5473 | 5481 | | |
5474 | 5482 | | |
5475 | 5483 | | |
5476 | | - | |
| 5484 | + | |
| 5485 | + | |
5477 | 5486 | | |
5478 | 5487 | | |
5479 | 5488 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4813 | 4813 | | |
4814 | 4814 | | |
4815 | 4815 | | |
4816 | | - | |
4817 | | - | |
| 4816 | + | |
| 4817 | + | |
| 4818 | + | |
4818 | 4819 | | |
4819 | 4820 | | |
4820 | | - | |
4821 | | - | |
| 4821 | + | |
| 4822 | + | |
| 4823 | + | |
4822 | 4824 | | |
4823 | 4825 | | |
4824 | 4826 | | |
| |||
0 commit comments