NetBSD Problem Report #9387
Received: (qmail 6315 invoked from network); 10 Feb 2000 12:17:19 -0000
Message-Id: <200002101217.VAA14370@stone.iij.ad.jp>
Date: Thu, 10 Feb 2000 21:17:16 +0900 (JST)
From: <nrt@iij.ad.jp>
Reply-To: nrt@iij.ad.jp
To: gnats-bugs@gnats.netbsd.org
Subject: Forwarding loop on down interfaces
X-Send-Pr-Version: 3.95
>Number: 9387
>Category: kern
>Synopsis: Forwarding loop on down interfaces
>Confidential: no
>Severity: critical
>Priority: medium
>Responsible: kern-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Feb 10 04:18:00 +0000 2000
>Closed-Date: Thu Jul 12 09:57:48 +0000 2001
>Last-Modified: Thu Jul 12 09:57:48 +0000 2001
>Originator: NARITA Tomio
>Release: NetBSD-current
>Organization:
NARITA Tomio
nrt@iij.ad.jp
Internet Initiative Japan, Inc.
>Environment:
Latest-current
>Description:
When a packet whose destination address is one of local
DOWN interface is passed to ip_input(), the packet is
forwarded to loopback interface over and over again
until TTL expires.
>How-To-Repeat:
ifconfig [interface] down
traceroute [address relevant to the interface]
>Fix:
When a packet is destined to DOWN interface,
kernel reacts to that with ICMP Host Unreachable.
I think the ICMP message may be ignored if the source address
is also destined to DOWN interface.
*** ip_input.c.orig Thu Feb 10 20:58:51 2000
--- ip_input.c Thu Feb 10 20:38:16 2000
***************
*** 488,494 ****
/*
* 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) {
--- 488,505 ----
/*
* Check our list of addresses, to see if the packet is for us.
*/
! for (ia = IN_IFADDR_HASH(ip->ip_dst.s_addr).lh_first;
! ia != NULL;
! ia = ia->ia_hash.le_next) {
! if (in_hosteq(ia->ia_addr.sin_addr, ip->ip_dst) )
! if ( (ia->ia_ifp->if_flags & IFF_UP) != 0 )
! break;
! else {
! icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_HOST,
! 0, m->m_pkthdr.rcvif);
! return;
! }
! }
if (ia != NULL)
goto ours;
if (m->m_pkthdr.rcvif->if_flags & IFF_BROADCAST) {
>Release-Note:
>Audit-Trail:
From: itojun@iijlab.net
To: tech-net@netbsd.org
Cc: nrt@iij.ad.jp
Subject: Re: kern/9387: Forwarding loop on down interfaces
Date: Fri, 11 Feb 2000 03:57:16 +0900
>>Number: 9387
>>Category: kern
>>Synopsis: Forwarding loop on down interfaces
This one is quite serious IMHO. I think it needs to go into 1.4.2.
4.4BSD accepted packets to address on !IFF_UP interfaces.
For example, you can ping 10.1.1.1 in the following scenario
with 4.4BSD.
# ifconfig lo1 10.1.1.1
# ping 10.1.1.1 <--- works as expected
# ifconfig lo0 down
# ping 10.1.1.1 <--- still works
{free,open}bsd still behave like this.
In early 1999 netbsd changed behavior to not to accept it. however,
the code does not drop it so it will go into ip_forwarding.
ip_forwarding would send it to loopback, then the packet comes back
in with ttl -= 1. we'll see the loop until ttl goes to 0.
What is the right behavior here?
1. revert to traditional 4.4BSD behavior. accept packets to
address on !IFF_UP interface. (people who likes weak model will
like the behavior)
2. silently discard it
3. try to send icmp error only once (note that it may not be able to
go out the node, and it may come back to itself via loopback)
Tomio's patch achieves this.
I'm in favor of 3 at this moment, but I'm not sure if I'm thinking
correctly - so I need your second opinion.
itojun
From: itojun@iijlab.net
To: tech-net@netbsd.org
Cc: nrt@iij.ad.jp, gnats-bugs@gnats.netbsd.org
Subject: Re: kern/9387: Forwarding loop on down interfaces
Date: Fri, 11 Feb 2000 04:01:05 +0900
> 4.4BSD accepted packets to address on !IFF_UP interfaces.
> For example, you can ping 10.1.1.1 in the following scenario
> with 4.4BSD.
> # ifconfig lo1 10.1.1.1
> # ping 10.1.1.1 <--- works as expected
> # ifconfig lo0 down
> # ping 10.1.1.1 <--- still works
as you may have guessed 3rd line should read "ifconfig lo1 down".
itojun
State-Changed-From-To: open->feedback
State-Changed-By: itojun
State-Changed-When: Thu Feb 10 22:04:33 PST 2000
State-Changed-Why:
committed he attached fix. the "right" behavior is still debetable
(whether to send unreach, semantcs of IFF_UP, etc) though.
From: "Erik E. Fair" <fair@clock.org>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: kern/9387
Date: Mon, 26 Jun 2000 23:47:20 -0700
There is an argument to be made that "ifconfig <inf> down" should
cause the kernel to remove all routes to/through that interface, and
that marking an interface up ought to add the interface routes...
Erik <fair@clock.org>
From: Jason R Thorpe <thorpej@zembu.com>
To: "Erik E. Fair" <fair@clock.org>
Cc: kern-bug-people@netbsd.org, gnats-bugs@netbsd.org
Subject: Re: kern/9387
Date: Mon, 26 Jun 2000 23:53:39 -0700
On Tue, Jun 27, 2000 at 06:48:01AM -0000, Erik E. Fair wrote:
> The following reply was made to PR kern/9387; it has been noted by GNATS.
>
> From: "Erik E. Fair" <fair@clock.org>
> To: gnats-bugs@netbsd.org
> Cc:
> Subject: Re: kern/9387
> Date: Mon, 26 Jun 2000 23:47:20 -0700
>
> There is an argument to be made that "ifconfig <inf> down" should
> cause the kernel to remove all routes to/through that interface, and
> that marking an interface up ought to add the interface routes...
No, ifconfig "delete" should delete the address and the routes, but
not "down". "down" should simply inform any routing daemons listening
on the routing socket that the link is down, and let them decide (which,
BTW, is what currently happens).
--
-- Jason R. Thorpe <thorpej@zembu.com>
From: Tim Rightnour <root@garbled.net>
To: nrt@iij.ad.jp
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: kern/9387
Date: Thu, 08 Mar 2001 08:19:39 -0700 (MST)
Looking over the feedback in this PR, it would appear that your patch has been
applied. Do you have any objections to the closing of this PR, or are you
still experiencing the problem?
---
Tim Rightnour <root@garbled.net>
NetBSD: Free multi-architecture OS http://www.netbsd.org/
NetBSD supported hardware database: http://mail-index.netbsd.org/cgi-bin/hw.cgi
State-Changed-From-To: feedback->closed
State-Changed-By: itojun
State-Changed-When: Thu Jul 12 02:57:39 PDT 2001
State-Changed-Why:
fixed, confirmed
>Unformatted:
(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.