Messages in this thread | | | Date | Tue, 1 Nov 2005 18:37:43 +0800 | From | Yan Zheng <> | Subject | Re: [PATCH][MCAST]IPv6: small fix for ip6_mc_msfilter(...) |
| |
You can reproduce this bug by follow codes. This program will cause a change to include report even though the first socket's filter mode is exclude.
Please adjust IFINDEX first. ======================================== #include <stdio.h> #include <unistd.h> #include <netinet/in.h> #include <arpa/inet.h> #include <sys/socket.h> #include <sys/types.h> #define IFINDEX 6
int main(int argc, char argv[]) { int i, sockfds[3]; struct ipv6_mreq req; struct group_filter filter; struct sockaddr_in6 *psin6; req.ipv6mr_interface = IFINDEX; inet_pton(PF_INET6, "FF02::2", &req.ipv6mr_multiaddr);
for (i = 0; i < 3; ++i) { sockfds[i] = socket(PF_INET6, SOCK_DGRAM, 0); setsockopt(sockfds[i], SOL_IPV6, IPV6_ADD_MEMBERSHIP, &req, sizeof(req)); } filter.gf_interface = IFINDEX; filter.gf_fmode = MCAST_INCLUDE; filter.gf_numsrc = 1; psin6 = (struct sockaddr_in6 *)&filter.gf_group; psin6->sin6_family = AF_INET6; inet_pton(PF_INET6, "FF02::2", &psin6->sin6_addr); psin6 = (struct sockaddr_in6 *)&filter.gf_slist[0]; psin6->sin6_family = AF_INET6; inet_pton(PF_INET6, "2002:de12:1780::1", &psin6->sin6_addr); setsockopt(sockfds[1], SOL_IPV6, MCAST_MSFILTER, &filter, sizeof(filter)); filter.gf_fmode = MCAST_EXCLUDE; filter.gf_numsrc = 0; setsockopt(sockfds[2], SOL_IPV6, MCAST_MSFILTER, &filter, sizeof(filter)); setsockopt(sockfds[2], SOL_IPV6, MCAST_MSFILTER, &filter, sizeof(filter));
pause(); } - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |