Re: ifconfig output: ipv4 netmask format



On Fri, Apr 08, 2011 at 01:16:17PM -0600, Warner Losh wrote:

On Apr 8, 2011, at 1:00 PM, Sergey Vinogradov wrote:

08.04.2011 19:55, Mike Bristow пиÑ?еÑ?:
On Fri, Apr 08, 2011 at 07:40:56PM +0400, Sergey Vinogradov wrote:
On 08.04.2011 19:23, Warner Losh wrote:
On Apr 8, 2011, at 6:08 AM, Sergey Vinogradov wrote:
If we really wanted to make it human readable, we'd output 10.2.3.4/24

So, maybe, while following the POLA, we should add an option, as Daniel
mentioned above? To output the CIDR?

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?

And boom goes the dynamite. Reverting to my first proposal about changing only netmask notation.

Non-contiguous netmasks are *not* legal anymore in IPv4. They have gone the way of the dodo. While some stacks still support it, a growing number of an interesting number of bugs with them that actual deployments with non-contiguous submasks becomes more hassle than it is worth.

Although non-contiguous netmasks are not legal anymore in IPv4, our
ifconfig still allows to do something like:

# ifconfig em0 inet 10.0.5.2 netmask 255.0.255.0
# ifconfig em0
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=219b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,WOL_MAGIC>
ether xx:xx:xx:xx:xx:xx
inet 10.0.5.2 netmask 0xff00ff00 broadcast 10.255.5.255
media: Ethernet autoselect (1000baseT <full-duplex>)
status: active

If we allow ifconfig to set non-contiguous netmasks, it cannot be
output in CIDR notation. Perhaps a compromise could be:

-t Prefer dotted decimal over hex.
-c If the netmask is contiguous, print it in CIDR, otherwise in hex
(without -d) or dotted decimal (with -d).

-d is already in use, hence -t although -D is also available.

Does this make everyone happy?

Warner

Paul Schenkeveld
_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • RE: CIDR Explanation
    ... With CIDR you can just write 192.168.0.1/24. ... represents how many bits in the netmask are 1's. ... a certified computer examiner, learn to recover trace data left behind by ...
    (Security-Basics)
  • Re: ifconfig output: ipv4 netmask format
    ... the CIDR flag but the netmask cannot be represented in CIDR notation? ...
    (freebsd-hackers)
  • Re: ifconfig output: ipv4 netmask format
    ... On Apr 8, 2011, at 1:00 PM, Sergey Vinogradov wrote: ... To output the CIDR? ... the CIDR flag but the netmask cannot be represented in CIDR notation? ... Reverting to my first proposal about changing only netmask notation. ...
    (freebsd-hackers)
  • Re: ifconfig output: ipv4 netmask format
    ... To output the CIDR? ... the CIDR flag but the netmask cannot be represented in CIDR notation? ... Reverting to my first proposal about changing only netmask notation. ...
    (freebsd-hackers)
  • Re: Understanding the interplay of ipfw, vlan, and carp
    ... CARP is broken with this patch. ... inet 192.168.0.11 netmask 0xffffff00 ... And the ifconfig output on the 7.0 box will show: ...
    (freebsd-net)