Subject: cannot delete & duplicate entries WAS: Re: strange routing behavior: wrong route picked
To: None <tech-net@netbsd.org, tech-kern@netbsd.org>
From: Tad Hunt <tad@entrisphere.com>
List: tech-kern
Date: 11/07/2002 20:03:23
More related oddities. As before, "netstat -nr" tells me that
there is a route to 192.168.1.2 through 192.168.1.1. However,
"route get 192.168.1.2" gives the default route.
Attempting to delete the route to 192.168.1.2 gives an error, as
if it cannot find such a route. If I add the route, netstat shows
two routes, but now the packets go where they are supposed to.
Thanks,
-Tad
-------------------------------------------------------------------------------
# netstat -nr
Routing tables
Internet:
Destination Gateway Flags Refs Use Mtu Interface
default 192.168.167.1 UGS 3 3866 1500 fe0
127 127.0.0.1 UR 0 0 33228 lo0
127.0.0.1 127.0.0.1 UH 1 0 33228 lo0
192.168.1.1 127.0.0.1 UGH 0 0 33228 lo0
192.168.1.2 192.168.1.1 UH 0 0 512 tun0
192.168.167 link#1 UC 0 0 1500 fe0
192.168.167.1 00:01:30:1e:4d:c0 UHL 1 0 1500 fe0
#
#
#
# route get 192.168.1.2
route to: 192.168.1.2
destination: default
mask: default
gateway: 192.168.167.1
local addr: fab1197.int.entrisphere.com
interface: fe0
flags: <UP,GATEWAY,DONE,STATIC>
recvpipe sendpipe ssthresh rtt,msec rttvar hopcount mtu expire
0 0 0 0 0 0 1500 0
#
#
# route delete -host 192.168.1.2
writing to routing socket: No such process
delete host 192.168.1.2: Bad file descriptor
#
# route add -host 192.168.1.2 192.168.1.1
add host 192.168.1.2: gateway 192.168.1.1
#
#
# route get 192.168.1.2
route to: 192.168.1.2
destination: 192.168.1.2
gateway: 192.168.1.1
local addr: 192.168.1.1
interface: tun0
flags: <UP,GATEWAY,HOST,DONE,STATIC>
recvpipe sendpipe ssthresh rtt,msec rttvar hopcount mtu expire
0 0 0 0 0 0 33228 0
#
#
# netstat -nr
Routing tables
Internet:
Destination Gateway Flags Refs Use Mtu Interface
default 192.168.167.1 UGS 3 4169 1500 fe0
127 127.0.0.1 UR 0 0 33228 lo0
127.0.0.1 127.0.0.1 UH 1 0 33228 lo0
192.168.1.1 127.0.0.1 UGH 1 0 33228 lo0
192.168.1.2 192.168.1.1 UGHS 0 0 33228 tun0
192.168.1.2 192.168.1.1 UH 0 0 512 tun0
192.168.167 link#1 UC 0 0 1500 fe0
192.168.167.1 00:01:30:1e:4d:c0 UHL 1 0 1500 fe0
#
In message <MOBYDICKlrjbudzxxfY00000123@mobydick.int.entrisphere.com>, you said:
;
;I've attached what I think is the relevant output below.
;
;Notice the route for 192.168.1.1, which should be reachable via
;interface tun8. For some reason that I cannot fathom, "route get
;192.168.1.1" tells me that it's using the default route out the
;"fe0" interface, instead of the the more specific route (which
;appears to be marked UP) as far as I can tell.
;
;According to route(4), the most specific route should be picked:
;
; "When routing a packet, the kernel will attempt to find the
; most specific route matching the destination. (If there are
; two different mask and value-under-the-mask pairs that match,
; the more specific is the one with more bits in the mask. A
; route to a host is regarded as being supplied with a mask of
; as many ones as there are bits in the destination). If no
; entry is found, the destination is declared to be unreachable,
; and a routing-miss message is generated if there are any
; listers on the routing control socket described below.
;
;Does anyone have any idea what is happening here?
;
;If additional information would be helpful, let me know and I'll provide
;it!
;
;Background:
;* I'm running gated(8)
;
;* I seem to notice this problem after bringing an interface down
; and back up. It works correctly after the interface comes
; up the first time. The "route get" starts returning the wrong route
; after the interface goes down and comes back up.
;
;
;Thanks,
; -Tad
;
; ----------------------------------------------------------------------
;
;# ifconfig tun8
;tun8: flags=51<UP,POINTOPOINT,RUNNING> mtu 576
; inet 192.168.1.2 -> 192.168.1.1 netmask 0xffffffff
;#
;# netstat -nr
;Routing tables
;
;Internet:
;Destination Gateway Flags Refs Use Mtu Interface
;default 192.168.167.1 UGS 2 2194 1500 fe0
;127 127.0.0.1 UR 0 0 33228 lo0
;127.0.0.1 127.0.0.1 UH 1 3 33228 lo0
;192.168.1.1 192.168.1.2 UH 0 0 576 tun8
;192.168.1.2 127.0.0.1 UGH 0 3 33228 lo0
;192.168.167 link#1 UC 0 0 1500 fe0
;192.168.167.1 00:01:30:1e:4d:c0 UHL 1 0 1500 fe0
;#
;# route get 192.168.1.1
; route to: 192.168.1.1
;destination: default
; mask: default
; gateway: 192.168.167.1
; local addr: fab1318.int.entrisphere.com
; interface: fe0
; flags: <UP,GATEWAY,DONE,STATIC>
; recvpipe sendpipe ssthresh rtt,msec rttvar hopcount mtu expire
; 0 0 0 0 0 0 1500 0
;#