How to create NDIS packet in Intermediate driver

Hi All!

I have an Intermediate NDIS driver, which filter network traffic
on Ethernet cards. I want to be able simulate packet receiving in my driver.
I can create a right 802.3 frame in memory. But I don’t know
what I have to do then :frowning:

Any help is very appreciate.
With regards Aidar Talibzhanov aka AIDS
xxxxx@programmer.net

In a message dated 3/16/00 5:08:23 AM Eastern Standard Time,
xxxxx@programmer.net writes:

Hi All!

I have an Intermediate NDIS driver, which filter network traffic
on Ethernet cards. I want to be able simulate packet receiving in my
driver.
I can create a right 802.3 frame in memory. But I don’t know
what I have to do then :frowning:

Any help is very appreciate.
With regards Aidar Talibzhanov aka AIDS
xxxxx@programmer.net

I do not see how it is possible that you can be doing filtering and not know
what to do with an incoming packet? YOu do the same thing with it that you
do with all incoming packets. Dont you?

I’m sorry, my question was not clear.
Ok, I’m try ask again:
I have an Intermediate NDIS driver, which
layered between TCP/IP protocol and Ethernet card.
Also, there is user-mode application, which interacts
with my driver via DeviceIoControl function.
Usually my driver work in pass-through mode - just
refresh packet descriptors and send them to the NIC
But sometimes, my driver must simulate packet receiving
(by application request, sended via DeviceIoControl).
This action don’t depend from real packet receiving from
network.
I tried to use this method:

  1. Allocate NDIS Packet from previosly initialized packet pool
  2. Allocate NDIS Buffer from non-paged pool and attach it to NDIS
    Packet
  3. Call NdisMIndicateReceivePacket
    After call my PacketReceive handler nothing happens :frowning:
    What I do wrong? What I have to do?

Any help is very appreciated.
With regards
Aidar Talibzhanov (xxxxx@programmer.net)

At first glance, I would say you forgot to issue the
NdisMEthIndicateReceiveComplete() call to NDIS.

-----Original Message-----
From: Aidar Talibzhanov [mailto:xxxxx@programmer.net]
Sent: Sunday, March 19, 2000 11:16 PM
To: NT Developers Interest List
Subject: [ntdev] Re: How to create NDIS packet in Intermediate driver

I’m sorry, my question was not clear.
Ok, I’m try ask again:
I have an Intermediate NDIS driver, which
layered between TCP/IP protocol and Ethernet card.
Also, there is user-mode application, which interacts
with my driver via DeviceIoControl function.
Usually my driver work in pass-through mode - just
refresh packet descriptors and send them to the NIC
But sometimes, my driver must simulate packet receiving
(by application request, sended via DeviceIoControl).
This action don’t depend from real packet receiving from
network.
I tried to use this method:

  1. Allocate NDIS Packet from previosly initialized packet pool
  2. Allocate NDIS Buffer from non-paged pool and attach it to NDIS
    Packet
  3. Call NdisMIndicateReceivePacket
    After call my PacketReceive handler nothing happens :frowning:
    What I do wrong? What I have to do?

Any help is very appreciated.
With regards
Aidar Talibzhanov (xxxxx@programmer.net)


You are currently subscribed to ntdev as: xxxxx@moore-solutions.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)

Hi Aidar!
If you is indicating packet up as a result of DeviceIoControl from user mode
app
your should do the following:

======================

PNDIS_PACKET Packet;
NDIS_HANDLE SwitchHandle;

NdisAcquireSpinLock(&SwitchLock); // rise IRQL
BOOLEAN result = NdisIMSwitchToMiniport(AdapterHandle, &SwitchHandle);

// set the packet array to point to packet and indicate it up
NdisMIndicateReceivePacket(AdapterHandle, &Packet, 1);

NdisIMRevertBack(AdapterHandle, SwitchHandle);

NdisReleaseSpinLock(&SwitchLock);

// now check the packet’s status to see if you can return it
NDIS_STATUS Status = NDIS_GET_PACKET_STATUS(Packet);

if (Status != NDIS_STATUS_PENDING) {
// return packet and buffers to corresponding pools
} else {
// If packet is pending you must release it in MiniportReturnPacket
handler
}

If this does not work then you have messed up your packet contents
and packet is filtered out by NDIS;

Regards, Victor.

I’m sorry, my question was not clear.
Ok, I’m try ask again:
I have an Intermediate NDIS driver, which
layered between TCP/IP protocol and Ethernet card.
Also, there is user-mode application, which interacts
with my driver via DeviceIoControl function.
Usually my driver work in pass-through mode - just
refresh packet descriptors and send them to the NIC
But sometimes, my driver must simulate packet receiving
(by application request, sended via DeviceIoControl).
This action don’t depend from real packet receiving from
network.
I tried to use this method:

  1. Allocate NDIS Packet from previosly initialized packet pool
  2. Allocate NDIS Buffer from non-paged pool and attach it to NDIS
    Packet
  3. Call NdisMIndicateReceivePacket
    After call my PacketReceive handler nothing happens :frowning:
    What I do wrong? What I have to do?

Any help is very appreciated.
With regards
Aidar Talibzhanov (xxxxx@programmer.net)