From nobody@FreeBSD.ORG  Tue Sep 26 07:53:39 2000
Return-Path: <nobody@FreeBSD.ORG>
Received: by hub.freebsd.org (Postfix, from userid 32767)
	id DF30537B449; Tue, 26 Sep 2000 07:53:33 -0700 (PDT)
Message-Id: <20000926145333.DF30537B449@hub.freebsd.org>
Date: Tue, 26 Sep 2000 07:53:33 -0700 (PDT)
From: madamus@connectalk.com
Sender: nobody@FreeBSD.ORG
To: freebsd-gnats-submit@FreeBSD.org
Subject: route takes the netmask as the default gateway, creating a bad route.
X-Send-Pr-Version: www-1.0

>Number:         21561
>Category:       misc
>Synopsis:       route takes the netmask as the default gateway, creating a bad route.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Sep 26 08:00:00 PDT 2000
>Closed-Date:    Tue Sep 26 10:14:09 PDT 2000
>Last-Modified:  Tue Sep 26 10:14:39 PDT 2000
>Originator:     Michel Adamus
>Release:        4.1
>Organization:
ConnecTalk
>Environment:
FreeBSD apollo.connectalk.com 4.1-RELEASE FreeBSD 4.1-RELEASE #0: Sat Sep 23 15:41:27 EDT 2000     madamus@apollo.connectalk.com:/usr/src/sys/compile/APOLLO  i386

>Description:
route -n add -net 10.150.200.0 255.255.252.0 10.125.200.199

will add a bad route to the system. A route that can't be deleted.

It looks like this using "netstat -rn"
Destination         Gateway            Flags      Netif Expire
default             10.125.204.1       UGSc        3        9     fxp0
10.20.200&0xa7dc8c7 255.255.252.0      UGSc        0        0     fxp0

the correct route command should be:
route -n add -net 10.150.200.0 -netmask 255.255.252.0 10.125.200.199

Comment: route should not allow this.
>How-To-Repeat:
Simply omit the "-netmask" when adding a new route.
>Fix:
reboot

>Release-Note:
>Audit-Trail:

From: Ruslan Ermilov <ru@sunbay.com>
To: madamus@connectalk.com
Cc: bug-followup@FreeBSD.org
Subject: Re: misc/21561: route takes the netmask as the default gateway, creating a bad route.
Date: Tue, 26 Sep 2000 20:01:19 +0300

 On Tue, Sep 26, 2000 at 07:53:33AM -0700, madamus@connectalk.com wrote:
 > 
 > route -n add -net 10.150.200.0 255.255.252.0 10.125.200.199
 > 
 > will add a bad route to the system. A route that can't be deleted.
 > 
 > It looks like this using "netstat -rn"
 > Destination         Gateway            Flags      Netif Expire
 > default             10.125.204.1       UGSc        3        9     fxp0
 > 10.20.200&0xa7dc8c7 255.255.252.0      UGSc        0        0     fxp0
 > 
 > the correct route command should be:
 > route -n add -net 10.150.200.0 -netmask 255.255.252.0 10.125.200.199
 > 
 > Comment: route should not allow this.
 > 
 Nope, the route(1) is correct about it.  Actually (and I think it is
 provided for backwards compatibility, thus undocumented) the format is:
 
 route [-n] command [-net | -host] destination gateway [netmask]
                                                        ^^^^^^^
 So, the
 	route -n add -net 10.150.200.0 255.255.252.0 10.125.200.199
 is equivalent to the
 	route -n add -net 10.150.200.0 -netmask 10.125.200.199 255.255.252.0
 You will get the same `weird' route in the second case.
 
 To delete this route, simply execute:
 	route delete 10.20.200.0 -netmask 10.125.200.199
 
 To add the correct route, either:
 	route add -net 10.150.200.0 -netmask 255.255.252.0 10.125.200.199
 or
 	route add -net 10.150.200.0 10.125.200.199 255.255.252.0
 or
 	route add 10.150.200.0/22 10.125.200.199
 
 
 Cheers,
 -- 
 Ruslan Ermilov		Oracle Developer/DBA,
 ru@sunbay.com		Sunbay Software AG,
 ru@FreeBSD.org		FreeBSD committer,
 +380.652.512.251	Simferopol, Ukraine
 
 http://www.FreeBSD.org	The Power To Serve
 http://www.oracle.com	Enabling The Information Age
 
State-Changed-From-To: open->closed 
State-Changed-By: ru 
State-Changed-When: Tue Sep 26 10:14:09 PDT 2000 
State-Changed-Why:  
Pilot error, explained. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=21561 
>Unformatted:
