gpt4 book ai didi

c - 如何在 pcap 中捕获数据包,并跳过以太网 header

转载 作者:可可西里 更新时间:2023-11-01 02:54:17 25 4
gpt4 key购买 nike

我正在使用fp = pcap_open_dead(DLT_EN10MB,65535); 以 pcap 格式捕获帧。但是 fp = pcap_open_dead(**DLT_XXX** ) 我应该使用如果我想跳过以太网头。我的模块在第 3 层工作,所以我想从第 3 层开始捕获数据包。

fp = pcap_open_dead(DLT_EN10MB,65535);
if (NULL == fp)
{
FPA_ERROR_PRINT("unable to open the dead interface \n");
return 1;

我们将不胜感激对此的任何帮助。

提前致谢。

最佳答案

我认为你做不到。解析数据包缓冲区时需要手动跳过以太网头部分。

关于c - 如何在 pcap 中捕获数据包,并跳过以太网 header ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31157387/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com