郁闷的数据包接收问题
作者:Gmxp 日期:2009-01-09
昨天写好框架的NDIS协议驱动,不管我怎么处理,就是死活收不到下层网卡的数据包。
这个东东折磨了我整整一天,让人郁闷的是这个问题本来不应该是问题的。下面贴出相关DDK的文档,标记一下,更希望遇到和我同样的朋友早点解脱。囧。
引用内容
Restrictions on Indicating Receive Packets
A connectionless miniport driver must not indicate a receive packet to a protocol driver while the miniport driver’s packet filter for that protocol driver is set to zero. When a miniport driver’s MiniportInitialize function is called, the miniport driver’s packet filter should be set to zero. When the packet filter is zero, receive indications are disabled. After a miniport driver’s MiniportInitialize function has returned, a protocol driver can set OID_GEN_CURRENT_PACKET_FILTER to a nonzero value, thereby enabling the miniport driver to indicate receive packets to that protocol.
......
A driver’s Protocol(Co)ReceivePacket or ProtocolReceive function can be called as soon as the protocol sets up a packet filter with OID_GEN_CURRENT_PACKET_FILTER for the binding. For the NULL filter, receive indications are enabled on return from a successful call to NdisOpenAdapter.
翻译成中文,大概就是在绑定完下层网卡后,必须向它发送一个OID_GEN_CURRENT_PACKET_FILTER的Request来指定要接收的数据包的类型,而不发送Request的话,默认是不接收任何数据包。自己向下层网卡正确发送完Request后,就可以收到你想要的数据包了。
让人很郁闷的是,对于协议驱动这么重要的步骤,DDK中仅仅在一个“很角落”的地方提到,而我正在看的网络驱动的那本书更是只字不提,把WinPcap的协议驱动翻了个遍也没有特别提及,网络上更加没有相关消息,似乎大家都认为只要绑定网卡成功就能收到数据了。
这个东东折磨了我整整一天,让人郁闷的是这个问题本来不应该是问题的。下面贴出相关DDK的文档,标记一下,更希望遇到和我同样的朋友早点解脱。囧。
引用内容Restrictions on Indicating Receive Packets
A connectionless miniport driver must not indicate a receive packet to a protocol driver while the miniport driver’s packet filter for that protocol driver is set to zero. When a miniport driver’s MiniportInitialize function is called, the miniport driver’s packet filter should be set to zero. When the packet filter is zero, receive indications are disabled. After a miniport driver’s MiniportInitialize function has returned, a protocol driver can set OID_GEN_CURRENT_PACKET_FILTER to a nonzero value, thereby enabling the miniport driver to indicate receive packets to that protocol.
......
A driver’s Protocol(Co)ReceivePacket or ProtocolReceive function can be called as soon as the protocol sets up a packet filter with OID_GEN_CURRENT_PACKET_FILTER for the binding. For the NULL filter, receive indications are enabled on return from a successful call to NdisOpenAdapter.
翻译成中文,大概就是在绑定完下层网卡后,必须向它发送一个OID_GEN_CURRENT_PACKET_FILTER的Request来指定要接收的数据包的类型,而不发送Request的话,默认是不接收任何数据包。自己向下层网卡正确发送完Request后,就可以收到你想要的数据包了。
让人很郁闷的是,对于协议驱动这么重要的步骤,DDK中仅仅在一个“很角落”的地方提到,而我正在看的网络驱动的那本书更是只字不提,把WinPcap的协议驱动翻了个遍也没有特别提及,网络上更加没有相关消息,似乎大家都认为只要绑定网卡成功就能收到数据了。
评论: 4 | 引用: 0 | 查看次数: 1322
>,<!
就是應該特別標志出來嘛,不然怎麼看到嘛,我就找不到了…
Gmxp 回复
就是應該特別標志出來嘛,不然怎麼看到嘛,我就找不到了…~
剛放假回家幾天,居然更新了沒有坐到沙發嗚嗚,但是學長來要讓給學長坐嘛~小妮子先搬個板凳再慢慢看文章哦~ 

呵呵,WinPcap里就有啊
Gmxp 回复
以我的理解,这么重要的步骤应该特别标志出来- -
发表评论
上一篇
下一篇


文章来自:
Tags:
回复
好像是这页...呵呵