Re: [RFC] ifconfig description support in rc.d

From: Garrett Cooper <gcooper_at_FreeBSD.org>
Date: Sun, 10 Oct 2010 10:23:04 -0700
On Sat, Oct 9, 2010 at 11:29 PM, Sergey Kandaurov <pluknet_at_gmail.com> wrote:
> On 10 October 2010 07:41, jhell <jhell_at_dataix.net> wrote:
>> On 08/27/2010 05:17, pluknet wrote:
>>> On 27 August 2010 00:09, Doug Barton <dougb_at_freebsd.org> wrote:
>>>> On 08/26/2010 12:53 PM, pluknet wrote:
>>>>>
>>>>> [cc'ing current_at_ as rc_at_ 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.
>>>
>>>>  One note below.
>>>>
>>>>
>>>>> --- etc/network.subr    (revision 211280)
>>>>> +++ etc/network.subr    (working copy)
>>>>> _at__at_ -1187,6 +1187,24 _at__at_
>>>>>         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" ]
>>>>
>>>
>>> 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
>>> ===================================================================
>>> --- etc/network.subr    (revision 211280)
>>> +++ etc/network.subr    (working copy)
>>> _at__at_ -1179,7 +1179,7 _at__at_
>>>         # ifconfig_IF_name
>>>         for _if in `ifconfig -l`; do
>>>                 _ifname=`get_if_var $_if ifconfig_IF_name`
>>> -               if [ ! -z "$_ifname" ]; then
>>> +               if [ -n "$_ifname" ]; then
>>>                         ifconfig $_if name $_ifname
>>>                 fi
>>>         done
>>
>> Was this ever committed ? If so does anyone have any referring svn
>> revisions ?
>>
>> Also if this is committed or planned to be committed is there a chance
>> it could be MFC'd ?
>>
>> Would be awesome if this was available on a production release without
>> patching ;)
>>
>
> Hi.
>
> I'm going to commit this after a proper review.

<offtopic>
    I'm not sure it would get resolved after this commit, but one
minor annoyance is that restarting the netif rc.d script purges all
gateways set, so I have to do and restart the routing rc.d script (if
my connectivity doesn't get whacked). I think there was something else
with natd and ipfw that I've run into in the past where I've restarted
those scripts and things weren't all puppydogs and rainbows on my
CURRENT systems.
</offtopic>
Thanks,
-Garrett
Received on Sun Oct 10 2010 - 15:23:07 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:08 UTC