Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Oct 2005 18:52:33 -0700
From:      Brooks Davis <brooks@one-eyed-alien.net>
To:        Philipp Wuensche <cryx-freebsd@h3q.com>
Cc:        freebsd-rc@freebsd.org
Subject:   Re: alias configuration in rc.conf
Message-ID:  <20051018015233.GA20157@odin.ac.hmc.edu>
In-Reply-To: <435443DE.6090300@h3q.com>
References:  <435412F7.2030906@h3q.com> <20051017215309.GH15097@odin.ac.hmc.edu> <435443DE.6090300@h3q.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--82I3+IH0IqGh5yIs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Oct 18, 2005 at 02:37:50AM +0200, Philipp Wuensche wrote:
> Brooks Davis wrote:
> >=20
> > I don't like ipv4_ifconfig_fxp0.  I'd suggest ifconfig_fxp0_ipv4_aliases
> > instead. =20
>=20
> Good idea, the ipv4_ifconfig was just a placeholder more ore less. But
> why is there a differentiation between adding the first ipaddr. to the
> interface and adding anoter one anyway?

History plus a desire to keep the common case to one line.

> Part of my idea (not implemented in this piece of code) was to use
> ifconfig_if (or ifconfig_if_option) for interface options only and use
> ipv4_ and ipv6_ifconfig_if to configure the ipaddr. of the interface.
> This would make no difference between adding the first ipaddr and adding
> more. Just for the record ;-).

The other issue is that ifconfig_<ifn>_* lines have traditionally been
valid ifconfig commands and this is not.  Hmm, now that I think about
it more, that's argues against having ifconfig in the name at all.
Looking at the ipv6 variables, I see where you got ipv4_ifconfig_fxp0,
but maybe the answer is to name this new code's variables something like
ipv4_<ifn>_addrs.  This empahsises both the fact this this is an address
list, not an alias list, and that this is not valid ifconfig input.
Similar code could presumably be written for ipv6.

> > The ipv4_ifconfig_getargs function is slightly bogus as
> > written since a default value makes no sense and that would be the wrong
> > one anyway.  The implemenation also fails to match the comment though
> > that's easy to fix.  I'd also not modify etc/rc.d/netif and do this from
> > ifalias_up(). =20
>=20
> I moved everything to ifalias_up() keeping the other aliasN stuff.

Now that I'm thinking about this as an address list, I'm thinking
ifalias_up wasn't the place after all.  Instead, ifalias_up should
remain in network.subr, but be called via a new ipv4_up() function that
would also do this new processing.

> > Corresponding ifalias_down() support should also be added.
>=20
> Done.

Since there's a one word difference between the two cases, I think
an ipv4_addrs_common function taking an add or delete argument and the
interface would be appropriate to avoid duplication of this code.
Also, if you could find a way to rewrite the loop so ifconfig is only
called in one place, that would be a bit cleaner.

-- Brooks

--=20
Any statement of the form "X is the one, true Y" is FALSE.
PGP fingerprint 655D 519C 26A7 82E7 2529  9BF0 5D8E 8BE9 F238 1AD4

--82I3+IH0IqGh5yIs
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFDVFVgXY6L6fI4GtQRAmCRAKDTBLOfc4aMwmPMW0WvA2FG5OnYxgCeINMM
Urt3+dH0nWo1S1FrfyP5N4I=
=3wH0
-----END PGP SIGNATURE-----

--82I3+IH0IqGh5yIs--



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