NetBSD Problem Report #7480

Received: (qmail 7942 invoked from network); 26 Apr 1999 22:15:58 -0000
Message-Id: <199904262214.AAA00984@rumolt.teuto.de>
Date: Tue, 27 Apr 1999 00:14:55 +0200 (MEST)
From: Martin Husemann <martin@rumolt.teuto.de>
Reply-To: martin@rumolt.teuto.de
To: gnats-bugs@gnats.netbsd.org
Subject: IP severely broken
X-Send-Pr-Version: 3.95

>Number:         7480
>Category:       kern
>Synopsis:       ICMP errors with multiple interface at same local adress
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Apr 26 15:20:01 +0000 1999
>Closed-Date:    Mon May 03 22:14:10 +0000 1999
>Last-Modified:  Mon May 03 22:14:21 +0000 1999
>Originator:     Martin Husemann
>Release:        current as of April 27
>Organization:
>Environment:

System: NetBSD rumolt.teuto.de 1.4_ALPHA NetBSD 1.4_ALPHA (RUMOLT) #1: Wed Apr 7 07:27:08 MEST 1999 martin@hwart.teuto.de:/usr/src/sys-i4b/arch/i386/compile/RUMOLT i386

(sorry, I have to boot this old kernel to be able to deliver this PR - actual 
system running when the error happens is 1.4_BETA of today)

>Description:

I have this typical little network setup: a main router with an officialy
assigned IP number as the outer gateway. This router uses the same IP for 
multiple interfaces: the main internal ethernet network (we0) and several
point-to-point connections (in this case: multiple PPP dial up connections
via ISDN and a raw IP-over-HDLC ISDN connection to work).

Everything works fine as long as I only configure the main ethernet interface:

Script started on Mon Apr 26 23:59:05 1999
# ifconfig -a
ep0: flags=8822<BROADCAST,NOTRAILERS,SIMPLEX,MULTICAST> mtu 1500
        address: 00:10:4b:24:be:a8
        media: Ethernet 10baseT
        status: active
we0: flags=8863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        address: 00:00:c0:11:48:2d
        media: Ethernet 10base5
        inet 212.8.203.81 netmask 0xfffffff8 broadcast 212.8.203.87
lo0: flags=8008<LOOPBACK,MULTICAST> mtu 32976
ipr0: flags=2810<POINTOPOINT,SIMPLEX,LINK1> mtu 1500
ipr1: flags=2810<POINTOPOINT,SIMPLEX,LINK1> mtu 1500
isp0: flags=810<POINTOPOINT,SIMPLEX> mtu 1500
isp1: flags=810<POINTOPOINT,SIMPLEX> mtu 1500
# ping -c 5 hwart
PING hwart.teuto.de (212.8.203.83): 56 data bytes
64 bytes from 212.8.203.83: icmp_seq=0 ttl=128 time=1.268 ms
64 bytes from 212.8.203.83: icmp_seq=1 ttl=128 time=1.344 ms
64 bytes from 212.8.203.83: icmp_seq=2 ttl=128 time=1.329 ms
64 bytes from 212.8.203.83: icmp_seq=3 ttl=128 time=1.333 ms
64 bytes from 212.8.203.83: icmp_seq=4 ttl=128 time=1.332 ms

----hwart.teuto.de PING Statistics----
5 packets transmitted, 5 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 1.268/1.321/1.344/0.030 ms
#
Script done on Mon Apr 26 23:59:20 1999

As soon as I go up to multiuser, configuring the remaining network interfaces,
the complete ethernet traffic on the main interface gets rejected with ICMP:
ttl exceeded in transit errors:

Script started on Tue Apr 27 00:00:36 1999
root has logged on ttyv0 from local.

[~] root@rumolt > ifconfig -a
ep0: flags=8822<BROADCAST,NOTRAILERS,SIMPLEX,MULTICAST> mtu 1500
        address: 00:10:4b:24:be:a8
        media: Ethernet 10baseT
        status: active
we0: flags=8863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        address: 00:00:c0:11:48:2d
        media: Ethernet 10base5
        inet 212.8.203.81 netmask 0xfffffff8 broadcast 212.8.203.87
lo0: flags=8009<UP,LOOPBACK,MULTICAST> mtu 32976
        inet 127.0.0.1 netmask 0xff000000 
ipr0: flags=2811<UP,POINTOPOINT,SIMPLEX,LINK1> mtu 1500
        inet 212.8.203.81 --> 192.168.110.42 netmask 0xffffffff 
ipr1: flags=2810<POINTOPOINT,SIMPLEX,LINK1> mtu 1500
isp0: flags=2810<POINTOPOINT,SIMPLEX,LINK1> mtu 1500
        inet 212.8.203.81 --> 212.8.192.1 netmask 0xffffffff 
isp1: flags=2810<POINTOPOINT,SIMPLEX,LINK1> mtu 1500
        inet 194.139.121.194 --> 194.139.121.193 netmask 0xffffffff 
[~] root@rumolt > ping -c 5 hwart
PING hwart.teuto.de (212.8.203.83): 56 data bytes
----hwart.teuto.de PING Statistics----
5 packets transmitted, 0 packets received, 100.0% packet loss
[~] root@rumolt >
Script done on Tue Apr 27 00:01:09 1999

>How-To-Repeat:

configure a point-to-point interface with the same local address as
an ethernet interface, try to ping a host on the ethernet.

>Fix:

N/A - sorry.
>Release-Note:
>Audit-Trail:

From: Martin Husemann <martin@rumolt.teuto.de>
To: martin@rumolt.teuto.de (martin)
Cc: gnats-bugs@NetBSD.ORG
Subject: Re: kern/7480: IP severely broken
Date: Thu, 29 Apr 1999 00:10:02 +0200 (MEST)

 Just found out: I can cure the problem by 

 ifconfig we0 down
 ifconfig we0 `cat /etc/ifconfig.we0`

 in /etc/rc.local.

 So something in /etc/*rc* /etc/*netstart* is killing my routing - and it
 wasn't doing this two weeks ago. I just updated all files in /etc to the
 newest version and (besides hitting some unrelated bugs) this didn't change
 the problem described in this PR.

 Argh!

From: Martin Husemann <martin@rumolt.teuto.de>
To: martin@rumolt.teuto.de (martin)
Cc: gnats-bugs@NetBSD.ORG
Subject: Re: kern/7480: IP severely broken
Date: Thu, 29 Apr 1999 00:50:35 +0200 (MEST)

 Trying all the stuff happening in the relevant scripts shows the culprit.
 You can reproduce this easily:

 you'll need two interfaces, one "normal" and one point-to-point.

 say the normal is called we0 and the point-to-point is called ppp0. Let 
 $hostname be the name coresponding to your one-and-only, officialy assigned
 ip number. Let $otherhost be any host on your local network.

 Steps to reproduce the problem:

 1)
   ifconfig we0 $hostname
   ping $otherhost

 This works fine.

 2)
   ifconfig ppp0 $hostname (remote-side) netmask 255.255.255.255 down
   ping $otherhost

 This doesn't work

 3a)
   Repeat (1) - it works again

 3b)
   Alternatively: 

   ifconfig ppp0 $hostname (remote-side) netmask 255.255.255.255 up
   ping $otherhost

 This works too.

 When it doesn't work the ip_input function gets a packet with remaining TTL
 of 1 - so it sends an "icmp: TTL expired in transit".

 So the culprit seems to be the point-to-point interface with same local 
 address but being marked down!

 Don't ask for details, but I'm depending on such a configuration in a lot of
 places at work and here at home. The ppp interface is turned up and down
 as appropriate by a daemon process - if all networking stops in between I
 loos big time! And this did work with early 1.4_ALPHA kernels...

From: "Martin Husemann" <martin@rumolt.teuto.de>
To: <gnats-bugs@NetBSD.org>
Cc: <salvet@ics.muni.cz>
Subject: RE: kern/7480: IP severely broken
Date: Sat, 1 May 1999 10:13:26 +0200

 Here is a patch that fixes the problem


 Martin


 *** /sys/netinet/ip_input.c	Thu Apr  8 13:26:02 1999
 --- netinet/ip_input.c	Sat May  1 10:07:56 1999
 ***************
 *** 419,429 ****
 --- 419,436 ----
   	/*
   	 * Check our list of addresses, to see if the packet is for us.
   	 */
   	INADDR_TO_IA(ip->ip_dst, ia);
   	if (ia != NULL) {
 + 		/*
 + 		 * XXX - this check is bogus!
 + 		 * we may have several interfaces with this address
 + 		 * and THIS particular down, the check must be done
 + 		 * in INADDR_TO_IA, which should not consider interfaces
 + 		 * without IFF_UP !!!
   		if (ia->ia_ifp->if_flags & IFF_UP)
 + 		 */
   			goto ours;
   	}
   	if (m->m_pkthdr.rcvif->if_flags & IFF_BROADCAST) {
   		for (ifa = m->m_pkthdr.rcvif->if_addrlist.tqh_first;
   		    ifa != NULL; ifa = ifa->ifa_list.tqe_next) {


From: "Heiko W.Rupp" <hwr@pilhuhn.de>
To: Martin Husemann <martin@rumolt.teuto.de>, proff@netbsd.org
Cc: kern-bug-people@netbsd.org, gnats-bugs@netbsd.org
Subject: Re: kern/7480: IP severely broken
Date: Sat, 1 May 1999 14:19:25 +0200

 Hi,

 it looks like this PR is the result of the "fix" in kern/7327.
 The patch below just reverts the effect of 7327.

 A possible better(?) fix is as follows :

 RCS file: /cvsroot/src/sys/netinet/in_var.h,v
 retrieving revision 1.32
 diff -u -r1.32 in_var.h
 --- in_var.h    1998/12/19 02:46:12     1.32
 +++ in_var.h    1999/05/01 12:17:42
 @@ -150,7 +150,8 @@
         /* struct in_ifaddr *ia; */ \
  { \
         for (ia = IN_IFADDR_HASH((addr).s_addr).lh_first; \
 -           ia != NULL && !in_hosteq(ia->ia_addr.sin_addr, (addr)); \
 +           ia != NULL && !in_hosteq(ia->ia_addr.sin_addr, (addr) && \
 +               !(ia->ia_ifp->ifp_flags & IFF_UP)); \
             ia = ia->ia_hash.le_next) \
                  continue; \
  }


 i.E. wade through the interfaces and only stop if it is a match and
 the if is up.

 On Sat, May 01, 1999 at 08:20:01AM -0000, Martin Husemann wrote:
 >  + 		/*
 >  + 		 * XXX - this check is bogus!
 >  + 		 * we may have several interfaces with this address
 >  + 		 * and THIS particular down, the check must be done
 >  + 		 * in INADDR_TO_IA, which should not consider interfaces
 >  + 		 * without IFF_UP !!!
 >    		if (ia->ia_ifp->if_flags & IFF_UP)
 >  + 		 */

 -- 
           See <a href="http://www.netbsd.org">NetBSD</a> for a multiplatform OS
 Nix da, Du Spaghettisultan. Die Blade hat eingezogene Tankflanken damit die 
 gewaltigen Muskelstraenge des athletischen Baendigers (== elwu) sich an die 
 verfuehrerisch geschwungenen Formen anschmiegen kpnnen. -- elwu in d.a.f.rrr


From: "Martin Husemann" <martin@rumolt.teuto.de>
To: "Heiko W.Rupp" <hwr@pilhuhn.de>, <proff@netbsd.org>
Cc: <kern-bug-people@netbsd.org>, <gnats-bugs@netbsd.org>
Subject: RE: kern/7480: IP severely broken
Date: Sat, 1 May 1999 21:07:52 +0200

 > A possible better(?) fix is as follows :

 Here is a version with minor syntactic sugar added ;-) and testet. Works for
 me.


 Martin

 P.S.: Interestingly, only the first part doesn't work - both are needed. Or
 I might have messed something up when testing...


 diff -rc5 /sys/netinet/in_var.h netinet/in_var.h
 *** /sys/netinet/in_var.h	Sat Dec 19 13:19:41 1998
 --- netinet/in_var.h	Sat May  1 20:42:34 1999
 ***************
 *** 148,158 ****
   #define INADDR_TO_IA(addr, ia) \
   	/* struct in_addr addr; */ \
   	/* struct in_ifaddr *ia; */ \
   { \
   	for (ia = IN_IFADDR_HASH((addr).s_addr).lh_first; \
 ! 	    ia != NULL && !in_hosteq(ia->ia_addr.sin_addr, (addr)); \
   	    ia = ia->ia_hash.le_next) \
   		 continue; \
   }

   /*
 --- 148,159 ----
   #define INADDR_TO_IA(addr, ia) \
   	/* struct in_addr addr; */ \
   	/* struct in_ifaddr *ia; */ \
   { \
   	for (ia = IN_IFADDR_HASH((addr).s_addr).lh_first; \
 ! 	    ia != NULL && !in_hosteq(ia->ia_addr.sin_addr, (addr)) && \
 !                !(ia->ia_ifp->if_flags & IFF_UP); \
   	    ia = ia->ia_hash.le_next) \
   		 continue; \
   }

   /*
 Only in netinet: in_var.h.orig
 diff -rc5 /sys/netinet/ip_input.c netinet/ip_input.c
 *** /sys/netinet/ip_input.c	Thu Apr  8 13:26:02 1999
 --- netinet/ip_input.c	Sat May  1 20:58:10 1999
 ***************
 *** 418,431 ****

   	/*
   	 * Check our list of addresses, to see if the packet is for us.
   	 */
   	INADDR_TO_IA(ip->ip_dst, ia);
 ! 	if (ia != NULL) {
 ! 		if (ia->ia_ifp->if_flags & IFF_UP)
 ! 			goto ours;
 ! 	}
   	if (m->m_pkthdr.rcvif->if_flags & IFF_BROADCAST) {
   		for (ifa = m->m_pkthdr.rcvif->if_addrlist.tqh_first;
   		    ifa != NULL; ifa = ifa->ifa_list.tqe_next) {
   			if (ifa->ifa_addr->sa_family != AF_INET) continue;
   			ia = ifatoia(ifa);
 --- 418,429 ----

   	/*
   	 * Check our list of addresses, to see if the packet is for us.
   	 */
   	INADDR_TO_IA(ip->ip_dst, ia);
 ! 	if (ia != NULL)
 ! 		goto ours;
   	if (m->m_pkthdr.rcvif->if_flags & IFF_BROADCAST) {
   		for (ifa = m->m_pkthdr.rcvif->if_addrlist.tqh_first;
   		    ifa != NULL; ifa = ifa->ifa_list.tqe_next) {
   			if (ifa->ifa_addr->sa_family != AF_INET) continue;
   			ia = ifatoia(ifa);


From: Jason Thorpe <thorpej@nas.nasa.gov>
To: gnats-bugs@netbsd.org
Cc: tech-net@netbsd.org, martin@rumolt.teuto.de, hwr@pilhuhn.de
Subject: Re: kern/7480
Date: Mon, 03 May 1999 14:56:35 -0700

 Hi, I just cooked up a change to fix this problem, and when looking at the
 PR, noticed that Heiko cooked up pretty much the same thing.

 This patch should go in ASAP, and be pulled up onto the release branch.

 I'll commit it this afternoon, unless someone beats me to it :-)

         -- Jason R. Thorpe <thorpej@nas.nasa.gov>

 Index: in_var.h
 ===================================================================
 RCS file: /cvsroot/src/sys/netinet/in_var.h,v
 retrieving revision 1.32
 diff -c -r1.32 in_var.h
 *** in_var.h	1998/12/19 02:46:12	1.32
 --- in_var.h	1999/05/03 21:46:42
 ***************
 *** 144,156 ****
   /*
    * Macro for finding whether an internet address (in_addr) belongs to one
    * of our interfaces (in_ifaddr).  NULL if the address isn't ours.
    */
   #define INADDR_TO_IA(addr, ia) \
   	/* struct in_addr addr; */ \
   	/* struct in_ifaddr *ia; */ \
   { \
   	for (ia = IN_IFADDR_HASH((addr).s_addr).lh_first; \
 ! 	    ia != NULL && !in_hosteq(ia->ia_addr.sin_addr, (addr)); \
   	    ia = ia->ia_hash.le_next) \
   		 continue; \
   }
 --- 144,160 ----
   /*
    * Macro for finding whether an internet address (in_addr) belongs to one
    * of our interfaces (in_ifaddr).  NULL if the address isn't ours.
 +  *
 +  * Note that even if we find an interface with the address we're looking
 +  * for, we should skip that interface if it is not up.
    */
   #define INADDR_TO_IA(addr, ia) \
   	/* struct in_addr addr; */ \
   	/* struct in_ifaddr *ia; */ \
   { \
   	for (ia = IN_IFADDR_HASH((addr).s_addr).lh_first; \
 ! 	    ia != NULL && !in_hosteq(ia->ia_addr.sin_addr, (addr)) && \
 ! 	    (ia->ia_ifp->if_flags & IFF_UP) != 0; \
   	    ia = ia->ia_hash.le_next) \
   		 continue; \
   }
 Index: ip_input.c
 ===================================================================
 RCS file: /cvsroot/src/sys/netinet/ip_input.c,v
 retrieving revision 1.84
 diff -c -r1.84 ip_input.c
 *** ip_input.c	1999/04/07 05:34:32	1.84
 --- ip_input.c	1999/05/03 21:46:43
 ***************
 *** 419,428 ****
   	 * Check our list of addresses, to see if the packet is for us.
   	 */
   	INADDR_TO_IA(ip->ip_dst, ia);
 ! 	if (ia != NULL) {
 ! 		if (ia->ia_ifp->if_flags & IFF_UP)
 ! 			goto ours;
 ! 	}
   	if (m->m_pkthdr.rcvif->if_flags & IFF_BROADCAST) {
   		for (ifa = m->m_pkthdr.rcvif->if_addrlist.tqh_first;
   		    ifa != NULL; ifa = ifa->ifa_list.tqe_next) {
 --- 419,426 ----
   	 * Check our list of addresses, to see if the packet is for us.
   	 */
   	INADDR_TO_IA(ip->ip_dst, ia);
 ! 	if (ia != NULL)
 ! 		goto ours;
   	if (m->m_pkthdr.rcvif->if_flags & IFF_BROADCAST) {
   		for (ifa = m->m_pkthdr.rcvif->if_addrlist.tqh_first;
   		    ifa != NULL; ifa = ifa->ifa_list.tqe_next) {

From: Jason Thorpe <thorpej@nas.nasa.gov>
To: gnats-bugs@netbsd.org
Cc: tech-net@netbsd.org, martin@rumolt.teuto.de, hwr@pilhuhn.de
Subject: Re: kern/7480 
Date: Mon, 03 May 1999 15:01:47 -0700

 On Mon, 03 May 1999 14:56:35 -0700 
  Jason Thorpe <thorpej@nas.nasa.gov> wrote:

  > This patch should go in ASAP, and be pulled up onto the release branch.

 ack, nevermind... this patch has a bug in it... I booted the wrong kernel
 when I tested it.

 Note the obvious typo in the added for() termination clause...

  > Index: in_var.h
  > ===================================================================
  > RCS file: /cvsroot/src/sys/netinet/in_var.h,v
  > retrieving revision 1.32
  > diff -c -r1.32 in_var.h
  > *** in_var.h	1998/12/19 02:46:12	1.32
  > --- in_var.h	1999/05/03 21:46:42
  > ***************
  > *** 144,156 ****
  >   /*
  >    * Macro for finding whether an internet address (in_addr) belongs to one
  >    * of our interfaces (in_ifaddr).  NULL if the address isn't ours.
  >    */
  >   #define INADDR_TO_IA(addr, ia) \
  >   	/* struct in_addr addr; */ \
  >   	/* struct in_ifaddr *ia; */ \
  >   { \
  >   	for (ia = IN_IFADDR_HASH((addr).s_addr).lh_first; \
  > ! 	    ia != NULL && !in_hosteq(ia->ia_addr.sin_addr, (addr)); \
  >   	    ia = ia->ia_hash.le_next) \
  >   		 continue; \
  >   }
  > --- 144,160 ----
  >   /*
  >    * Macro for finding whether an internet address (in_addr) belongs to one
  >    * of our interfaces (in_ifaddr).  NULL if the address isn't ours.
  > +  *
  > +  * Note that even if we find an interface with the address we're looking
  > +  * for, we should skip that interface if it is not up.
  >    */
  >   #define INADDR_TO_IA(addr, ia) \
  >   	/* struct in_addr addr; */ \
  >   	/* struct in_ifaddr *ia; */ \
  >   { \
  >   	for (ia = IN_IFADDR_HASH((addr).s_addr).lh_first; \
  > ! 	    ia != NULL && !in_hosteq(ia->ia_addr.sin_addr, (addr)) && \
  > ! 	    (ia->ia_ifp->if_flags & IFF_UP) != 0; \
  >   	    ia = ia->ia_hash.le_next) \
  >   		 continue; \
  >   }
  > Index: ip_input.c
  > ===================================================================
  > RCS file: /cvsroot/src/sys/netinet/ip_input.c,v
  > retrieving revision 1.84
  > diff -c -r1.84 ip_input.c
  > *** ip_input.c	1999/04/07 05:34:32	1.84
  > --- ip_input.c	1999/05/03 21:46:43
  > ***************
  > *** 419,428 ****
  >   	 * Check our list of addresses, to see if the packet is for us.
  >   	 */
  >   	INADDR_TO_IA(ip->ip_dst, ia);
  > ! 	if (ia != NULL) {
  > ! 		if (ia->ia_ifp->if_flags & IFF_UP)
  > ! 			goto ours;
  > ! 	}
  >   	if (m->m_pkthdr.rcvif->if_flags & IFF_BROADCAST) {
  >   		for (ifa = m->m_pkthdr.rcvif->if_addrlist.tqh_first;
  >   		    ifa != NULL; ifa = ifa->ifa_list.tqe_next) {
  > --- 419,426 ----
  >   	 * Check our list of addresses, to see if the packet is for us.
  >   	 */
  >   	INADDR_TO_IA(ip->ip_dst, ia);
  > ! 	if (ia != NULL)
  > ! 		goto ours;
  >   	if (m->m_pkthdr.rcvif->if_flags & IFF_BROADCAST) {
  >   		for (ifa = m->m_pkthdr.rcvif->if_addrlist.tqh_first;
  >   		    ifa != NULL; ifa = ifa->ifa_list.tqe_next) {

         -- Jason R. Thorpe <thorpej@nas.nasa.gov>

State-Changed-From-To: open->closed 
State-Changed-By: thorpej 
State-Changed-When: Mon May 3 15:14:10 PDT 1999 
State-Changed-Why:  
Fixed. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.