单链中BPF过滤器之间的确切关系是什么

What is the exact relationship between BPF filters in a single chain

我有一个网络接口 $dev,它已经有一个 BPF 过滤器附加到一个特殊的 qdisc ingress(pref 1 和直接操作)。我添加了另一个(pref 2)。 tc filter show dev $dev ingress 报告如下:

filter protocol all pref 1 bpf chain 0 
filter protocol all pref 1 bpf chain 0 handle 0x1 some.o:[some-section] direct-action \
  not_in_hw id ... tag ... jited 
filter protocol all pref 2 bpf chain 1 
filter protocol all pref 2 bpf chain 1 handle 0x1 other.o:[other-section] \
  not_in_hw id ... tag ... jited

在这种情况下,链式过滤器之间的关系是什么:次要过滤器(即我的)是否总是看到与第一个相同的流量,还是取决于第一个返回的内容,尤其是。鉴于它使用直接作用?我怀疑第二个是真的,但我还不确定。

链中第二个 BPF 程序看到的内容 取决于第一个 returns。您可以在 cls_bpf_classify().

中阅读该逻辑