From owner-freebsd-net@freebsd.org Wed Feb 10 08:23:51 2016 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0708EAA20CC for ; Wed, 10 Feb 2016 08:23:51 +0000 (UTC) (envelope-from eugen@grosbein.net) Received: from hz.grosbein.net (hz.grosbein.net [78.47.246.247]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "hz.grosbein.net", Issuer "hz.grosbein.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 9818E12F1 for ; Wed, 10 Feb 2016 08:23:49 +0000 (UTC) (envelope-from eugen@grosbein.net) Received: from eg.sd.rdtc.ru (root@eg.sd.rdtc.ru [62.231.161.221]) by hz.grosbein.net (8.14.9/8.14.9) with ESMTP id u1A8Ni3x027870 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 10 Feb 2016 09:23:45 +0100 (CET) (envelope-from eugen@grosbein.net) X-Envelope-From: eugen@grosbein.net X-Envelope-To: jb@jboy.eu Received: from eg.sd.rdtc.ru (eugen@localhost [127.0.0.1]) by eg.sd.rdtc.ru (8.15.2/8.15.2) with ESMTP id u1A8Nd3Q086428; Wed, 10 Feb 2016 15:23:39 +0700 (KRAT) (envelope-from eugen@grosbein.net) Subject: Re: ifconfig with quoted arguments To: Jeremy Boy , freebsd-net@freebsd.org References: <76A08658-ACD2-426B-865A-45A6A79BBFB4@jboy.eu> From: Eugene Grosbein X-Enigmail-Draft-Status: N1110 Message-ID: <56BAF38B.3080809@grosbein.net> Date: Wed, 10 Feb 2016 15:23:39 +0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <76A08658-ACD2-426B-865A-45A6A79BBFB4@jboy.eu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=1.4 required=5.0 tests=BAYES_00, DATE_IN_FUTURE_96_Q, LOCAL_FROM autolearn=no version=3.3.2 X-Spam-Report: * 1.1 DATE_IN_FUTURE_96_Q Date: is 4 days to 4 months after Received: date * -2.3 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 2.6 LOCAL_FROM From my domains X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on hz.grosbein.net X-Spam-Level: * X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Feb 2016 08:23:51 -0000 On 10.02.2016 04:51, Jeremy Boy wrote: > Hello list, > > please CC me in replies to this mail, since I am no subscriber to this list. > > For safety reasons, we enclose user input to shell commands in quotes. Until today, the resulting command for ifconfig(8) looked like this: > >> ifconfig ue0 inet "192.168.2.176 netmask 255.255.255.0" According to ifconfig(8) manual page, this syntax is wrong. > What exactly does ifconfig do? It seems to me that it reads the IP address from the quoted string but truncates the netmask. Is this a bug in ifconfig or intended behavior? The word "inet" is for "address_family". The next argument should be "address" and you supply "192.168.2.176 netmask 255.255.255.0" for "address". It seems, ifconfig passes this argument to inet_aton() function that parses IP address and ignores first space and the rest of string.