From owner-freebsd-net@FreeBSD.ORG Mon Nov 2 21:09:55 2009 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5324F106566B for ; Mon, 2 Nov 2009 21:09:55 +0000 (UTC) (envelope-from thomas@gibfest.dk) Received: from mail.tyknet.dk (gw.tyknet.dk [93.167.110.194]) by mx1.freebsd.org (Postfix) with ESMTP id 045DB8FC17 for ; Mon, 2 Nov 2009 21:09:54 +0000 (UTC) Received: from mail.tyknet.dk (localhost [127.0.0.1]) by mail.tyknet.dk (Postfix) with ESMTP id BB7D7B8F0 for ; Mon, 2 Nov 2009 21:58:11 +0100 (CET) Received: from mail.tyknet.dk (localhost [127.0.0.1]) by mail.tyknet.dk (Postfix) with ESMTP id E5BFAB87E for ; Mon, 2 Nov 2009 21:58:10 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on doobie.tyknet.cn.dom X-Spam-Level: X-Spam-Status: No, score=-4.1 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from [10.10.1.143] (tykpc.tyknet.cn.dom [10.10.1.143]) by mail.tyknet.dk (Postfix) with ESMTP id D8448B82E for ; Mon, 2 Nov 2009 21:58:10 +0100 (CET) Message-ID: <4AEF47E2.7010304@gibfest.dk> Date: Mon, 02 Nov 2009 21:58:10 +0100 From: Thomas Rasmussen User-Agent: Thunderbird 2.0.0.22 (Windows/20090605) MIME-Version: 1.0 To: freebsd-net@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV using ClamSMTP Subject: "route get" returning error on classful networks X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Nov 2009 21:09:55 -0000 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: 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