Date: Mon, 02 Nov 2009 21:58:10 +0100 From: Thomas Rasmussen <thomas@gibfest.dk> To: freebsd-net@freebsd.org Subject: "route get" returning error on classful networks Message-ID: <4AEF47E2.7010304@gibfest.dk>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4AEF47E2.7010304>
