When I develop a ndis protocol driver I came to a strange problem. I define ProtocolReceive
and ProtocolReceivePacket of my own protocol and I call NdisRegisterProtocol to register it. The return tatus indicate I have do it successfully. After that I bind this protocol to my
netcard interface and I believe I have bind it because I can send raw ethernet packet through
the NdisSend. However since then I could not receive any packet. It seems that the ProtocolReceive and ProtocolReceivePacket could never be called by ndis!!! Why?
DDK says ProtocolReceive is a required function that is called with a pointer to a lookahead buffer. If the underlying connectionless NIC driver calls a filter-specific NdisMXxxIndicateReceive function, NDIS always calls the ProtocolReceive function of each bound protocol driver.
My Question: How Could I Know whether my underlying connectionless NIC driver calls a filter-secific NidsMxxIndicateReceive or not?
And DDK also says When an underlying connectionless NIC driver indicates an array of one or more packet descriptors with NdisMIndicateReceivePacket, NDIS will usually call a bound protocol driver’s ProtocolReceivePacket function with each packet descriptor.
If a protocol driver is aware that it is (or might be) bound to such a NIC driver, it should have a ProtocolReceivePacket function
I have been confused by what DDK says. If there are several protocol driver installed in
my system and all of them have their own defined ProtocolReceive Handler or ProtocolReceivePacket handler. Is a received packet handled by every such handler?
If not How does ndis transfer the packet to its right place?
craiglei
“craiglei” wrote in message news:xxxxx@ntdev…
> When I develop a ndis protocol driver I came to a strange problem. I
define ProtocolReceive
> and ProtocolReceivePacket of my own protocol and I call
NdisRegisterProtocol to register it. The return tatus indicate I have do it
successfully. After that I bind this protocol to my
> netcard interface and I believe I have bind it because I can send raw
ethernet packet through
> the NdisSend. However since then I could not receive any packet. It seems
that the ProtocolReceive and ProtocolReceivePacket could never be called by
ndis!!! Why?
>
Have you set the NDIS packet filter to a non-zero value? From the DDK:
“a protocol driver can set OID_GEN_CURRENT_PACKET_FILTER to a non-zero
value, thereby enabling the miniport driver to indicate receive packets to
that protocol.”
The default value for your protocol’s NDIS packet filter is zero(0). A
setting of zero disables packet reception altogehter/ You must use the OID
to set the NDIS packet filter before any of your protocol’s receive-related
handlers will be called.
You can set the NDIS packet filter back to zero if you want to stop packet
reception. It’s like an “on/off switch”…
>
> DDK says ProtocolReceive is a required function that is called with a
pointer to a lookahead buffer. If the underlying connectionless NIC driver
calls a filter-specific NdisMXxxIndicateReceive function, NDIS always calls
the ProtocolReceive function of each bound protocol driver.
>
> My Question: How Could I Know whether my underlying connectionless NIC
driver calls a filter-secific NidsMxxIndicateReceive or not?
>
Set the NDIS packet filter to a non-zero value.
See the DDK PassThru and NDISUIO NDIS protocol driver samples. They probably
set the NDIS packet filter when a DeviceIoControl call is made from the
companion application.
>
> And DDK also says When an underlying connectionless NIC driver indicates
an array of one or more packet descriptors with NdisMIndicateReceivePacket,
NDIS will usually call a bound protocol driver’s ProtocolReceivePacket
function with each packet descriptor.
>
> If a protocol driver is aware that it is (or might be) bound to such a NIC
driver, it should have a ProtocolReceivePacket function
>
> I have been confused by what DDK says. If there are several protocol
driver installed in
> my system and all of them have their own defined ProtocolReceive Handler
or ProtocolReceivePacket handler. Is a received packet handled by every such
handler?
> If not How does ndis transfer the packet to its right place?
NDIS does not attempt to “transfer the packet to the right place”.
Instead EVERY received packet received by a miniport is indicated to EVERY
NDIS protocol that is bound to it. Each NDIS protocol must quickly examine
each packet to see if the packet is one that they are interested in.
There is nothing that one NDIS protocol can do to keep other protocols from
seeing the same packet.
Good luck,
–
Thomas F. Divine
PCAUSA - Tools & Resources For Network Software Developers
NDIS Protocol/Intermediate/Hooking - TDI Client/Filter
http: - http:</http:></http:>
send raw ethernet packet through
the NdisSend. However since then I could not receive any
packet. It seems that the ProtocolReceive and
ProtocolReceivePacket could never be called by ndis!!! Why?
You must enable the receiver side by OID_GEN_CURRENT_PACKET_FILTER
OID.
Max
I know the 13th and 14th bytes of ethernet header is protocol type.
0x8000 indicate a frame for IP protocol. How could I set up a filter
for a specified protocl type defined by me.
For example I just want miniport driver to notify nids protocl driver when
there are such type ethernet frame(the type value is 0x8888) arrive and not
any other.
craiglei
----- Original Message -----
From: “Maxim S. Shatskih”
To: “NT Developers Interest List”
Sent: Friday, May 31, 2002 6:23 PM
Subject: [ntdev] Re: Why ProtocolReceive or ProtocolReceivePacket Never Be Called?
> send raw ethernet packet through
> > the NdisSend. However since then I could not receive any
> packet. It seems that the ProtocolReceive and
> ProtocolReceivePacket could never be called by ndis!!! Why?
>
>
> You must enable the receiver side by OID_GEN_CURRENT_PACKET_FILTER
> OID.
>
> Max
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@tgegroup.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
request->RequestType = NdisRequestSetInformation;
request->DATA.SET_INFORMATION.Oid = NDIS_PACKET_TYPE_PROMISCUOUS;
request->DATA.SET_INFORMATION.InformationBuffer=NetDiskInformationBuffer;
request->DATA.SET_INFORMATION.InformationBufferLength=NetDiskInformationBufferLen;
NdisRequest(
&Status,
Open->AdapterHandle,
request
);
Just Do this ?
----- Original Message -----
From: “Maxim S. Shatskih”
To: “NT Developers Interest List”
Sent: Friday, May 31, 2002 6:23 PM
Subject: [ntdev] Re: Why ProtocolReceive or ProtocolReceivePacket Never Be Called?
> send raw ethernet packet through
> > the NdisSend. However since then I could not receive any
> packet. It seems that the ProtocolReceive and
> ProtocolReceivePacket could never be called by ndis!!! Why?
>
>
> You must enable the receiver side by OID_GEN_CURRENT_PACKET_FILTER
> OID.
>
> Max
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@tgegroup.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
Parse the header manually. Also note that there is also 802.3 header
format, which has length in this field and protocol type a bit later.
Max
----- Original Message -----
From: “craiglei”
To: “NT Developers Interest List”
Sent: Saturday, June 01, 2002 4:55 AM
Subject: [ntdev] Re: Why ProtocolReceive or ProtocolReceivePacket
Never Be Called?
> I know the 13th and 14th bytes of ethernet header is protocol type.
> 0x8000 indicate a frame for IP protocol. How could I set up a filter
> for a specified protocl type defined by me.
>
> For example I just want miniport driver to notify nids protocl
driver when
> there are such type ethernet frame(the type value is 0x8888) arrive
and not
> any other.
>
>
> craiglei
>
> ----- Original Message -----
> From: “Maxim S. Shatskih”
> To: “NT Developers Interest List”
> Sent: Friday, May 31, 2002 6:23 PM
> Subject: [ntdev] Re: Why ProtocolReceive or ProtocolReceivePacket
Never Be Called?
>
>
> > send raw ethernet packet through
> > > the NdisSend. However since then I could not receive any
> > packet. It seems that the ProtocolReceive and
> > ProtocolReceivePacket could never be called by ndis!!! Why?
> >
> >
> > You must enable the receiver side by OID_GEN_CURRENT_PACKET_FILTER
> > OID.
> >
> > Max
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@tgegroup.com
> > To unsubscribe send a blank email to
%%email.unsub%%
> >
> b‹ç®·¶\¹»?vÚµ×jÉÆ)¶Šçiû¢dº{nlj·zwnV‘éŠ[•æz{zþØy²Û²·
I just set OID_GEN_CURRENT_PACKET_FILTER as NDIS_PACKET_TYPE_DIRECTED with NdisRequest. Since
then everytime a packet arrived the system crashed.
Why? Even if ProtocolReceive do nothing and just return NDIS_STATUS_NOT_ACCEPTED for
every received packet.
craiglei
----- Original Message -----
From: “Maxim S. Shatskih”
To: “NT Developers Interest List”
Sent: Friday, May 31, 2002 6:23 PM
Subject: [ntdev] Re: Why ProtocolReceive or ProtocolReceivePacket Never Be Called?
> send raw ethernet packet through
> > the NdisSend. However since then I could not receive any
> packet. It seems that the ProtocolReceive and
> ProtocolReceivePacket could never be called by ndis!!! Why?
>
>
> You must enable the receiver side by OID_GEN_CURRENT_PACKET_FILTER
> OID.
>
> Max
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@tgegroup.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
You must be doing something besides just returning
NDIS_STATUS_NOT_ACCEPTED…
Please see the NDISUIO sample on the Windows XP DDK. It is a good place to
start and does not crash.
Good luck,
Thomas F. Divine
PCAUSA - Tools & Resources For Network Software Developers
NDIS Protocol/Intermediate/Hooking - TDI Client/Filter
http: - http:
“craiglei” wrote in message news:xxxxx@ntdev…
> I just set OID_GEN_CURRENT_PACKET_FILTER as NDIS_PACKET_TYPE_DIRECTED with
NdisRequest. Since
> then everytime a packet arrived the system crashed.
>
> Why? Even if ProtocolReceive do nothing and just return
NDIS_STATUS_NOT_ACCEPTED for
> every received packet.
></http:></http:>