BOOLEAN IPv6MulticastFilterExcluded(IN PUCHAR pDstMacAddr) { PUCHAR pIpHeader; PRT_IPV6_HDR pIpv6Hdr; UINT32 offset; INT idx; UINT8 nextProtocol; if(!IS_IPV6_MULTICAST_MAC_ADDR(pDstMacAddr)) return FALSE; pIpHeader = pDstMacAddr + 14; pIpv6Hdr = (PRT_IPV6_HDR)(pIpHeader); offset = IPV6_HDR_LEN; nextProtocol = pIpv6Hdr->nextHdr; while(nextProtocol == IPV6_NEXT_HEADER_HOP_BY_HOP) { if(IPv6ExtHdrHandle((RT_IPV6_EXT_HDR *)(pIpHeader + offset), &nextProtocol, &offset) == FALSE) break; } for (idx = 0; idx < IPV6_MULTICAST_FILTER_EXCLUED_SIZE; idx++) { if (nextProtocol == IPv6MulticastFilterExclued[idx]) return TRUE; } /* Check non-transient multicast */ if (!IPv6_Transient_Multicast(&pIpv6Hdr->dstAddr)) return TRUE; return FALSE; }
static INT32 IPv6MulticastFilterExcluded( IN PUCHAR pDstMacAddr) { PUCHAR pIpHeader; PRT_IPV6_HDR pIpv6Hdr; UINT32 offset; INT idx; UINT8 nextProtocol; if(!IS_IPV6_MULTICAST_MAC_ADDR(pDstMacAddr)) return -1; pIpHeader = pDstMacAddr + 14; pIpv6Hdr = (PRT_IPV6_HDR)(pIpHeader); offset = IPV6_HDR_LEN; nextProtocol = pIpv6Hdr->nextHdr; while(nextProtocol == IPV6_NEXT_HEADER_HOP_BY_HOP) { if(IPv6ExtHdrHandle((RT_IPV6_EXT_HDR *)(pIpHeader + offset), &nextProtocol, &offset) == FALSE) break; } if (nextProtocol == IPV6_NEXT_HEADER_ICMPV6) { PRT_ICMPV6_HDR pICMPv6Hdr = (PRT_ICMPV6_HDR)(pIpHeader + offset); switch (pICMPv6Hdr->type) { case MLD_QUERY: case MLD_V1_LISTENER_REPORT: case MLD_V1_LISTENER_DONE: case MLD_V2_LISTERNER_REPORT: return 1; } } for (idx = 0; idx < IPV6_MULTICAST_FILTER_EXCLUED_SIZE; idx++) { if (nextProtocol == IPv6MulticastFilterExclued[idx]) return 2; } /* Check non-transient multicast */ if (!IPv6_Transient_Multicast(&pIpv6Hdr->dstAddr)) return 2; return 0; }