--- igmp-proxy-0.1/igmp_proxy.c 2005-08-09 13:32:09.000000000 +0100 +++ igmp-proxy-0.1+byte/igmp_proxy.c 2005-08-09 13:33:43.000000000 +0100 @@ -14,8 +14,10 @@ * * (C) Copyright 2002, Texas Instruments, Inc. *************************************************************************/ +#define IGMP_HOST_NEW_MEMBERSHIP_REPORT 0x16 + #include #include #include #include @@ -46,8 +48,10 @@ #define MAXCTRLSIZE (sizeof(struct cmsghdr) +sizeof(struct in_pktinfo)) /************************** GLOBAL Declarations ***************************/ +int new_vif = 0; + /* Log Level for all debug messages. */ int proxyDebugLevel = IGMP_FATAL; /* The global IGMP router master control block. */ @@ -796,13 +800,16 @@ return; } /* Extract the SRC IP Address from the IP header */ - src_address = ptr_ipheader->saddr; + src_address = ptr_ipheader->saddr; /* Get the IGMP packet type. */ ptr_igmp_header = (struct igmphdr *)((char *)&buffer[0] + (ptr_ipheader->ihl << 2)); + // ignore 239.192.0.0/16 + if ((0x0000FFFFu & ptr_igmp_header->group) == 0xC0EFu) return; + /* Process on the basis of the packet type. */ switch (ptr_igmp_header->type) { case IGMP_HOST_MEMBERSHIP_QUERY: @@ -831,8 +838,9 @@ } default: { /* Error: Invalid packet type. Silently discard !*/ +// logMsg (IGMP_DEBUG,"DEBUG: Received '%x'.\n", ptr_igmp_header->type); break; } } return; @@ -1160,9 +1168,9 @@ logMsg (IGMP_DEBUG, "Network:%s Group:%x State = %s. Group Timer:%d Query Timer:%d\n", ptr_net->ifaceName, ptr_group->group_address, getGroupState (ptr_group),ptr_group->group_timer, ptr_net->general_query_timer); - logMsg (IGMP_DEBUG, "*****************************************************\n\n"); +// logMsg (IGMP_DEBUG, "*****************************************************\n\n"); /* Get the next group. */ ptr_group = (IGMP_GROUP*)list_get_next((LIST_NODE *)ptr_group); } @@ -1587,8 +1595,10 @@ /* Skip loopback devices. */ if (flags & IFF_LOOPBACK) continue; + if (strcmp(ifr.ifr_name, "eth0") && strcmp(ifr.ifr_name, "ppp0")) continue; + /* FIX: For IGMP proxy not detecting PPP as an upstream interface. For a PPP connection * the netmask is defined as 255.255.255.255, so we cannot use it to detect the * upstream router address. */ if (flags & IFF_POINTOPOINT) @@ -1613,9 +1623,9 @@ { /* Set the device flag to enable reception of all packets but do not do so for * PPP connections */ strcpy (ifr.ifr_name, ptr_ifr->ifr_name); - ifr.ifr_flags = ifr.ifr_flags | IFF_ALLMULTI | IFF_PROMISC; + ifr.ifr_flags = ifr.ifr_flags | IFF_ALLMULTI /* | IFF_PROMISC */; if (ioctl(sock, SIOCSIFFLAGS, (void*)&ifr) < 0) { logMsg (IGMP_FATAL, "IGMP Error: Unable to set interface flags for %s.\n", ifr.ifr_name); @@ -1716,9 +1726,10 @@ ptr_network->ifaceName); } /* Create a virtual interface entry for the interface. */ - vifctl.vifc_vifi = ptr_network->iface_index; +// vifctl.vifc_vifi = ptr_network->iface_index; + vifctl.vifc_vifi = new_vif; vifctl.vifc_flags = 0; vifctl.vifc_threshold = 0; vifctl.vifc_rate_limit = 0; vifctl.vifc_lcl_addr.s_addr = ptr_sockaddress->sin_addr.s_addr; @@ -1733,9 +1744,10 @@ } else { /* Remember the index of the created virtual interface entry. */ - ptr_network->vif_index = ptr_network->iface_index; + ptr_network->vif_index = new_vif; + new_vif++; } /* Add to the list. */ list_add ((LIST_NODE **)&ptr_igmp_router->network_if_list, (LIST_NODE *)ptr_network);