"less than" 的 Wireshark 过滤器不起作用

Wireshark filter with "less than" doesn't work

我想创建一个 Wireshark 过滤器来显示所有数据包

我尝试使用以下过滤器:

dtls || (udp.port >= 1234 && upd.port <= 1250)

然而,Wireshark 显示所有类型的数据包,例如从52795端口到53端口的DNS数据包,完全超出了UDP过滤部分的范围,不是DTLS数据包。

我错过了什么,正确的过滤表达式是什么?

这是一个常见的错误。 udp.port 可以被认为是 udp.srcport or udp.dstport 的一种宏,意味着只要其中一个大于 1234 或小于 1250,所写的过滤器将匹配数据包.我想你想要的是:

dtls || ((udp.srcport >= 1234 && udp.srcport <= 1250) || (udp.dstport >= 1234 && udp.dstport <= 1250))

您可能想要创建一个 Wireshark Display Filter Macro 来帮助简化该表达式。例如,假设您创建了以下宏:

((udp.srcport >=  and udp.srcport <= ) or (udp.dstport >=  and udp.dstport <= ))

那么你可以应用这个过滤器:

dtls || ${udp_portrange:1234;1250}