Exemple #1
0
static INT32 IPv4MulticastFilterExcluded(
	IN PUCHAR pDstMacAddr)
{
	UINT32 DstIpAddr;

	if(!isIgmpMacAddr(pDstMacAddr))
		return -1;

	/* Check IGMP packet */
	if(*(pDstMacAddr + 23) == IGMP_PROTOCOL_DESCRIPTOR)
		return 1;

	/* Get destination Ip address of IP header */
	DstIpAddr = ntohl(*((UINT32*)(pDstMacAddr + 30)));

	/* Check address is local multicast */
	if ((DstIpAddr & 0xffffff00) == 0xe0000000)
		return 2;

	/* Check address is SSDP */
	if (DstIpAddr == 0xeffffffa)
		return 2;

	return 0;
}
Exemple #2
0
BOOLEAN isIgmpMDNSPkt(
	IN PUCHAR pDstMacAddr,
	IN PUCHAR pIpHeader)
{
	struct iphdr *iph=(struct  iphdr*)pIpHeader;

	if(!isIgmpMacAddr(pDstMacAddr))
		return FALSE;
	if(IS_MDNSADDR(iph->daddr))
	{
//		DBGPRINT(RT_DEBUG_ERROR, ("%s: Found 224.0.0.251\n", __FUNCTION__));
//		DBGPRINT(RT_DEBUG_ERROR, ("%s: dstaddr=%08x,%08x\n", __FUNCTION__,htonl(iph->daddr),(0xe0000000)));
		return TRUE;
	}
//		DBGPRINT(RT_DEBUG_ERROR, ("%s: dstaddr=%08x,%08x\n", __FUNCTION__,htonl(iph->daddr),(0xe0000000)));
	return FALSE;
}
BOOLEAN isIgmpPkt(
	IN PUCHAR pDstMacAddr,
	IN PUCHAR pIpHeader)
{
	UINT16 IpProtocol = ntohs(*((UINT16 *)(pIpHeader)));
	UCHAR IgmpProtocol;

	if(!isIgmpMacAddr(pDstMacAddr))
		return FALSE;

	if(IpProtocol == ETH_P_IP)
	{
		IgmpProtocol = (UCHAR)*(pIpHeader + 11);
		if(IgmpProtocol == IGMP_PROTOCOL_DESCRIPTOR)
				return TRUE;
	}

	return FALSE;
}
static inline BOOLEAN IPv4MulticastFilterExcluded(IN PUCHAR pDstMacAddr)
{
	UINT32 DstIpAddr;
	UINT32 Count;

	if(!isIgmpMacAddr(pDstMacAddr))
		return FALSE;

	/* Check IGMP packet */
	if(*(pDstMacAddr + 23) == IGMP_PROTOCOL_DESCRIPTOR)
		return TRUE;

	/* Get destination Ip address of IP header */
	DstIpAddr = ntohl(*((UINT32*)(pDstMacAddr + 30)));

	/* Check adress exist in reserved ranges by ip_addr_rsvd table */
	for (Count = 0; Count < sizeof(ip_addr_rsvd)/sizeof(rsv_table_t); Count++)
		if ((DstIpAddr & ip_addr_rsvd[Count].mask) == (ip_addr_rsvd[Count].addr & ip_addr_rsvd[Count].mask))
			return TRUE;

	return FALSE;
}