I have been using the tap-win32 driver with multicast in TUN mode. In its current version the tap-win32 driver blocks multicast packets in AdapterTransmit as it only allows unicast packets.
I have written a patch for the driver to allow multicast packets through the driver which works for me which I wanted to share (although IGMPv2 doesn't seem to get through - IGMPv3 does...).
I hope someone find it useful and that some form of it might find its way into 2.2 (so I don't have to patch the driver when new versions are released

(Could not find a way to attach the patch, so I am including it here)
Code: Select all
Index: macinfo.h
===================================================================
--- macinfo.h (revision 6688)
+++ macinfo.h (working copy)
@@ -34,5 +34,6 @@
#define COPY_MAC(dest, src) NdisMoveMemory ((dest), (src), sizeof (MACADDR))
#define CLEAR_MAC(dest) NdisZeroMemory ((dest), sizeof (MACADDR))
#define MAC_EQUAL(a,b) (memcmp ((a), (b), sizeof (MACADDR)) == 0)
+#define MAC_IPv4_MULTICAST(a) (a[0] == 0x01 && a[1] == 0x00 && a[2] == 0x5e)
#endif
Index: tapdrvr.c
===================================================================
--- tapdrvr.c (revision 6826)
+++ tapdrvr.c (working copy)
@@ -1104,8 +1104,8 @@
case OID_GEN_CURRENT_PACKET_FILTER:
l_Query.m_Long =
- (NDIS_PACKET_TYPE_ALL_LOCAL |
- NDIS_PACKET_TYPE_BROADCAST |
+ (NDIS_PACKET_TYPE_ALL_LOCAL | NDIS_PACKET_TYPE_BROADCAST
+ NDIS_PACKET_TYPE_MULTICAST | NDIS_PACKET_TYPE_ALL_MULTICAST |
NDIS_PACKET_TYPE_DIRECTED | NDIS_PACKET_TYPE_ALL_FUNCTIONAL);
break;
@@ -1582,6 +1582,20 @@
return TRUE; // all fine
}
+BOOLEAN
+IPv4AcceptMulticast(PETH_HEADER p_Header, PETH_HEADER p_AdapterHeader)
+{
+ return (MAC_IPv4_MULTICAST(p_Header->dest) &&
+ MAC_EQUAL(p_Header->src, p_AdapterHeader->src) &&
+ p_Header->proto == p_AdapterHeader->proto);
+}
+
+BOOLEAN
+IPv4AcceptUnicast(PETH_HEADER p_Header, PETH_HEADER p_AdapterHeader)
+{
+ return (memcmp (p_Header, p_AdapterHeader, ETHERNET_HEADER_SIZE) == 0);
+}
+
//====================================================================
// Adapter Transmission
//====================================================================
@@ -1759,10 +1773,10 @@
< ETHERNET_HEADER_SIZE + IP_HEADER_SIZE)
goto no_queue;
- // Only accept directed packets,
- // not broadcasts.
- if (memcmp (e, &l_Adapter->m_TapToUser, ETHERNET_HEADER_SIZE))
- goto no_queue;
+ // Accept directed packets and multicast packets, but not broadcasts
+ if(!IPv4AcceptMulticast(e, &l_Adapter->m_TapToUser) &&
+ !IPv4AcceptUnicast(e, &l_Adapter->m_TapToUser))
+ goto no_queue;
// Packet looks like IPv4, queue it.
l_PacketBuffer->m_SizeFlags |= TP_TUN;
Regards Lau Bakman