"route get" returning error on classful networks
Thomas Rasmussen
thomas at gibfest.dk
Mon Nov 2 21:09:55 UTC 2009
Gentlemen,
While writing a script to do some route table maintenance on a firewall
I stumbled on to something curious (all network numbers are examples):
=====================================================
$ route get 35.0.0.0
route: writing to routing socket: No such process
$ route -n get 35.0.0.1
route to: 35.0.0.1
destination: default
mask: default
gateway: 10.10.0.1
interface: lagg0
flags: <UP,GATEWAY,DONE,STATIC>
recvpipe sendpipe ssthresh rtt,msec rttvar hopcount mtu
expire
0 0 0 0 0 0
1500 0
=====================================================
It seems "route get" returns an error when asked to look up the route to a
network with the network .0 ip as the lookup key. This follows classful
network boundaries, and is somewhat easier to demonstrate than to explain:
=====================================================
class A:
$ route get 9.0.0.0 > /dev/null 2>&1 ; echo $?
1
$ route get 9.1.0.0 > /dev/null 2>&1 ; echo $?
0
class B:
$ route get 130.0.0.0 > /dev/null 2>&1 ; echo $?
1
$ route get 130.1.0.0 > /dev/null 2>&1 ; echo $?
1
$ route get 130.1.1.0 > /dev/null 2>&1 ; echo $?
0
class C:
$ route get 200.0.0.0 > /dev/null 2>&1 ; echo $?
1
$ route get 200.1.0.0 > /dev/null 2>&1 ; echo $?
1
$ route get 200.1.1.0 > /dev/null 2>&1 ; echo $?
1
$ route get 200.1.1.1 > /dev/null 2>&1 ; echo $?
0
=====================================================
This happens on Freebsd 6-7-8 on all machines I have access to.
The error message is confusing and suggests there is a problem writing
to the routing table which is not what I am doing at all.
Is this a bug, or can somebody offer an explanation for this ?
Thank you! :)
Thomas Rasmussen
More information about the freebsd-net
mailing list