From: ""Bryan S. Burgin [MSFT]"" Subject: Re: NDIS_MAC_OPTION_NO_LOOPBACK Date: Saturday, January 24, 2004 1:48 AM Hannah, I just received your case and sent you the answer. Here it is for everyone else... In the newer versions of PASSTHRU for Windows XP, the following code was added to correspond with changes in the LOOPBACK logic between W2K and WXP (in PtRequestComplete): if ((Oid == OID_GEN_MAC_OPTIONS) && (Status == NDIS_STATUS_SUCCESS)) { // // Remove the no-loopback bit from mac-options. In essence we are // telling NDIS that we can handle loopback. We don't, but the // interface below us does. If we do not do this, then loopback // processing happens both below us and above us. This is wasteful // at best and if Netmon is running, it will see multiple copies // of loopback packets when sniffing above us. // // Only the lowest miniport is a stack of layered miniports should // ever report this bit set to NDIS. // *(PULONG)NdisRequest->DATA.QUERY_INFORMATION.InformationBuffer &= ~NDIS_MAC_OPTION_NO_LOOPBACK; } However, this should not be done in Windows 2000. So I changed the logic so that this new code will only be used in XP, determined at runtime. Make these changes (identified by '>>'): ---(1)--- #include "precomp.h" #pragma hdrstop #define MAX_PACKET_POOL_SIZE 0x0000FFFF #define MIN_PACKET_POOL_SIZE 0x000000FF >>UINT NdisDotSysVersion = 0; // 0xMMMMmmmm, where M=Major/m=minor (0x00050001 = 5.1); initially unknown (0) >>#define NDISVERSION50 0x00050000 >>#define NDISVERSION51 0x00050001 --------- ---(2)--- in PtBindAdapter() PNDIS_CONFIGURATION_PARAMETER Param; NDIS_STRING DeviceStr = NDIS_STRING_CONST("UpperBindings"); >> NDIS_STRING NdisVersionStr = NDIS_STRING_CONST("NdisVersion"); PADAPT pAdapt = NULL; [.] do { // // Access the configuration section for our binding-specific // parameters. // NdisOpenProtocolConfiguration(Status, &ConfigHandle, SystemSpecific1); if (*Status != NDIS_STATUS_SUCCESS) { break; } >> // >> // Read the version of NDIS supported by NDIS.SYS by reading the >> // pre-defined keywork "NdisVersion". This will be useful later >> // if we need to alter our behavior for one OS version vs another OS. >> // >> if ( !NdisDotSysVersion ) >> { >> NdisReadConfiguration(Status, >> &Param, >> ConfigHandle, >> &NdisVersionStr, // "NdisVersion" >> NdisParameterInteger); >> if (*Status != NDIS_STATUS_SUCCESS) >> { >> break; >> } >> NdisDotSysVersion = Param->ParameterData.IntegerData; >> } // // Read the "UpperBindings" reserved key that contains a list --------- ---(3)--- in PtRequestComplete() >> if ((Oid == OID_GEN_MAC_OPTIONS) && (Status == NDIS_STATUS_SUCCESS) && (NdisDotSysVersion >= NDISVERSION51)) { >> // (Only do this on Windows XP or greater (NDIS.SYS v 5.1); do not do in Windows 2000 (NDIS.SYS v 5.0)) >> // // Remove the no-loopback bit from mac-options. In essence we are // telling NDIS that we can handle loopback. We don't, but the // interface below us does. If we do not do this, then loopback // processing happens both below us and above us. This is wasteful // at best and if Netmon is running, it will see multiple copies // of loopback packets when sniffing above us. // // Only the lowest miniport is a stack of layered miniports should // ever report this bit set to NDIS. // *(PULONG)NdisRequest->DATA.QUERY_INFORMATION.InformationBuffer &= ~NDIS_MAC_OPTION_NO_LOOPBACK; } Bryan S. Burgin bburgin@microsoft.com This posting is provided "AS IS" with no warranties, and confers no rights.