From owner-freebsd-net@FreeBSD.ORG Thu Jun 7 15:00:44 2012 Return-Path: Delivered-To: net@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [69.147.83.53]) by hub.freebsd.org (Postfix) with ESMTP id 75772106566C; Thu, 7 Jun 2012 15:00:44 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from dhcp170-36-red.yandex.net (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx2.freebsd.org (Postfix) with ESMTP id 8E3CC1A6C5A; Thu, 7 Jun 2012 15:00:07 +0000 (UTC) Message-ID: <4FD0C1F4.2060108@FreeBSD.org> Date: Thu, 07 Jun 2012 19:00:04 +0400 From: "Alexander V. Chernikov" User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:12.0) Gecko/20120511 Thunderbird/12.0.1 MIME-Version: 1.0 To: net@freebsd.org, hackers@freebsd.org Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Cc: Subject: ifconfig accepting hostname as ipv4 address 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: Thu, 07 Jun 2012 15:00:44 -0000 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 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 vlan: 0 parent interface: 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