nftables 学得有点懵

2 月 7 日
 cxxnullptr

多个相同 hook ,一个 accept ,后面的还执行吗?

chatgpt 和 grok 说 accept 就终结了,gemini 说还能继续执行

chatgpt 回答

grok 回答

gemini 回答

规则 1 ,不同优先级

table inet A {
  chain input {
    type filter hook input priority 0;
    tcp dport 22 accept
  }
}


table inet B {
  chain input {
    type filter hook input priority 10;
    tcp dport 22 drop
  }
} 

规则 2 ,相同优先级

table inet A {
  chain input {
    type filter hook input priority 0;
    tcp dport 22 accept
  }
}


table inet B {
  chain input {
    type filter hook input priority 0;
    tcp dport 22 drop
  }
}
2896 次点击
所在节点    程序员
9 条回复
slowman
2 月 7 日
nftables 文档怎么说
KagurazakaNyaa
2 月 7 日
EchoWhale
2 月 7 日
不再执行当前 chain 的其他规则,但会执行其他 chain 的规则。

NOTE: If a packet is accepted and there is another chain, bearing the same hook type and with a later priority, then the packet will subsequently traverse this other chain. Hence, an accept verdict - be it by way of a rule or the default chain policy - isn't necessarily final. However, the same is not true of packets that are subjected to a drop verdict. Instead, drops take immediate effect, with no further rules or chains being evaluated.

https://wiki.nftables.org/wiki-nftables/index.php/Configuring_chains
june4
2 月 7 日
以前学 nft 对这个语法是真恶心,一串中间没有任何符合分隔,鬼才的发明
cxxnullptr
2 月 7 日
@KagurazakaNyaa @EchoWhale

感谢两位,是不是 gemini 的回答是对的
cxxnullptr
2 月 7 日
@june4 确实,docker 还给生成的一大坨,看得发懵
pagxir
2 月 7 日
@june4 很是赞同,从来就没有过这么难用的 cli 了
yougg
2 月 8 日
加上 counter 发个请求看看就知道了
zsj1029
2 月 9 日
这些非人的东西,才是 AI 的场景

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1191385

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX