Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Feb 2016 15:23:39 +0700
From:      Eugene Grosbein <eugen@grosbein.net>
To:        Jeremy Boy <jb@jboy.eu>, freebsd-net@freebsd.org
Subject:   Re: ifconfig with quoted arguments
Message-ID:  <56BAF38B.3080809@grosbein.net>
In-Reply-To: <76A08658-ACD2-426B-865A-45A6A79BBFB4@jboy.eu>
References:  <76A08658-ACD2-426B-865A-45A6A79BBFB4@jboy.eu>

next in thread | previous in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?56BAF38B.3080809>