wireshark 是如何计算这个的,它认为什么是短帧?
当 Wireshark 捕获 BoundsError 或 ScsiBoundsError 异常时,它会将帧标记为短帧。
来自epan/show_exception.c:41
proto_short = proto_register_protocol("Short Frame", "Short frame", "_ws.short");
来自epan/show_exception.c:81-104
case BoundsError:
{
gboolean display_info = TRUE;
....................................
if (display_info)
col_append_str(pinfo->cinfo, COL_INFO, "[Packet size limited during capture]");
proto_tree_add_protocol_format(tree, proto_short, tvb, 0, 0,
"[Packet size limited during capture: %s truncated]", pinfo->current_proto);
/* Don't record BoundsError exceptions as expert events - they merely
* reflect a capture done with a snapshot length too short to capture
* all of the packet
* (any case where it's caused by something else is a bug). */
}
是否与捕获期间故意截断的数据包相同?
是的,应该是。但我想说的是,可能存在细微差别,因为 Wireshark 不会像您在应用程序中那样直接计算短帧,但计数取决于可能由于某些错误而不会引发的异常。
(在这种情况下,struct pcap_pkthdr 的 caplen 字段将小于 len,即 IP 有效负载大小)。
正确。
但是,当我实现简单的应用程序(使用 libpcap)来读取 pcap 并以这种方式计数(caplen 与 len)时,我的数字略高于wireshark 报告的数字。
这可能是 Wireshark 或您的代码中的错误。您可以使用_ws.short 过滤器查看 Wireshark 中的所有短帧,然后尝试查找您的应用检测为短但 Wireshark 没有检测到的帧。
Wireshark 版本 2.2.6,捕获包含 TLS,即通过 TCP
您的版本有点过时了。最新版本是3.2.1,因此请考虑升级或至少测试两个版本。