ifconfig output: ipv4 netmask format

Mike Bristow mike at urgle.com
Sat Apr 9 17:16:27 UTC 2011


On Fri, Apr 08, 2011 at 11:43:16AM -0600, Warner Losh wrote:
> > Non-contigous netmasks are legal in IPv4.  What do you do if someone adds
> > the CIDR flag but the netmask cannot be represented in CIDR notation?
> 
> They have become illegal in the fullness of time.

I'll rephrase my point, then:  not all netmasks, legal or otherwise,
that are accepted by ifconfig, can be represented in CIDR notation
(see below).   

I guess the fact that ifconfig accepts them is a bug - but that
merely changes my comment to "Non-contigous netmasks are accepted
for IPv4 addresses by some (buggy) utilities.  What do you do if
someone adds the CIDR flag, but the netmask cannot be represented
in CIDR notation?".

Cheers,
Mike

[root at cheddar ~]# ifconfig bridge99 create
[root at cheddar ~]# ifconfig bridge99 127.255.0.1 netmask 255.255.255.1
[root at cheddar ~]# ifconfig bridge99
bridge99: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	ether d6:c6:07:a9:7e:b9
	inet 127.255.0.1 netmask 0xffffff01 broadcast 127.255.0.255
[root at cheddar ~]# uname -a
FreeBSD cheddar.urgle.com 8.2-RELEASE FreeBSD 8.2-RELEASE #0: Thu Feb 24 23:04:32 GMT 2011     root at cheddar.urgle.com:/usr/obj/usr/src/sys/GENERIC  amd64
[root at cheddar ~]# 

-- 
Mike Bristow                                          mike at urgle.com



More information about the freebsd-hackers mailing list