Date: Fri, 19 Nov 2010 09:43:22 -0800 From: Garrett Cooper <gcooper@FreeBSD.org> To: Sergey Kandaurov <pluknet@gmail.com> Cc: freebsd-rc@freebsd.org, freebsd-current@freebsd.org, dougb@freebsd.org Subject: Re: [RFC] ifconfig description support in rc.d Message-ID: <AANLkTik=%2B-GUmxZf2MT5oXVL9nMzyt_nB_-f3W1RyVbD@mail.gmail.com> In-Reply-To: <AANLkTimOWhC1PHSu0SaUavTAPrhyNESdOWgAEEbxehBF@mail.gmail.com> References: <AANLkTinfOSQGnk0%2BPK6iM0=v5CZn2vcmJZbA8TvgGbfr@mail.gmail.com> <4C76CA06.5010001@FreeBSD.org> <AANLkTintgji3vzrb8XuUQHWp%2B7YDvHtd7ynP0MmV0oZr@mail.gmail.com> <20101011.192914.82309657.hrs@allbsd.org> <AANLkTimOWhC1PHSu0SaUavTAPrhyNESdOWgAEEbxehBF@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Nov 19, 2010 at 2:55 AM, Sergey Kandaurov <pluknet@gmail.com> wrote= : > On 11 October 2010 14:29, Hiroki Sato <hrs@freebsd.org> wrote: >> Hi, >> >> pluknet <pluknet@gmail.com> wrote >> =A0in <AANLkTintgji3vzrb8XuUQHWp+7YDvHtd7ynP0MmV0oZr@mail.gmail.com>: >> >> pl> On 27 August 2010 00:09, Doug Barton <dougb@freebsd.org> wrote: >> pl> > On 08/26/2010 12:53 PM, pluknet wrote: >> pl> >> >> pl> >> [cc'ing current@ as rc@ looks too quite] >> pl> >> >> pl> >> Hi. >> pl> >> >> pl> >> Since ifconfig has grown to label interfaces with >> pl> >> ifconfig $ifname description "foobar", what about >> pl> >> to give it more life and store i/face descriptions >> pl> >> semi-permanently, so they will survive between reboots? >> pl> >> >> pl> >> This patch adds a functionality to rc.d to label >> pl> >> interfaces at boot time. >> pl> >> >> pl> >> Comments are welcome. >> pl> > >> pl> > This seems like a good addition, thanks. Please also write a patch= for >> pl> > rc.conf.5 to describe this new functionality and I'll be happy to = commit it. >> pl> >> pl> Xin Li helped me with updating rc.conf.5 (thanks!). >> pl> It's included in attached patch. >> (snip) >> pl> >> + =A0 =A0 =A0 # ifconfig_IF_descr >> pl> >> + =A0 =A0 =A0 for _if in `ifconfig -l`; do >> >> =A0I think using "ifconfig -l" here is not a good idea. =A0Setting a >> =A0description for each interface in a function invoked by ifn_start() >> =A0would be better. >> >> =A0This is beacuse the netif script can be run not only at boottime but >> =A0also via devd or by hand for a specific interface. =A0So, if the >> =A0ifnet_descr is there, "/etc/rc.d/netif start IF" does not make it >> =A0run. =A0Since the description is a per-interface property, >> =A0"/etc/rc.d/netif start IF" should set one, and "/etc/rc.d/netif stop >> =A0IF" should clear one, IMHO. >> >> =A0Also, "ifconfig -l" is not compatible with $network_interfaces, so >> =A0you need to use list_net_interface() for that purpose instead (if you >> =A0move ifnet_descr() into ifn_start() it is useless, though). >> > > Actually, both versions were developed at the same time. > This one follows "netif" approach. Somehow it was rejected > by me for some reasons which I don't remember for now. > That's why I didn't include it to my original message. > > Please, see attached. + _ifdescr=3D"`get_if_var $_if ifconfig_IF_descr`" + if [ ! -z "$_ifdescr" ]; then + ifconfig $_if descr "$_ifdescr" + fi + + return 0 What if the above fails? There are other potential problem areas as well in network.subr (ifscript_up for instance). Thanks, -Garrett > P.S. > Google marks patches as (application/octet-stream). Bad Google. Only if the extension isn't .patch (and it's not just Google -- blame it on other software like Mailman as well) :)...
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTik=%2B-GUmxZf2MT5oXVL9nMzyt_nB_-f3W1RyVbD>