c - 如何找出IEEE802.11 Frame中封装的协议(protocol)?

标签 c linux network-programming raw-sockets wifi

我正在使用原始 C 在 Linux 中使用 libpcap 开发一个 IEEE802.11 帧解析器程序。我可以轻松解析 RadioTapIEEE802.11 header ,但我找不到封装在 IEEE802.11 MPDU 中的协议(protocol)名称.不幸的是,IEEE802.11 header 中没有任何字段指示封装的协议(protocol)(如 Ethernet header 中的 protocol 字段)。

有什么解决办法吗?

最佳答案

IEEE802.11数据包的数据被封装在一个LLC头中(见here):

An 802.11 frame should contain an LLC header if, and only if, it's a Data frame. The frame type and subtype are part of the Frame Control field in the MAC header; Data is one of the frame type values (the others are Control and Management). The subtype doesn't matter - all Data frames should contain an LLC header, and no other frames should.

LLC头有两种:3字节,8字节。 IEEE 802.11 使用第二种(参见 here)。其中,LLC头的最后两个字节相当于Ethernet协议(protocol)中的Ether Type字段。例如,此字段的 0x800 表示 IPv4

关于c - 如何找出IEEE802.11 Frame中封装的协议(protocol)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42834940/

相关文章:

linux - 在放弃一个进程后,我怎样才能再次读取正在运行的进程的标准输出

android - 在 Linux 平台上运行 Android 应用程序

Python3 请求不使用传入代理

java网络中断管道和接收到的文件损坏

c - 在不同的 "platforms"之间移植 C 代码

c - 将 char * 传递给结构

c - 使用回调函数报告堆栈回溯

c - _NET_WM_ICON 的图片格式

linux - Bash 脚本文件意外结束

无法找出C应用程序中的内存泄漏