Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Jul 1998 21:05:11 +0900 (JST)
From:      jinmei@kame.net
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   kern/7281: Multicast kludge does not work correctly
Message-ID:  <199807141205.VAA03050@kame201.kame.net>

next in thread | raw e-mail | index | archive | help

>Number:         7281
>Category:       kern
>Synopsis:       Multicast kludge does not work correctly
>Confidential:   yes
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jul 14 05:10:01 PDT 1998
>Last-Modified:
>Originator:     JINMEI Tatuya
>Organization:
KAME project
>Release:        FreeBSD 2.2.6-RELEASE i386
>Environment:

FreeBSD perfume.kame.net 2.2.6-RELEASE FreeBSD 2.2.6-RELEASE #5:
Mon Jul 13 15:52:36 JST 1998
jinmei@perfume.kame.net:/usr/src/sys/compile/PERFUME  i386

>Description:

If we join more than one multicast groups on an interface and then
delete the unicast address on the interface,
only one of them will be saved to multicast kludge area.

>How-To-Repeat:

0. Suppose that the IP address of ed0 is 10.0.0.1 and it's the only IP
   address on the interface.
1. Join 224.0.0.2 on ed0
2. Join 224.0.0.3 on ed0
3. # ifconfig ed0 delete 10.0.0.1
4. # ifconfig ed0 10.0.0.1
5. # netstat -ian
   there should be 224.0.0.2 and 224.0.0.3 on ed0, but only 224.0.0.3
   is printed.

>Fix:

This is because the way to use LIST_INSERT_HEAD is wrong in in_control()
and in_ifinit(). We should forward pointer before calling LIST_INSERT_HEAD.

I wrote a patch to solve this problem and applied it.
It seems that the problem is fixed.

I'll attach the patch to this mail.

Index: in.c
===================================================================
RCS file: /cvsroot/hydrangea-freebsd/sys/netinet/in.c,v
retrieving revision 1.1.1.1.12.2
diff -c -r1.1.1.1.12.2 in.c
*** in.c	1998/06/02 15:53:18	1.1.1.1.12.2
--- in.c	1998/07/14 10:19:54
***************
*** 461,469 ****
  		 */
  		IFP_TO_IA(oia->ia_ifp, ia);
  		if (ia) {	/* there is another address */
! 			struct in_multi *inm;
  			for(inm = oia->ia_multiaddrs.lh_first; inm;
! 			    inm = inm->inm_entry.le_next) {
  				IFAFREE(&inm->inm_ia->ia_ifa);
  				ia->ia_ifa.ifa_refcnt++;
  				inm->inm_ia = ia;
--- 461,470 ----
  		 */
  		IFP_TO_IA(oia->ia_ifp, ia);
  		if (ia) {	/* there is another address */
! 			struct in_multi *inm, *next;
  			for(inm = oia->ia_multiaddrs.lh_first; inm;
! 			    inm = next) {
! 				next = inm->inm_entry.le_next;
  				IFAFREE(&inm->inm_ia->ia_ifa);
  				ia->ia_ifa.ifa_refcnt++;
  				inm->inm_ia = ia;
***************
*** 472,484 ****
  			}
  			FREE(mk, M_IPMADDR);
  		} else {	/* last address on this if deleted, save */
! 			struct in_multi *inm;
  
  			LIST_INIT(&mk->mk_head);
  			mk->mk_ifp = ifp;
  
  			for(inm = oia->ia_multiaddrs.lh_first; inm;
! 			    inm = inm->inm_entry.le_next) {
  				LIST_INSERT_HEAD(&mk->mk_head, inm, inm_entry);
  			}
  
--- 473,486 ----
  			}
  			FREE(mk, M_IPMADDR);
  		} else {	/* last address on this if deleted, save */
! 			struct in_multi *inm, *next;
  
  			LIST_INIT(&mk->mk_head);
  			mk->mk_ifp = ifp;
  
  			for(inm = oia->ia_multiaddrs.lh_first; inm;
! 			    inm = next) {
! 				next = inm->inm_entry.le_next;
  				LIST_INSERT_HEAD(&mk->mk_head, inm, inm_entry);
  			}
  
***************
*** 609,618 ****
  		 */
  		for(mk = in_mk.lh_first; mk; mk = mk->mk_entry.le_next) {
  			if(mk->mk_ifp == ifp) {
! 				struct in_multi *inm;
  
  				for(inm = mk->mk_head.lh_first; inm;
! 				    inm = inm->inm_entry.le_next) {
  					IFAFREE(&inm->inm_ia->ia_ifa);
  					ia->ia_ifa.ifa_refcnt++;
  					inm->inm_ia = ia;
--- 611,621 ----
  		 */
  		for(mk = in_mk.lh_first; mk; mk = mk->mk_entry.le_next) {
  			if(mk->mk_ifp == ifp) {
! 				struct in_multi *inm, *next;
  
  				for(inm = mk->mk_head.lh_first; inm;
! 				    inm = next) {
! 					next = inm->inm_entry.le_next;
  					IFAFREE(&inm->inm_ia->ia_ifa);
  					ia->ia_ifa.ifa_refcnt++;
  					inm->inm_ia = ia;
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199807141205.VAA03050>