On Wed, 6 Apr 2011 16:29:22 +0000, Taylor R Campbell
<campbell+net...@mumble.net> wrote:
Date: Mon, 04 Apr 2011 23:46:19 +0200
From: Jean-Yves Migeon <jeanyves.mig...@free.fr>
The newer scripts for Xen read the interface value from the
vifname
entry in Xenstore, so changing the name is not that critical. But
this
should be stabilized sooner than later. Personally, I find '_'
rather
ugly in an interface name... but I am open to suggestions, even
fixing
rc.d/network if it needs to.
One could declare that ifnames must match [a-z][-a-z0-9]*[0-9], and
then in /etc/rc.d/network pass them through `tr - _' before
evaluating
`args=\$ifconfig_$int'. This guarantees that setting ifconfig_ifN in
/etc/rc.conf always works, and depends only on agreeing to the ifname
policy and ensuring that all the existing ifnames actually follow it.
Of course, tr might not be available yet in /etc/rc.d/network, but
someone wizardlier (or more patient) with sh than I can probably work
around that...
Yep, but there are other places where this will get tricky. For
example, rc.conf(5) is parsed as a classic shell script [1]. Given that
someone has two possibilities to configure interfaces:
/etc/ifconfig.xxx
or
ifconfig_xxx # in rc.conf(5)
If we follow the same "xxx" naming convention for both, we would have
to 'tr' certain lines of rc.conf for interfaces that contains a
[^a-zA-Z0-9_] char. This complexifies rc.conf parsing for no real
benefit. Putting a ifconfig_xxx-yyy="auto" in rc.conf(5) will likely
result in a parsing error.
I am about to revert my patch anyway, and use '_' instead. I will also
update ifconfig.if(5) to clearly indicate that only chars accepted in
shell variable names should be used.
[1] http://nxr.netbsd.org/xref/src/etc/rc#22
--
Jean-Yves Migeon
jeanyves.mig...@free.fr