Subject: Re: Wierd route on NetBSD 2.1
To: Ignatios Souvatzis <ignatios@cs.uni-bonn.de>
From: Steven M. Bellovin <smb@cs.columbia.edu>
List: netbsd-users
Date: 01/23/2006 12:05:15
In message <20060123165944.GA8048@cs.uni-bonn.de>, Ignatios Souvatzis writes:
>On Mon, Jan 23, 2006 at 11:25:34AM -0500, matthew sporleder wrote:
>>  0.0.5&0xa050501 isn't a valid ip.  From the part of the message you
>> cut off, you can see there's a negative value for the netmask set. (I
>> believe it was -7)  This should not be allowed, and it seems to be
>> causing some sort of (casting?) error where the last octect of the ip
>> is a larger-than-255 hex value.
>> 
>> In what way is this legal?
>
>That's *not* the netmask. That's the attempt of "route" to translate
>the netmask into a number of contiguous bits being 1, which, of course,
>fails.
>
>Maybe I'm confused, but I don't see how the cited route and netstat
>output points to a NetBSD problem, unless the original poster tells us
>what entered that route into the kernel. I can do it, for example, with
>a simple shell commad:
>
># route add 192.168.0.0 -netmask 10.5.5.1 255.255.0.255
>add net 192.168.0.0: gateway 255.255.0.255
># netstat -rnf inet
>Routing tables
>
>Internet:
>Destination        Gateway            Flags     Refs     Use    Mtu  Interface
>0&0xa050501        255.255.0.255      UGS         0        0      -  ex0 =>
>
I think that the issue is how few people have even seen that output 
format, since non-contiguous netmasks are, shall we say, rarely used.

		--Steven M. Bellovin, http://www.cs.columbia.edu/~smb