Subject: strange routing behavior: wrong route picked
To: None <tech-net@netbsd.org, tech-kern@netbsd.org>
From: Tad Hunt <tad@entrisphere.com>
List: tech-net
Date: 11/05/2002 16:54:47
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
#