NetBSD Problem Report #32963

From ohmori@mobile-ip.org  Wed Mar  1 22:08:50 2006
Return-Path: <ohmori@mobile-ip.org>
Received: from fender.mobile-ip.org (f113adsl29.coara.or.jp [210.252.137.29])
	by narn.netbsd.org (Postfix) with ESMTP id E00B263B877
	for <gnats-bugs@gnats.NetBSD.org>; Wed,  1 Mar 2006 22:08:47 +0000 (UTC)
Message-Id: <20060301220852.GA27647@fender.mobile-ip.org>
Date: Thu, 2 Mar 2006 07:08:53 +0900
From: Motoyuki OHMORI <ohmori@mobile-ip.org>
Reply-To: ohmori@mobile-ip.org
To: gnats-bugs@netbsd.org
Subject: cannot install an unnumbered-p2p multicast interface into kernel

>Number:         32963
>Category:       kern
>Synopsis:       cannot install an unnumbered-p2p multicast interface into kernel
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 01 22:10:00 +0000 2006
>Originator:     Motoyuki OHMORI
>Release:        NetBSD 3.99.15
>Organization:
        Chikushi Jogakuen University
>Environment:
        MI
Architecture: i386
Machine: i386
>Description:
        IPv4 multicast routing code does not take account for an unnumbered
        p2p interface. If a multicast routing daemon tries install an interface
        as a vif into kernel, kernel might take different interface as a vif.
        IPv4 multicast packets could loop due to this.
>How-To-Repeat:
        Use an unumbered-p2p interface as a vif then multicast routing daemon:
# ifconfig fxp0 192.168.0.1/24
# ifconfig gif0 192.168.0.1/32 192.168.1.1
# mrouted
>Fix:
Make mrouted use an interface index when mrouted installes vifs into kernel and
make kernel can take an interface index.
Here is only a kernel patch to fix it:

diff -c sys/netinet/ip_var.h.orig sys/netinet/ip_var.h
*** sys/netinet/ip_var.h.orig   Thu Mar  2 06:10:35 2006
--- sys/netinet/ip_var.h        Thu Mar  2 06:12:32 2006
***************
*** 217,222 ****
--- 217,224 ----
  extern struct pool ipqent_pool;
  struct         inpcb;

+ struct ifnet *
+        ip_multicast_if(struct in_addr *, int *);
  int    ip_ctloutput(int, struct socket *, int, int, struct mbuf **);
  int    ip_dooptions(struct mbuf *);
  void   ip_drain(void);
*** sys/netinet/ip_output.c.orig        Thu Mar  2 06:09:55 2006
--- sys/netinet/ip_output.c     Thu Mar  2 06:12:06 2006
***************
*** 153,159 ****
  #endif

  static struct mbuf *ip_insertoptions(struct mbuf *, struct mbuf *, int *);
- static struct ifnet *ip_multicast_if(struct in_addr *, int *);
  static void ip_mloopback(struct ifnet *, struct mbuf *, struct sockaddr_in *);
  static int ip_getoptval(struct mbuf *, u_int8_t *, u_int);

--- 153,158 ----
***************
*** 1611,1617 ****
  /*
   * following RFC1724 section 3.3, 0.0.0.0/8 is interpreted as interface index.
   */
! static struct ifnet *
  ip_multicast_if(struct in_addr *a, int *ifindexp)
  {
        int ifindex;
--- 1610,1616 ----
  /*
   * following RFC1724 section 3.3, 0.0.0.0/8 is interpreted as interface index.
   */
! struct ifnet *
  ip_multicast_if(struct in_addr *a, int *ifindexp)
  {
        int ifindex;
*** sys/netinet/ip_mroute.c.orig        Thu Mar  2 06:08:38 2006
--- sys/netinet/ip_mroute.c     Thu Mar  2 06:16:04 2006
***************
*** 875,881 ****
  {
        struct vifctl *vifcp;
        struct vif *vifp;
-       struct ifaddr *ifa;
        struct ifnet *ifp;
        struct ifreq ifr;
        int error, s;
--- 875,880 ----
***************
*** 905,915 ****
        } else
  #endif
        {
!               sin.sin_addr = vifcp->vifc_lcl_addr;
!               ifa = ifa_ifwithaddr(sintosa(&sin));
!               if (ifa == NULL)
                        return (EADDRNOTAVAIL);
-               ifp = ifa->ifa_ifp;
        }

        if (vifcp->vifc_flags & VIFF_TUNNEL) {
--- 904,912 ----
        } else
  #endif
        {
!               ifp = ip_multicast_if(&vifcp->vifc_lcl_addr, NULL);
!               if (ifp == NULL)
                        return (EADDRNOTAVAIL);
        }

        if (vifcp->vifc_flags & VIFF_TUNNEL) {

>Unformatted:
 X-send-pr-version: 3.95

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.