Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 07 Feb 2012 11:45:23 +0100
From:      Stefan Esser <se@freebsd.org>
To:        Hiroki Sato <hrs@FreeBSD.org>
Cc:        freebsd-rc@FreeBSD.org
Subject:   Re: Proposal ipv6_addrs_common
Message-ID:  <4F3100C3.4040700@freebsd.org>
In-Reply-To: <20120207.063843.67168667989898285.hrs@allbsd.org>
References:  <4F2F3459.3090401@erdgeist.org> <20120206.114622.2214566196455293098.hrs@allbsd.org> <4F2FBAE4.1090901@freebsd.org> <20120207.063843.67168667989898285.hrs@allbsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Am 06.02.2012 22:38, schrieb Hiroki Sato:
> Stefan Esser <se@freebsd.org> wrote
>   in <4F2FBAE4.1090901@freebsd.org>:
> 
> se> Am 06.02.2012 03:46, schrieb Hiroki Sato:
> se> >  Yes, I agree that aliasN is fragile and renumbering is annoying.  I
> se> >  am using a patch to allow the following syntax for a while:
> se> >
> se> >  ifconfig_tap0_aliases="
> se> >         inet6 2001:db8:8888:2::1/64
> se> >         inet6 2001:db8:9990-9999:3::1/64
> se> >         inet 10.8.1.1/24
> se> >         inet 10.8.0.1-10/24
> se> >  "
> se>
> se> I like this, but it does not seem to be compatible with David Teske's
> se> sysrc script. And even though that script has not been made part of
> 
>  I tried sysrc for a variable with multiple lines, but it looks
>  working.  What is the compatibility issue more specifically?

Sorry, I had just assumed that it did not work, while in fact sysrc
deals with multi-line values just fine.

> se> A general syntax for this purpose is useful, but I'd rather not see
> se> new-lines used for this purpose. For example, I have used "sort" to
> se> prepare rc.conf files from different hosts for easy comparison with
> se> each other. This will be broken, if entries cover more than one line.
> se> There may be other breakage of that kind.
> se>
> se> So please choose a separator character that keeps lines intact ...
> 
>  Hmm, sorting rc.conf does not work in many cases because it can
>  contains shell script statements other than variable definitions.  I
>  am using a for loop to define multiple vlan interfaces, for example.
>  If we need a feature for comparison, some kind of normalization to
>  extract variables and their values is needed just like sysrc does.

Sorting works just fine for this purpose, at least on my rc.conf files.
But I do not use loops or other control structures, just simple variable
initializations in them. And I do not use the sorted file as actual
rc.conf file, just look for differences between files.

A utility that compares rc.conf files might be very useful and I think
that should be a valuable addition to sysrc. E.g. a function to compare
/etc./rc.conf with a template file, to compare two rc.conf files and to
list differences in diff style, or to "grep" lines selected by a
template file out of rc.conf, etc.

>  I admit 1-line-for-1-variable would be simple and that is a way we
>  have used and expected and I will not rush into an idea with multiple
>  lines.  However, it is also true that enumeration like aliasN,
>  more-or-less caused by the 1-line policy, has caused annoying issues
>  and created similar knobs whose functionality is almost the same as
>  each other.

IMHO the semantics of rc.conf files should not be complicated by
multi-line entries. Any other separator would be preferable, IMO.

>  I will try to create another patch to support a separator other than
>  a newline, anyway.

Dirk Engling suggested to use white space as separator and to interpret
"inet" and "inet6" as (optional) AF indicators. I like this idea a lot!

You could omit inet/inet6 for all numeric addresses (any parameter with
a colon is an IPv6 address) and just use inet/inet6 if an address is
specified by name (e.g. a host name that can be resolved during system
start and for which IPv4 and IPv6 addresses exist, e.g. in /etc/hosts).

Such a syntax would restrict use of ip*_addrs_common, but I think that's
not a bug but a feature ;-)

Regards, STefan



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