Subject: Re: multiple multicast listeners
To: None <davida@pobox.com>
From: None <itojun@iijlab.net>
List: tech-net
Date: 05/09/2001 19:23:24
>i'm seeing a problem with some multicast code, and was wondering if
>anyone could donate me clue ...
>i have a process, listening on a multicast group.  if i start a second
>instance of the same program on the same machine, it seems that
>multicast packets sent to that group are only delivered to one of the
>listeners.

>i'm using 1.5 GENERIC on i386, with a `3Com 3c905-TX 10/100 Ethernet
>(rev. 0x0)'.

	there's a serious bug in 1.5 GENERIC kernel, udp multicast input path.
	please upgrade to 1.5.1_BETA kernel, or apply the following patch
	to sys/netinet/udp_usrreq.c.
	sorry for the mess.

itojun


Index: udp_usrreq.c
===================================================================
RCS file: /cvsroot/syssrc/sys/netinet/udp_usrreq.c,v
retrieving revision 1.66.4.1
retrieving revision 1.66.4.3
diff -u -r1.66.4.1 -r1.66.4.3
--- udp_usrreq.c	2000/07/28 16:58:10	1.66.4.1
+++ udp_usrreq.c	2000/12/15 03:29:16	1.66.4.3
@@ -1,4 +1,4 @@
-/*	$NetBSD: udp_usrreq.c,v 1.66.4.1 2000/07/28 16:58:10 sommerfeld Exp $	*/
+/*	$NetBSD: udp_usrreq.c,v 1.66.4.3 2000/12/15 03:29:16 he Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -554,7 +554,7 @@
 	dst4 = &dst->sin_addr;
 	dport = &dst->sin_port;
 
-	if (IN_MULTICAST(src4->s_addr) ||
+	if (IN_MULTICAST(dst4->s_addr) ||
 	    in_broadcast(*dst4, m->m_pkthdr.rcvif)) {
 		struct inpcb *last;
 		/*
@@ -703,7 +703,7 @@
 	u_int16_t *sport, *dport;
 	int rcvcnt;
 	struct in6_addr *src6, *dst6;
-	struct in_addr *src4;
+	struct in_addr *dst4;
 	struct in6pcb *in6p;
 
 	rcvcnt = 0;
@@ -718,10 +718,10 @@
 	sport = &src->sin6_port;
 	dst6 = &dst->sin6_addr;
 	dport = &dst->sin6_port;
-	src4 = (struct in_addr *)&src->sin6_addr.s6_addr32[12];
+	dst4 = (struct in_addr *)&dst->sin6_addr.s6_addr32[12];
 
 	if (IN6_IS_ADDR_MULTICAST(dst6)
-	 || (af == AF_INET && IN_MULTICAST(src4->s_addr))) {
+	 || (af == AF_INET && IN_MULTICAST(dst4->s_addr))) {
 		struct in6pcb *last;
 		/*
 		 * Deliver a multicast or broadcast datagram to *all* sockets