windowsfilterwdkndisminiport

How to set and query multicast address for NDIS Virtual miniport driver?


I want to add multicast support on virtual Miniport driver . I have a filter driver binds over each physical NIC . As per Microsoft document
https://msdn.microsoft.com/en-us/library/windows/hardware/ff569073(v=vs.85).aspx

I stared to add support multicast address :

These are my steps : In miniport driver : during miniport initialization i added MaxMulticastListSize = 32 in NDIS_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES .

NDIS_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES MiniportAdapterGeneralAttributes;
MiniportAdapterGeneralAttributes.MediaType = NdisMedium802_3;
MiniportAdapterGeneralAttributes.PhysicalMediumType = NdisPhysicalMediumUnspecified;
MiniportAdapterGeneralAttributes.MaxMulticastListSize = 32;

also i updated 32 max address in OID_802_3_MAXIMUM_LIST_SIZE OID . Next i updated PacketFilters in

MiniportAdapterGeneralAttributes.SupportedPacketFilters =    NDIS_PACKET_TYPE_DIRECTED |
        NDIS_PACKET_TYPE_MULTICAST |
        NDIS_PACKET_TYPE_BROADCAST |
        NDIS_PACKET_TYPE_PROMISCUOUS |
        NDIS_PACKET_TYPE_ALL_MULTICAST;

During OID_GEN_CURRENT_PACKET_FILTER OID set request , i updated the PacketFilters with DATA.SET_INFORMATION.InformationBuffer value .

and During OID_GEN_MAC_OPTION i am adding macros : NDIS_MAC_OPTION_NO_LOOPBACK | NDIS_MAC_OPTION_FULL_DUPLEX | NDIS_MAC_OPTION_8021P_PRIORITY ;

Next in OID_802_3_MULTICAST_LIST OID set request , i maintained a multicast list

OidRequest->DATA.SET_INFORMATION.BytesNeeded = 6;
OidRequest->DATA.SET_INFORMATION.BytesRead = OidRequest->DATA.SET_INFORMATION.InformationBufferLength;

do
{

  //check multicast address invalid
  if(OidRequest->DATA.SET_INFORMATION.InformationBufferLength % 6){
   OidRequest->DATA.SET_INFORMATION.BytesRead = 0;
   status = NDIS_STATUS_INVALID_LENGTH;
   break;
   }

   //check multicast address list full
  if(OidRequest->DATA.SET_INFORMATION.InformationBufferLength > (VELAN_MAX_MCAST_LIST * 6)){
  status = NDIS_STATUS_MULTICAST_FULL;
  OidRequest->DATA.SET_INFORMATION.BytesNeeded = VELAN_MAX_MCAST_LIST * 6;
  break;
  }

 //setting new multicast address list
 NdisZeroMemory(m_ulMcList,VELAN_MAX_MCAST_LIST * MUX_MAC_ADDRESS);
 NdisMoveMemory(m_ulMcList,OidRequest->DATA.SET_INFORMATION.InformationBuffer,OidRequest->DATA.SET_INFORMATION.InformationBufferLength);
 m_ulMclistSize = OidRequest->DATA.SET_INFORMATION.InformationBufferLength / 6;
 status = NDIS_STATUS_SUCCESS;

}while(FALSE);

I tested with NDISTester . It has a protocol driver that will bound to the miniport adapter . But i didn't get any multicast packet during the receive time . Any thing am missing ? I am getting error like received less than expected percentage of sent . Any suggestions ?


Solution

  • I think you need to provide a handler for OID_802_3_MAXIMUM_LIST_SIZE .