Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Feb 2016 10:18:14 -0800
From:      Kevin Oberman <rkoberman@gmail.com>
To:        Eugene Grosbein <eugen@grosbein.net>
Cc:        Jeremy Boy <jb@jboy.eu>, "freebsd-net@freebsd.org" <freebsd-net@freebsd.org>
Subject:   Re: ifconfig with quoted arguments
Message-ID:  <CAN6yY1sqsnuvfNtOvY3q4HHDebmPVA69uwRmCKAVcTZBgfYtfA@mail.gmail.com>
In-Reply-To: <56BAF38B.3080809@grosbein.net>
References:  <76A08658-ACD2-426B-865A-45A6A79BBFB4@jboy.eu> <56BAF38B.3080809@grosbein.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Feb 10, 2016 at 12:23 AM, Eugene Grosbein <eugen@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@gmail.com
PGP Fingerprint: D03FB98AFA78E3B78C1694B318AB39EF1B055683



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