简体   繁体   English

BPF筛选器字符串在路由器上不起作用

[英]BPF filter string not working on router

I am using a filter string to catch only the probe-request frames from my wifi router working in monitor/Promisc mode . 我正在使用过滤器字符串来仅捕获来自以monitor/Promisc mode工作的wifi路由器的探测请求帧。

the same string ie "type mgt subtype probe-req" is working when i am running my code on a laptop but on my linksys WRT54g its giving error that 当我在笔记本电脑上运行我的代码,但在我的linksys WRT54g上,相同的字符串(即"type mgt subtype probe-req"正在工作

cannot pcap_compile() function is not working.

To be more explanatory, I am using OpenWRT White Russian 0.9 firmware on my router and its equivalent SDK to build package for it. 为了进一步说明,我在路由器及其等效的SDK上使用OpenWRT White Russian 0.9固件为其构建软件包。 The program uses Libpcap library to capture raw packets from the network. 该程序使用Libpcap库捕获来自网络的原始数据包。

So I want to know that is there any change in the string format while working on embedded devices like a router. 因此,我想知道在像路由器这样的嵌入式设备上工作时,字符串格式是否有任何变化。 If yes can you suggest me where I can find the documentation for it. 如果可以,您可以建议我在哪里可以找到它的文档。 If no that what's wrong I am doing. 如果没有,那我在做什么错。

The filter strings that are allowed depend on: 允许的过滤器字符串取决于:

  • the version of libpcap/WinPcap in use; 使用的libpcap / WinPcap版本;
  • the link-layer header type being captured on the device. 设备上捕获的链路层头类型。

That particular filter would be allowed if libpcap 1.0 or later is being used and if the adapter is supplying packets with 802.11 headers. 如果正在使用libpcap 1.0或更高版本,并且适配器正在提供带有802.11标头的数据包,则将允许该特定过滤器。 Note that, on most OSes, an 802.11 adapter will supply packets with 802.11 headers only if the adapter is running in monitor mode; 请注意,在大多数操作系统上, 当适配器在监视器模式下运行时,802.11适配器才会提供带有802.11标头的数据包。 otherwise, it'll supply packets with Ethernet headers, and will only supply data frames, not management or control frames. 否则,它将提供带有以太网头的数据包,并且仅提供数据帧,而不提供管理或控制帧。

The program uses Libpcap library to capture raw packets from the network. 该程序使用Libpcap库捕获来自网络的原始数据包。

Whatever the program is, it should be doing a better job of reporting errors from pcap_compile() . 无论程序是什么,它都应该在报告pcap_compile()错误方面pcap_compile() It should include, in the error message, the text returned by pcap_geterr() when pcap_geterr() is handed the pcap_t * that you passed to pcap_compile() ; 在错误消息中,当将pcap_geterr()传递给您传递给pcap_compile()pcap_t *时,应在错误消息中包含pcap_geterr()返回的文本; that way, you will know more information about why the error occurred, and therefore will know more information about what you need to do to fix it. 这样,您将了解有关错误发生原因的更多信息,因此将了解有关解决此问题所需的更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM