Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Jan 2000 07:22:54 -0800 (PST)
From:      <ru@FreeBSD.org>
To:        jin@george.lbl.gov, ru@FreeBSD.org, freebsd-bugs@FreeBSD.org
Subject:   Re: bin/2258: route add/delete [network] xxx.yyy.zzz.0 my-IP
Message-ID:  <200001251522.HAA61853@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
Synopsis: route add/delete [network] xxx.yyy.zzz.0 my-IP

State-Changed-From-To: open->closed
State-Changed-By: ru
State-Changed-When: Tue Jan 25 06:56:21 PST 2000
State-Changed-Why: 
The third argument of the route(8) (in the "old form") is treated
as a netmask value, so the following command

# route add 198.207.143.0 127.0.0.1 1

is, in fact, only a short equivalent of the

# route add -net 198.207.143.0 -netmask 1 127.0.0.1

You can see this with the following (non-destructive) command:

# route -vnt add -net 198.207.143.0 -netmask 1 127.0.0.1
[...]
sockaddrs: <DST,GATEWAY,NETMASK>
 198.207.143.0 127.0.0.1 0.0.0.1
add net 198.207.143.0: gateway 127.0.0.1

Applying mask of 0.0.0.1 to 198.207.143.0 gives 0.0.0.0/0.0.0.1.
That is what is actually stored in the kernel routing table.

To delete this entry, simply execute:
# route delete 0 -netmask 1

To dump the entire routing table (note the magic -d option), run:
# route -vnd flush

Actually, the only problem is the way netstat(1) reports "default"
route for (in fact) non-default routes, but this has already been
fixed in 4.0-CURRENT (see src/sbin/route/route.c,v 1.41).

I will be MFC'ing this into -STABLE right now.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200001251522.HAA61853>