NetBSD Problem Report #7302

Received: (qmail 4024 invoked from network); 2 Apr 1999 09:10:37 -0000
Message-Id: <199904020910.LAA20499@horn.ics.muni.cz>
Date: Fri, 2 Apr 1999 11:10:34 +0200 (MEST)
From: salvet@ics.muni.cz
Reply-To: salvet@ics.muni.cz
To: gnats-bugs@gnats.netbsd.org
Subject: multicast interface addr. with p2p inferfaces
X-Send-Pr-Version: 3.95

>Number:         7302
>Category:       kern
>Synopsis:       cannot set multicast interface addr. of p2p interface
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 02 01:20:00 +0000 1999
>Closed-Date:    
>Last-Modified:  
>Originator:     Zdenek Salvet
>Release:        current of Apr 1, 1999
>Organization:
Masaryk University
>Environment:
MI

>Description:
   Code for multicast interface address manipulation does not check
   destination addresses of point-to-point interfaces.
   Because of this e.g. GateD's implementation of OSPF protocol does not work
   correctly with point-to-point interfaces (can't add membership).

>How-To-Repeat:
>Fix:
diff -u -r netinet.orig/in_var.h netinet/in_var.h
--- netinet.orig/in_var.h       Fri Apr  2 09:15:07 1999
+++ netinet/in_var.h    Fri Apr  2 11:04:02 1999
@@ -186,6 +186,27 @@
 }

 /*
+ * Macro for finding the interface (ifnet structure) corresponding to one
+ * of our IP addresses.  Looks at the remote address of POINTOPOINT
+ * interfaces.
+ */
+#define INDSTADDR_TO_IFP(addr, ifp) \
+       /* struct in_addr addr; */ \
+       /* struct ifnet *ifp; */ \
+{ \
+       register struct in_ifaddr *ia; \
+\
+       for (ia = in_ifaddr.tqh_first; \
+           ia != NULL && \
+                ((ia->ia_ifp->if_flags & IFF_POINTOPOINT) ? \
+               !in_hosteq(ia->ia_dstaddr.sin_addr, (addr)) : \
+               !in_hosteq(ia->ia_addr.sin_addr, (addr))); \
+           ia = ia->ia_list.tqe_next) \
+                continue; \
+       (ifp) = (ia == NULL) ? NULL : ia->ia_ifp; \
+}
+
+/*
  * Macro for finding an internet address structure (in_ifaddr) corresponding
  * to a given interface (ifnet structure).
  */
diff -u -r netinet.orig/ip_output.c netinet/ip_output.c
--- netinet.orig/ip_output.c    Fri Apr  2 10:13:57 1999
+++ netinet/ip_output.c Fri Apr  2 10:19:07 1999
@@ -975,7 +975,11 @@
                 * IP address.  Find the interface and confirm that
                 * it supports multicasting.
                 */
-               INADDR_TO_IFP(addr, ifp);
+                INDSTADDR_TO_IFP(addr, ifp);
+                if (ifp == NULL) {
+                        INADDR_TO_IFP(addr, ifp);
+                }
+
                if (ifp == NULL || (ifp->if_flags & IFF_MULTICAST) == 0) {
                        error = EADDRNOTAVAIL;
                        break;
@@ -1040,7 +1044,10 @@
                        ifp = ro.ro_rt->rt_ifp;
                        rtfree(ro.ro_rt);
                } else {
-                       INADDR_TO_IFP(mreq->imr_interface, ifp);
+                        INDSTADDR_TO_IFP(mreq->imr_interface, ifp);
+                        if (ifp == NULL) {
+                              INADDR_TO_IFP(mreq->imr_interface, ifp);
+                        }
                }
                /*
                 * See if we found an interface, and confirm that it
@@ -1101,7 +1108,11 @@
                if (in_nullhost(mreq->imr_interface))
                        ifp = NULL;
                else {
-                       INADDR_TO_IFP(mreq->imr_interface, ifp);
+                        INDSTADDR_TO_IFP(mreq->imr_interface, ifp);
+                        if (ifp == NULL) {
+                                INADDR_TO_IFP(mreq->imr_interface, ifp);
+                        }
+
                        if (ifp == NULL) {
                                error = EADDRNOTAVAIL;
                                break;

>Release-Note:
>Audit-Trail:

From: Julian Assange <proff@iq.org>
To: salvet@ics.muni.cz
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: kern/7302: multicast interface addr. with p2p inferfaces
Date: 03 Apr 1999 07:50:00 +1000

 This is quite important. Can someone with a multicast-full network
 test this? Jason?

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.