title: How to set and query multicast address for NDIS Virtual miniport driver?
body: <p>I want to add multicast support on virtual Miniport driver . I have a filter driver binds over each physical NIC . As per Microsoft document<br>
  <a href="https://msdn.microsoft.com/en-us/library/windows/hardware/ff569073(v=vs.85).aspx" rel="nofollow noreferrer">https://msdn.microsoft.com/en-us/library/windows/hardware/ff569073(v=vs.85).aspx</a></p>
  
  <p>I stared to add support multicast address :</p>
  
  <p><strong>These are my steps :</strong>
  In miniport driver : 
  during <code>miniport initialization</code> i added <code>MaxMulticastListSize = 32</code> in  <code>NDIS_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES</code> .</p>
  
  <pre><code>NDIS_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES MiniportAdapterGeneralAttributes;
  MiniportAdapterGeneralAttributes.MediaType = NdisMedium802_3;
  MiniportAdapterGeneralAttributes.PhysicalMediumType = NdisPhysicalMediumUnspecified;
  MiniportAdapterGeneralAttributes.MaxMulticastListSize = 32;
  </code></pre>
  
  <p>also i updated 32 max address in  OID_802_3_MAXIMUM_LIST_SIZE OID .
  Next i updated <code>PacketFilters</code> in </p>
  
  <pre><code>MiniportAdapterGeneralAttributes.SupportedPacketFilters =    NDIS_PACKET_TYPE_DIRECTED |
          NDIS_PACKET_TYPE_MULTICAST |
          NDIS_PACKET_TYPE_BROADCAST |
          NDIS_PACKET_TYPE_PROMISCUOUS |
          NDIS_PACKET_TYPE_ALL_MULTICAST;
  </code></pre>
  
  <p>During <code>OID_GEN_CURRENT_PACKET_FILTER</code> OID set request , i updated the PacketFilters with <code>DATA.SET_INFORMATION.InformationBuffer</code> value .</p>
  
  <p>and During <code>OID_GEN_MAC_OPTION</code> i am adding macros :  <code>NDIS_MAC_OPTION_NO_LOOPBACK | NDIS_MAC_OPTION_FULL_DUPLEX | NDIS_MAC_OPTION_8021P_PRIORITY ;</code></p>
  
  <p>Next in OID_802_3_MULTICAST_LIST OID set request , i maintained a multicast list  </p>
  
  <pre><code>OidRequest-&gt;DATA.SET_INFORMATION.BytesNeeded = 6;
  OidRequest-&gt;DATA.SET_INFORMATION.BytesRead = OidRequest-&gt;DATA.SET_INFORMATION.InformationBufferLength;
  
  do
  {
  
    //check multicast address invalid
    if(OidRequest-&gt;DATA.SET_INFORMATION.InformationBufferLength % 6){
     OidRequest-&gt;DATA.SET_INFORMATION.BytesRead = 0;
     status = NDIS_STATUS_INVALID_LENGTH;
     break;
     }
  
     //check multicast address list full
    if(OidRequest-&gt;DATA.SET_INFORMATION.InformationBufferLength &gt; (VELAN_MAX_MCAST_LIST * 6)){
    status = NDIS_STATUS_MULTICAST_FULL;
    OidRequest-&gt;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-&gt;DATA.SET_INFORMATION.InformationBuffer,OidRequest-&gt;DATA.SET_INFORMATION.InformationBufferLength);
   m_ulMclistSize = OidRequest-&gt;DATA.SET_INFORMATION.InformationBufferLength / 6;
   status = NDIS_STATUS_SUCCESS;
  
  }while(FALSE);
  </code></pre>
  
  <p>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 <code>received less than expected percentage of sent</code> . Any suggestions ? </p>