Hello, I am using the code below in my IM driver for Win2k trying to
set the adapter to promiscuous mode right after
NdisOpenAdapter() Everything seems ok and got back Status to be
success, but why can’t see all the packets except to/from this host? if
install other sniffer software, they are running fine… that means my
adapter is good for promiscuous right? . Any idea out there?
TIA
Chiang
Search Result 2
From: J.P.
http:internet.fr+> Iribarren ( xxxxx@club-internet.fr
mailto:famirib33 )
Subject: Re: Set Miniport to Promiscuous Mode from Ndis Intermediate
Driver
Newsgroups: comp.os.ms-windows.programmer.nt.kernel-
http:windows.programmer.nt.kernel-mode> mode
View: Complete
http:d.news.oleane.net&rnum=2&prev=/groups%3Fq%3Dpromiscuous%2Bmode%26hl%3Den
%26group%3Dcomp.os.ms-windows.programmer.nt.kernel-
mode%26rnum%3D2%26selm%3D9md23e%2524cv1%25241%2540s1.read.news.oleane.ne
t> Thread (3 articles) | Original
http:eane.net&output=gplain> Format
Date: 2001-08-27 02:00:03 PST
Crystal Luo a ecrit dans le message
<9mcs7n$85n$xxxxx@newton.pacific.net.sg>…
>[snip]
>My ndis IM driver is bound to a miniport driver. This miniport needs to
>receive packets destinated to other terminals. I am not sure how to set
>this miniport to promiscuous mode from the IM driver, as I cannot alter
>the miniport.
>
>This is what I currently do for the above purpose:
>In IM driver’s MiniportQueryInformation() handler, do not pass down the
>OID query request for OID_GEN_CURRENT_PACKET_FILTER. Simply return with
>NDIS_PACKET_TYPE_PROMISCUOUS bit set It seems not effective but I am
>not sure.
Look, if you want to receive each and every packet on the segment, the
hardware must be programmed to do so, musn’t it? You are not going to
achieve this by just altering the replies of the underlying miniport;
you have to request it to enter promiscuous mode (because
promiscuous mode is not the standard mode of operation) with a call to
NdisRequest(). The following code should work (nhMiniportHandle is the
handle of the underlying miniport, not of the miniport part of your IM):
// Global variables
ULONG ulFilter;
NDIS_REQUEST nrBuffer;
NDIS_STATUS RequestPromiscuous( NDIS_HANDLE nhMiniportHandle )
{
NDIS_STATUS nsRet;
ulFilter = NDIS_PACKET_TYPE_PROMISCUOUS;
nrBuffer.RequestType = NdisRequestSetInformation;
nrBuffer.DATA.SET_INFORMATION.Oid = OID_GEN_CURRENT_PACKET_FILTER;
nrBuffer.DATA.SET_INFORMATION.InformationBuffer = &ulFilter;
nrBuffer.DATA.SET_INFORMATION.InformationBufferLength =
sizeof( ulFilter );
NdisRequest( &nsRet, nhMiniportHandle, &nrBuffer );
return nsRet;
}
Note that both the NDIS_REQUEST and the ULONG you’re going to use for
that purpose must either be global variables or have been allocated
through NdisAllocateMemoryWithTag(); they cannot be local variables (on
the stack) for NdisRequest() can return NDIS_STATUS_PENDING and complete
the operation later, at a time when your stack variables would have gone
to cyberspace. The above example uses global variables for the sake of
simplicity.
—
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com</http:></http:></http:></mailto:famirib33></http:>