ifconfig with quoted arguments

Eugene Grosbein eugen at grosbein.net
Wed Feb 10 08:23:51 UTC 2016


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.


More information about the freebsd-net mailing list