NetBSD Problem Report #40455
From reed@reedmedia.net Thu Jan 22 21:24:55 2009
Return-Path: <reed@reedmedia.net>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by narn.NetBSD.org (Postfix) with ESMTP id 0E5B763B121
for <gnats-bugs@gnats.NetBSD.org>; Thu, 22 Jan 2009 21:24:55 +0000 (UTC)
Message-Id: <27618-1232659495@reedmedia.net>
Date: Thu, 22 Jan 2009 15:24:56 -0600
From: reed@reedmedia.net
Reply-To: reed@reedmedia.net
To: gnats-bugs@gnats.NetBSD.org
Subject: route can't change reject to blackhole
X-Send-Pr-Version: 3.95
>Number: 40455
>Category: bin
>Synopsis: route can't change reject to blackhole
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kefren
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Jan 22 21:25:00 +0000 2009
>Closed-Date: Tue Jul 05 06:57:34 +0000 2011
>Last-Modified: Tue Jul 05 06:57:34 +0000 2011
>Originator: reed@reedmedia.net
>Release: NetBSD
>Organization:
Jeremy C. Reed
>Environment:
>Description:
Saw this on i386 and amd64 with 4.0 and 5.0_BETA and old 4.99.
here is on 5.0_BETA from few weeks ago:
$ sudo route add 207.46.197.32 127.0.0.1 -reject
add host 207.46.197.32: gateway 127.0.0.1
$ route -n show -inet | grep ^207.46
207.46.197.32 127.0.0.1 UGHR
$ sudo route change 207.46.197.32 127.0.0.1 -blackhole
change host 207.46.197.32: gateway 127.0.0.1
$ route -n show -inet | grep ^207.46
207.46.197.32 127.0.0.1 UGHR
$ netstat -rn -f inet | grep ^207.46
207.46.197.32 127.0.0.1 UGHRS 0 0 33648 lo0
So it still shows "R" for reject.
Also same problem if create blackhole first and try to change to reject.
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: bin-bug-people->kefren
Responsible-Changed-By: kefren@NetBSD.org
Responsible-Changed-When: Sun, 02 May 2010 22:00:08 +0000
Responsible-Changed-Why:
mine
From: Mihai Chelaru <kefren@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, reed@reedmedia.net
Subject: Re: bin/40455 (route can't change reject to blackhole)
Date: Mon, 03 May 2010 01:02:48 +0300
The problem is that rtsock is ignoring flags at RTM_CHANGE. Is this
patch resolving the issue ?
Index: sys/net/rtsock.c
===================================================================
RCS file: /cvsroot/src/sys/net/rtsock.c,v
retrieving revision 1.128
diff -u -p -r1.128 rtsock.c
--- sys/net/rtsock.c 2 May 2010 19:17:56 -0000 1.128
+++ sys/net/rtsock.c 2 May 2010 21:50:21 -0000
@@ -95,6 +95,8 @@ __KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1
DOMAIN_DEFINE(routedomain); /* forward declare and add to link set */
+#define PRESERVED_RTF (RTF_UP | RTF_GATEWAY | RTF_HOST | RTF_DONE |
RTF_MASK)
+
struct sockaddr route_dst = { .sa_len = 2, .sa_family = PF_ROUTE, };
struct sockaddr route_src = { .sa_len = 2, .sa_family = PF_ROUTE, };
@@ -437,6 +439,9 @@ route_output(struct mbuf *m, ...)
}
rt_setmetrics(rtm->rtm_inits, &rtm->rtm_rmx,
&rt->rt_rmx);
+ if (rt->rt_flags != info.rti_flags)
+ rt->rt_flags = (info.rti_flags & ~PRESERVED_RTF)
+ | (rt->rt_flags & PRESERVED_RTF);
if (rt->rt_ifa && rt->rt_ifa->ifa_rtrequest)
rt->rt_ifa->ifa_rtrequest(RTM_ADD, rt, &info);
/*FALLTHROUGH*/
--
Mihai
From: Mihai Chelaru <mihai.chelaru@NGNetworks.ro>
To: gnats-bugs@NetBSD.org
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, reed@reedmedia.net
Subject: Re: bin/40455 (route can't change reject to blackhole)
Date: Tue, 11 May 2010 22:45:45 +0300
This is a multi-part message in MIME format.
--------------010209080508090403020908
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Probably you'll also find this diff useful.
--------------010209080508090403020908
Content-Type: text/plain;
name="rej.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="rej.diff"
Index: keywords.c
===================================================================
RCS file: /cvsroot/src/sbin/route/keywords.c,v
retrieving revision 1.6
diff -u -p -r1.6 keywords.c
--- keywords.c 6 Aug 2006 17:44:56 -0000 1.6
+++ keywords.c 11 May 2010 19:43:05 -0000
@@ -57,6 +57,8 @@ struct keytab keywords[] = {
{"xns", K_XNS},
{"xresolve", K_XRESOLVE},
{"flushall", K_FLUSHALL},
+ {"noblackhole", K_NOBLACKHOLE},
+ {"noreject", K_NOREJECT},
{0, 0}
};
Index: keywords.h
===================================================================
RCS file: /cvsroot/src/sbin/route/keywords.h,v
retrieving revision 1.9
diff -u -p -r1.9 keywords.h
--- keywords.h 6 Aug 2006 17:44:56 -0000 1.9
+++ keywords.h 11 May 2010 19:43:05 -0000
@@ -59,3 +59,5 @@ extern struct keytab {
#define K_FLUSHALL 49
#define K_NOCLONED 50
#define K_NOCLONING 51
+#define K_NOBLACKHOLE 52
+#define K_NOREJECT 53
Index: route.8
===================================================================
RCS file: /cvsroot/src/sbin/route/route.8,v
retrieving revision 1.40
diff -u -p -r1.40 route.8
--- route.8 6 Aug 2006 23:38:13 -0000 1.40
+++ route.8 11 May 2010 19:43:05 -0000
@@ -267,19 +267,21 @@ when sending to destinations matched by
These flags may be set (or sometimes cleared)
by indicating the following corresponding modifiers:
.Bd -literal
--cloning RTF_CLONING - generates a new route on use
--nocloning ~RTF_CLONING - stop generating new routes on use
--cloned RTF_CLONED - cloned route generated by RTF_CLONING
--nocloned ~RTF_CLONED - prevent removal with RTF_CLONING parent
--xresolve RTF_XRESOLVE - emit mesg on use (for external lookup)
--iface ~RTF_GATEWAY - destination is directly reachable
--static RTF_STATIC - manually added route
--nostatic ~RTF_STATIC - pretend route added by kernel or daemon
--reject RTF_REJECT - emit an ICMP unreachable when matched
--blackhole RTF_BLACKHOLE - silently discard pkts (during updates)
--proto1 RTF_PROTO1 - set protocol specific routing flag #1
--proto2 RTF_PROTO2 - set protocol specific routing flag #2
--llinfo RTF_LLINFO - validly translates proto addr to link addr
+-cloning RTF_CLONING - generates a new route on use
+-nocloning ~RTF_CLONING - stop generating new routes on use
+-cloned RTF_CLONED - cloned route generated by RTF_CLONING
+-nocloned ~RTF_CLONED - prevent removal with RTF_CLONING parent
+-xresolve RTF_XRESOLVE - emit mesg on use (for external lookup)
+-iface ~RTF_GATEWAY - destination is directly reachable
+-static RTF_STATIC - manually added route
+-nostatic ~RTF_STATIC - pretend route added by kernel or daemon
+-reject RTF_REJECT - emit an ICMP unreachable when matched
+-noreject ~RTF_REJECT - clear reject flag
+-blackhole RTF_BLACKHOLE - silently discard pkts (during updates)
+-noblackhole ~RTF_BLACKHOLE - clear blackhole flag
+-proto1 RTF_PROTO1 - set protocol specific routing flag #1
+-proto2 RTF_PROTO2 - set protocol specific routing flag #2
+-llinfo RTF_LLINFO - validly translates proto addr to link addr
.Ed
.Pp
The optional modifiers
Index: route.c
===================================================================
RCS file: /cvsroot/src/sbin/route/route.c,v
retrieving revision 1.119
diff -u -p -r1.119 route.c
--- route.c 28 Dec 2008 20:12:31 -0000 1.119
+++ route.c 11 May 2010 19:43:05 -0000
@@ -843,9 +843,15 @@ newroute(int argc, char *const *argv)
case K_REJECT:
flags |= RTF_REJECT;
break;
+ case K_NOREJECT:
+ flags &= ~RTF_REJECT;
+ break;
case K_BLACKHOLE:
flags |= RTF_BLACKHOLE;
break;
+ case K_NOBLACKHOLE:
+ flags &= ~RTF_BLACKHOLE;
+ break;
case K_CLONED:
flags |= RTF_CLONED;
break;
--------------010209080508090403020908--
State-Changed-From-To: open->feedback
State-Changed-By: kefren@NetBSD.org
State-Changed-When: Tue, 11 May 2010 19:52:04 +0000
State-Changed-Why:
patches sent, awaiting feedback
From: Christos Zoulas <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/40455 CVS commit: src/sbin/route
Date: Wed, 12 May 2010 13:56:13 -0400
Module Name: src
Committed By: christos
Date: Wed May 12 17:56:13 UTC 2010
Modified Files:
src/sbin/route: keywords.c keywords.h route.8 route.c
Log Message:
PR/40455: Mihai Chelaru: Add noreject noblackhole options
To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sbin/route/keywords.c
cvs rdiff -u -r1.9 -r1.10 src/sbin/route/keywords.h
cvs rdiff -u -r1.40 -r1.41 src/sbin/route/route.8
cvs rdiff -u -r1.119 -r1.120 src/sbin/route/route.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: feedback->open
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 31 Jan 2011 08:08:09 +0000
State-Changed-Why:
feedback timeout, patches committed, should probably be pulled up to -5
From: Mihai Chelaru <kefren@NetBSD.org>
To: gnats-bugs@NetBSD.org
Cc: dholland@NetBSD.org, netbsd-bugs@netbsd.org, gnats-admin@netbsd.org,
reed@reedmedia.net
Subject: Re: bin/40455 (route can't change reject to blackhole)
Date: Mon, 31 Jan 2011 11:53:34 +0200
On 01/31/11 10:08, dholland@NetBSD.org wrote:
> State-Changed-Why:
> feedback timeout, patches committed, should probably be pulled up to -5
sys/net/rtsock.c patch was commited ? I don't have access to repository
right now and cvsweb.n.o looks down.
--
Mihai
From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/40455 (route can't change reject to blackhole)
Date: Mon, 31 Jan 2011 18:48:46 +0000
On Mon, Jan 31, 2011 at 11:53:34AM +0200, Mihai Chelaru wrote:
> On 01/31/11 10:08, dholland@NetBSD.org wrote:
> > State-Changed-Why:
> > feedback timeout, patches committed, should probably be pulled up to -5
>
> sys/net/rtsock.c patch was commited ? I don't have access to repository
> right now and cvsweb.n.o looks down.
No, apparently Christos committed only the later patches, so I take it
back. Is there any reason *not* to commit the other patch?
--
David A. Holland
dholland@netbsd.org
From: Mihai Chelaru <mihai.chelaru@ngnetworks.ro>
To: gnats-bugs@NetBSD.org, kefren@NetBSD.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, reed@reedmedia.net
Cc:
Subject: Re: bin/40455 (route can't change reject to blackhole)
Date: Tue, 01 Feb 2011 08:17:10 +0200
----- Original message -----
>Â No, apparently Christos committed only the later patches, so I take it
>Â back. Is there any reason *not* to commit the other patch?
None that I'm aware of.
--
Mihai
From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/40455 (route can't change reject to blackhole)
Date: Mon, 7 Feb 2011 06:10:26 +0000
On Tue, Feb 01, 2011 at 06:20:04AM +0000, Mihai Chelaru wrote:
>> No, apparently Christos committed only the later patches, so I take it
>> back. Is there any reason *not* to commit the other patch?
>
> None that I'm aware of.
...so is there a reason you're waiting? :-)
(I'm not familiar with this code, but if you want a second opinion
before committing it shouldn't be hard to get one.)
--
David A. Holland
dholland@netbsd.org
From: Mihai Chelaru <kefren@NetBSD.org>
To: gnats-bugs@NetBSD.org
Cc: David Holland <dholland-bugs@netbsd.org>, gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org, reed@reedmedia.net
Subject: Re: bin/40455 (route can't change reject to blackhole)
Date: Tue, 08 Feb 2011 09:40:11 +0200
On 02/07/11 09:32, David Holland wrote:
> ...so is there a reason you're waiting? :-)
>
> (I'm not familiar with this code, but if you want a second opinion
> before committing it shouldn't be hard to get one.)
I'll ask on tech-net@ about it.
--
Mihai
From: "Antti Kantee" <pooka@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/40455 CVS commit: src/tests/net
Date: Tue, 8 Feb 2011 10:11:29 +0000
Module Name: src
Committed By: pooka
Date: Tue Feb 8 10:11:29 UTC 2011
Modified Files:
src/tests/net: Makefile
Added Files:
src/tests/net/route: Makefile t_change.sh
Log Message:
Time to start adding tests for the routing code to make that part
of the kernel more approachable.
Begin the task with an xfail test for PR kern/40455.
To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/net/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/net/route/Makefile \
src/tests/net/route/t_change.sh
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/40455 (route can't change reject to blackhole)
Date: Wed, 9 Feb 2011 02:21:30 +0000
On Tue, Feb 08, 2011 at 07:45:03AM +0000, Mihai Chelaru wrote:
>> ...so is there a reason you're waiting? :-)
>>
>> (I'm not familiar with this code, but if you want a second opinion
>> before committing it shouldn't be hard to get one.)
>
> I'll ask on tech-net@ about it.
Thanks.
--
David A. Holland
dholland@netbsd.org
From: "Mihai Chelaru" <kefren@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/40455 CVS commit: src/sys/net
Date: Thu, 10 Feb 2011 07:42:19 +0000
Module Name: src
Committed By: kefren
Date: Thu Feb 10 07:42:18 UTC 2011
Modified Files:
src/sys/net: rtsock.c
Log Message:
Allow changing route flags. Should fix PR/40455
OK'ed: dyoung@
To generate a diff of this commit:
cvs rdiff -u -r1.133 -r1.134 src/sys/net/rtsock.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->feedback
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sat, 12 Feb 2011 20:25:03 +0000
State-Changed-Why:
How does that work?
State-Changed-From-To: feedback->closed
State-Changed-By: kefren@NetBSD.org
State-Changed-When: Tue, 05 Jul 2011 06:57:34 +0000
State-Changed-Why:
Feedback timeout, problem looks solved.
Here is the redo of submitter's test:
kefren# uname -srm
NetBSD 5.99.54 amd64
kefren# route add 207.46.197.32 127.0.0.1 -reject
add host 207.46.197.32: gateway 127.0.0.1
kefren# route -n show -inet | grep ^207.46
207.46.197.32 127.0.0.1 UGHR
kefren# route change 207.46.197.32 127.0.0.1 -blackhole
change host 207.46.197.32: gateway 127.0.0.1
kefren# route -n show -inet | grep ^207.46
207.46.197.32 127.0.0.1 UGH
kefren# netstat -rn -f inet | grep ^207.46
207.46.197.32 127.0.0.1 UGHBS 0 0 33648 lo0
>Unformatted:
(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.