title: How to disable loopback packets in NDIS protocol driver
body: <p>How do I disable receiving loopback packets in protocol driver?
  The scenario is, my protocol driver is receiving packets from one adapter and sending it over to another. (like <code>eth0 -&gt; eth1</code>). </p>
  
  <p>Interested only in IPv4,</p>
  
  <pre><code>#define NPROT_ETH_TYPE               0x0008 //IPv4
  </code></pre>
  
  <p>The filter is defined as,</p>
  
  <pre><code>#define NPROTO_PACKET_FILTER  ( NDIS_PACKET_TYPE_NO_LOCAL|    \
                                  NDIS_PACKET_TYPE_DIRECTED/*|    \
                                  NDIS_PACKET_TYPE_MULTICAST|   \
                                  NDIS_PACKET_TYPE_BROADCAST*/)
  </code></pre>
  
  <p>The receiving side is checking for loopback packets as shown below,</p>
  
  <pre><code>    // Leave the packet if loopback flag is set.
      if( NdisTestNblFlag( pNetBufList, NDIS_NBL_FLAGS_IS_LOOPBACK_PACKET ))
      {
          //
          // Ndisprot is not interested in this NetBufferList, return the
          // NetBufferList back to the miniport if the miniport gave us
          // ownership of it.
          //
          break;
      }
  </code></pre>
  
  <p>and when I send packets down the road, the <code>SendFlags</code> is set to zero to avoid loopback as per MSDN. </p>
  
  <pre><code>NdisSendNetBufferLists(        
                  pOpenContext-&gt;BindingHandle,
                  pNetBufferList,
                  NDIS_DEFAULT_PORT_NUMBER,
                  0);
  </code></pre>
  
  <p>Even after raising all these hurdles, my prottest is receiving loopback packets, as it is evident from wireshark.</p>
  
  <p>Any idea?</p>
  
  <p>Using NDIS6.0, ndisprot60, Dev: Win7, Test VM: Win2008 R2</p>