[RFC] ifconfig description support in rc.d
Xin LI
delphij at delphij.net
Thu Aug 26 21:10:16 UTC 2010
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
On 2010/08/26 13:09, Doug Barton wrote:
> On 08/26/2010 12:53 PM, pluknet wrote:
>> [cc'ing current@ as rc@ looks too quite]
>>
>> Hi.
>>
>> Since ifconfig has grown to label interfaces with
>> ifconfig $ifname description "foobar", what about
>> to give it more life and store i/face descriptions
>> semi-permanently, so they will survive between reboots?
>>
>> This patch adds a functionality to rc.d to label
>> interfaces at boot time.
>>
>> Comments are welcome.
>
> This seems like a good addition, thanks. Please also write a patch for
> rc.conf.5 to describe this new functionality and I'll be happy to commit
> it. One note below.
I have drafted one.
(Note that fxp is a 100Mbps card so it might be sensible to replace it
with just Switch 2?)
>> --- etc/network.subr (revision 211280)
>> +++ etc/network.subr (working copy)
>> @@ -1187,6 +1187,24 @@
>> return 0
>> }
>>
>> +# ifnet_descr
>> +# Add description to all requested interfaces.
>> +#
>> +ifnet_descr()
>> +{
>> + local _if _ifdescr
>> +
>> + # ifconfig_IF_descr
>> + for _if in `ifconfig -l`; do
>> + _ifdescr="`get_if_var $_if ifconfig_IF_descr`"
>> + if [ ! -z "$_ifdescr" ]; then
>
> This is probably better as [ -n "$_ifdescr" ]
>
> Doug
>
- --
Xin LI <delphij at delphij.net> http://www.delphij.net/
FreeBSD - The Power to Serve! Live free or die
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (FreeBSD)
iQEcBAEBCAAGBQJMdtgjAAoJEATO+BI/yjfBywEIALQZMUFUKlkQ/DZjrqBgymFx
Mnj6YkLaPXcvNI5OI15Q3hy730pIZzzNPGKV9ecXLSQ1PikZUIXy5fuRfYh9iXE3
d9f4UgDId0Sn55WmD6/Sfza0oSlH3C1fus6e9NSmm/aR3ekWyLWZzW0wGTgEXFxK
bo0ZcQw7AxRxDLc7EifWUfxV/Ej5pga5YjVyhBBdCoAHl2bPJuFFuxd140Y6+Mlf
gH4zgf2rdGpCWNpWF6L8PsGoVNBoK0R1fUwJZT+GB2ANvMuuQ+jsks+R8h8XFIO6
TE4O8onVcOaoTGZ3873M3CqcO1jfaK5rBfGg3Cr9wUjOkvkQ8SL+k4uvBm4CuX4=
=VtCo
-----END PGP SIGNATURE-----
-------------- next part --------------
Index: rc.conf.5
===================================================================
--- rc.conf.5 (revision 211847)
+++ rc.conf.5 (working copy)
@@ -1128,6 +1128,19 @@
variables.
.Pp
If a
+.Va ifconfig_ Ns Ao Ar interface Ac Ns Va _descr
+variable is set, the interface would be assigned the description
+specified by the variable.
+.Pp
+To assign an description of
+.Dq Uplink to Gigabit Switch 1
+on the interface named
+.Li em0 :
+.Bd -literal
+ifconfig_em0_descr="Uplink to Gigabit Switch 1"
+.Ed
+.Pp
+If a
.Va vlans_ Ns Aq Ar interface
variable is set,
a
More information about the freebsd-current
mailing list