郁闷的数据包接收问题

        昨天写好框架的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的协议驱动翻了个遍也没有特别提及,网络上更加没有相关消息,似乎大家都认为只要绑定网卡成功就能收到数据了。


[本日志由 Gmxp 于 2009-01-09 01:29 AM 编辑]
文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags: NDIS ProtocolDriver
评论: 4 | 引用: 0 | 查看次数: 1322
回复回复Jorenboy[2009-03-14 02:54 PM | del]
windows网络与通信那书有提及,P232

好像是这页...呵呵
引用来自 Gmxp Gmxp 回复
后来看书时发现了,看书不够仔细啊~
回复回复小妮子[2009-01-12 12:44 AM | del]
>,<! 就是應該特別標志出來嘛,不然怎麼看到嘛,我就找不到了…
引用来自 Gmxp Gmxp 回复
~
回复回复小妮子[2009-01-12 12:35 AM | del]
剛放假回家幾天,居然更新了沒有坐到沙發嗚嗚,但是學長來要讓給學長坐嘛~小妮子先搬個板凳再慢慢看文章哦~
回复回复xyzreg[2009-01-09 02:48 AM | del]
呵呵,WinPcap里就有啊
引用来自 Gmxp Gmxp 回复
以我的理解,这么重要的步骤应该特别标志出来- -
发表评论
昵 称:
密 码: 游客发言不需要密码.
内 容:
验证码: 验证码
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.
字数限制 1000 字 | UBB代码 开启 | [img]标签 关闭