Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 07 Jun 2012 19:00:04 +0400
From:      "Alexander V. Chernikov" <melifaro@FreeBSD.org>
To:        net@freebsd.org, hackers@freebsd.org
Subject:   ifconfig accepting hostname as ipv4 address
Message-ID:  <4FD0C1F4.2060108@FreeBSD.org>

next in thread | raw e-mail | index | archive | help
Hello list!

Since the early days ifconfig(8) has the following functionality:

..
      address
              For the DARPA-Internet family, the address is either a 
host name
              present in the host name data base, hosts(5), or a DARPA 
Internet
              address expressed in the Internet standard “dot notation”.

E.g. one can write `ifconfig em0 some_possibly_unqualified_fqdn` and get
inet address assigned to the card with classful mask.

Now this can lead to "fun" things if you have misprinted some keyword 
and this keyword exists in the local DNS zone (or wildcard is configured).

The most favorite one (we have wilcard configured in one of our search 
zones):
18:45 [0] dhcp170-36-red# ifconfig vlan123 desroy
18:45 [0] dhcp170-36-red# echo $?
0
18:45 [0] dhcp170-36-red# ifconfig vlan123
vlan123: flags=8003<UP,BROADCAST,MULTICAST> metric 0 mtu 1500
         ether 00:00:00:00:00:00
         inet 213.180.204.242 netmask 0xffffff00 broadcast 213.180.204.255
         inet6 fe80::222:4dff:fe50:cd2f%vlan123 prefixlen 64 scopeid 0xd
         nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
         vlan: 0 parent interface: <none>

This is also one of the reasons why ifconfig sometimes "hangs" on 
invalid input.
Moreover, ifconfig em0 some_valid_fqdn/MASK silently ignores it, so you 
can't set valid CIDR address using this notation.

Classful era has ended more than 10 years ago, do we still want to keep 
this behavior?


-- 
WBR, Alexander



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4FD0C1F4.2060108>