Filter Driver ARP Request

Hello,
I want to create ARP request in NDIS 6.0 LWF’s Sendnetbufferlist
function. I am creating the ARP packet using MDL and then attaching it to a
new NDisBuffer and Ndisbufferlist. And then sending it to the miniport
driver.
So my question is do I need to use existing netbufferlists which is passed
from the protocol driver ,then how can i put it at the end or front of that
netbufferlist.(or my approach of creating a new buffer list is good?).
I am getting an exception pacer.sys (Interrupt level is to high to access
the buffer) when I tried to create my netbufferlists.

On 4/6/07, Don Burn wrote:
>
>
> “Mike Kemp” wrote in message news:xxxxx@ntdev…
> > Hi Peter
> >
> > I’d appreciate your comments: When I had to develop a driver last year I
> > wanted to wait for WDF but in the end had to do it with ordinary DDK as
> > WDF wasn’t available when I started.
> >
> > That meant I had to learn the basic DDK tricks, i.e. raw kernel
> > programming.
> >
> > The question is whether anyone starting now can start with WDF without
> > needing to know the detail underneath it, or if they’ll still need to
> > know how to write a non WDF driver.
> >
> > It’s a question about whether it’s really:
> >
> > (a) like MFC, which although useful, it turned out (when I learnt to
> > program Windows apps inthe 90’s) that you still had to know what was
> > going on underneath, or
> >
> > (b) like C etc, which successfully completely wraps the machine
> > underneath so you don’t need to know how it works at assembler level
> > (except when the compiler generates garbage code which is thankfully
> rare
> > these days).
> >
> > So in other words, should someone new wait for the WDF books we hear are
> > almost ready, or is Oney still a pre-requisite.
> >
> > Thanks for you insight on this
> >
> > Mike
>
> Mike,
>
> My view is the answer is a little of both. It is like MFC in that
> you
> can dive under it and for many things what you are seeing is the
> underlying
> model, for instance you will still see IRP’s, but how you access them and
> queue them is different.
>
> Where it is like C is that PnP and Power which used to be this horrid
> state machine you needed to create, typically one would start with an
> existing one and then try to adapt it to the current machine and “fix it”,
> has been abstracted to a well designed set of calls. IIRC the WDK team
> found that a complete state machine for this was on the order of 300
> states, but the typical support for PnP and Power in a KMDF driver is
> roughly half a dozen short routines or less.
>
> I have a lot of experience with legacy and WDM drivers, but knowing
> the pain of PnP/Power I will not do another if at all possible even though
> I still struggle with learning / getting used to the new model. Of course
> maybe I should not call it the new model, since Microsoft started asking
> for input from developers at WinHEC 5 years ago this month.
>
>
> –
> Don Burn (MVP, Windows DDK)
> Windows 2k/XP/2k3 Filesystem and Driver Consulting
> Website: http://www.windrvr.com
> Blog: http://msmvps.com/blogs/WinDrvr
> Remove StopSpam to reply
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>


Thanks
Abhijeet Kolekar

I would do things the following way:

  1. Get a first MDL in NDIS 6 NET_BUFFER_LIST and offset to the actual data like

ListMdl = NET_BUFFER_FIRST_MDL(NET_BUFFER_LIST_FIRST_NB(BufferList));
offset=NET_BUFFER_DATA_OFFSET(NET_BUFFER_LIST_FIRST_NB(BuffertList));

Given this info, you can walk MDL chain until you arrive to MDL that holds the actual data( i.e. skip
all unused space)

  1. Create ARP packet, and pass it to NdisAllocateBuffer() in order to get NDIS 5 NDIS_BUFFER (please note that NDIS_BUFFER is just a typedef for MDL)

  2. Chain MDLs together like ‘BufferMdl->Next=ListMdlData;’

  3. Allocate a new NET_BUFFER_LIST with NdisAllocateNetBufferAndNetBufferList(), with BufferMdl and 0 as respectively ‘MdlChain’ and ‘offset’ parameters

At this point you can pass the packet down the stack as a newly-allocated NET_BUFFER_LIST. Just don’t forget to record pointers to the orignal list in the reserved field, so that SendComplete() handler will be able to handle things properly…

Anton Bassov