Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Aug 2010 13:17:17 +0400
From:      pluknet <pluknet@gmail.com>
To:        Doug Barton <dougb@freebsd.org>
Cc:        FreeBSD Current <freebsd-current@freebsd.org>, freebsd-rc@freebsd.org
Subject:   Re: [RFC] ifconfig description support in rc.d
Message-ID:  <AANLkTintgji3vzrb8XuUQHWp%2B7YDvHtd7ynP0MmV0oZr@mail.gmail.com>
In-Reply-To: <4C76CA06.5010001@FreeBSD.org>
References:  <AANLkTinfOSQGnk0%2BPK6iM0=v5CZn2vcmJZbA8TvgGbfr@mail.gmail.com> <4C76CA06.5010001@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--0016e64bbf02c4b4e7048eca940d
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On 27 August 2010 00:09, Doug Barton <dougb@freebsd.org> 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.

Xin Li helped me with updating rc.conf.5 (thanks!).
It's included in attached patch.

> =A0One note below.
>
>
>> --- etc/network.subr =A0 =A0(revision 211280)
>> +++ etc/network.subr =A0 =A0(working copy)
>> @@ -1187,6 +1187,24 @@
>> =A0 =A0 =A0 =A0 return 0
>> =A0}
>>
>> +# ifnet_descr
>> +# =A0 =A0 =A0Add description to all requested interfaces.
>> +#
>> +ifnet_descr()
>> +{
>> + =A0 =A0 =A0 local _if _ifdescr
>> +
>> + =A0 =A0 =A0 # ifconfig_IF_descr
>> + =A0 =A0 =A0 for _if in `ifconfig -l`; do
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 _ifdescr=3D"`get_if_var $_if ifconfig_IF_d=
escr`"
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if [ ! -z "$_ifdescr" ]; then
>
> This is probably better as [ -n "$_ifdescr" ]
>

This was blindly copy&pasted after ifnet_rename().
So, it makes sense probably to change test expression there as well.
[see ifnet_rename() proposed change below inline]
This change to ifnet_rename() is not included in attached patch
to not complicate things unnecessarily for now.

Index: etc/network.subr
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- etc/network.subr    (revision 211280)
+++ etc/network.subr    (working copy)
@@ -1179,7 +1179,7 @@
        # ifconfig_IF_name
        for _if in `ifconfig -l`; do
                _ifname=3D`get_if_var $_if ifconfig_IF_name`
-               if [ ! -z "$_ifname" ]; then
+               if [ -n "$_ifname" ]; then
                        ifconfig $_if name $_ifname
                fi
        done

--=20
wbr,
pluknet

--0016e64bbf02c4b4e7048eca940d
Content-Type: application/octet-stream; name="descr.rc.d.2.diff"
Content-Disposition: attachment; filename="descr.rc.d.2.diff"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_gdctruj10

SW5kZXg6IGV0Yy9yYy5kL25ldGlmCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIGV0Yy9yYy5kL25ldGlmCShyZXZp
c2lvbiAyMTEyODApCisrKyBldGMvcmMuZC9uZXRpZgkod29ya2luZyBjb3B5KQpAQCAtNzUsNiAr
NzUsOSBAQAogCiAJCSMgUmVuYW1lIGludGVyZmFjZXMuCiAJCWlmbmV0X3JlbmFtZQorCisJCSMg
R2l2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E5IEBACiB2YXJpYWJsZXMuCiAuUHAKIElmIGEK
Ky5WYSBpZmNvbmZpZ18gTnMgQW8gQXIgaW50ZXJmYWNlIEFjIE5zIFZhIF9kZXNjcgordmFyaWFi
bGUgaXMgc2V0LCB0aGUgaW50ZXJmYWNlIHdvdWxkIGJlIGFzc2lnbmVkIHRoZSBkZXNjcmlwdGlv
bgorc3BlY2lmaWVkIGJ5IHRoZSB2YXJpYWJsZS4KKy5QcAorVG8gYXNzaWduIGFuIGRlc2NyaXB0
aW9uIG9mCisuRHEgVXBsaW5rIHRvIEdpZ2FiaXQgU3dpdGNoIDEKK29uIHRoZSBpbnRlcmZhY2Ug
bmFtZWQKKy5MaSBlbTAgOgorLkJkIC1saXRlcmFsCitpZmNvbmZpZ19lbTBfZGVzY3I9IlVwbGlu
ayB0byBHaWdhYml0IFN3aXRjaCAxIgorLkVkCisuUHAKK0lmIGEKIC5WYSB2bGFuc18gTnMgQXEg
QXIgaW50ZXJmYWNlCiB2YXJpYWJsZSBpcyBzZXQsCiBhCg==
--0016e64bbf02c4b4e7048eca940d--



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