Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Feb 2000 21:07:26 -0800 (PST)
From:      Jin Guojun (FTG staff) <jin@george.lbl.gov>
To:        freebsd-bugs@FreeBSD.ORG, ru@FreeBSD.ORG
Subject:   Re: bin/2258: route add/delete [network] xxx.yyy.zzz.0 my-IP
Message-ID:  <200002160507.VAA23974@george.lbl.gov>

next in thread | raw e-mail | index | archive | help
Nothing seems having been fixed at this point.

# uname -r
4.0-20000210-CURRENT
# netstat -r
Routing tables

Internet:
Destination        Gateway            Flags      Netif Expire
default            adsl-63-198-35-121 UGSc        ep0
adsl-63-198-35-120 link#2             UC          ep0 =>
adsl-63-198-35-121 0:10:67:0:4b:75    UHLW        ep0   1037

# route add default 128.33.196.11 1
add net default: gateway 128.33.196.11
# netstat -r
Routing tables

Internet:
Destination        Gateway            Flags      Netif Expire
^C
spode# !!n
netstat -rn
Routing tables

Internet:
Destination        Gateway            Flags      Netif Expire
0&0x1              128.33.196.11      UGSc        ep0 =>
default            63.198.35.121      UGSc        ep0
63.198.35.120/29   link#2             UC          ep0 =>
63.198.35.121      0:10:67:0:4b:75    UHLW        ep0    983
127.0.0.1          127.0.0.1          UH          lo0

# route delete default 128.33.196.11 
delete net default: gateway 128.33.196.11
spode# netstat -r
Routing tables

Internet:
Destination        Gateway            Flags      Netif Expire
^C
spode# !!n
netstat -rn
Routing tables

Internet:
Destination        Gateway            Flags      Netif Expire
0&0x1              128.33.196.11      UGSc        ep0
63.198.35.120/29   link#2             UC          ep0 =>
63.198.35.121      0:10:67:0:4b:75    UHLW        ep0    948
127.0.0.1          127.0.0.1          UH          lo0

# traceroute ftp.freebsd.org
^C
# traceroute 209.155.82.18
traceroute to 209.155.82.18 (209.155.82.18), 30 hops max, 40 byte packets
 1  *^C

Now, no more network connection, the system needs to be reboot.
Here is two critical parts:
(1) route should never try to add second "default" if the default router
is alread set.

(2) "route delete " did not correctly remove the specified item.

regards,

	-Jin



------------- original message -------------
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?200002160507.VAA23974>