ifconfig with quoted arguments

Kevin Oberman rkoberman at gmail.com
Wed Feb 10 18:18:16 UTC 2016


On Wed, Feb 10, 2016 at 12:23 AM, Eugene Grosbein <eugen at grosbein.net>
wrote:

> 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.
>

I'd suggest using CIDR notation and eliminating the old "netmask" al
together.
ifconfig ue0 inet 192.168.2.176/24

Aside form no longer using a form of addressing that had been obsolete for
20 years, quotation marks won't matter.
--
Kevin Oberman, Part time kid herder and retired Network Engineer
E-mail: rkoberman at gmail.com
PGP Fingerprint: D03FB98AFA78E3B78C1694B318AB39EF1B055683


More information about the freebsd-net mailing list