From owner-freebsd-rc@FreeBSD.ORG Fri Nov 19 18:08:53 2010 Return-Path: Delivered-To: freebsd-rc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 730301065670; Fri, 19 Nov 2010 18:08:53 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id CF6D98FC14; Fri, 19 Nov 2010 18:08:52 +0000 (UTC) Received: by wyb35 with SMTP id 35so3938878wyb.13 for ; Fri, 19 Nov 2010 10:08:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=T6hpIAulMfXqCBWF4T+ng/viExkNOVGn4xKXMrREhx0=; b=HpznpEUEHiJVdpjfWqoaIQ8SXD5OF3MC6zFz/TGs3A32PttzjC12g5LQ9uUZJIWIiw 0QWOjzYIKhAMdEympnhPBAqkRUnG9CBEtNRfiOJPrdOAqDUn3bDDC8pSMJb6rUg5o/ol EjVRSYd4G5N6g9Qnb/cXQOVk72QKJFlKThA/o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=GuQpQUd1WMydgLeV2eTkz1+wbCQ4QB//jUWMarvmd4Mv2Ujp0uzeKlUT45+g5pmd25 7NmwCv9vfPDw/G0muUEzTYeLC1WU/ekyqyDnnI1EvJfUZQwUf2MZhwnN34DUOW+AJiAn BHJauI3MWRcVtTTimAl8b7KJ4GLiSUjBu0BWs= MIME-Version: 1.0 Received: by 10.216.82.197 with SMTP id o47mr2363223wee.45.1290188602928; Fri, 19 Nov 2010 09:43:22 -0800 (PST) Sender: yanegomi@gmail.com Received: by 10.216.198.27 with HTTP; Fri, 19 Nov 2010 09:43:22 -0800 (PST) In-Reply-To: References: <4C76CA06.5010001@FreeBSD.org> <20101011.192914.82309657.hrs@allbsd.org> Date: Fri, 19 Nov 2010 09:43:22 -0800 X-Google-Sender-Auth: KZf6OJWmUmF7uRaowXZOYh5G4IA Message-ID: From: Garrett Cooper To: Sergey Kandaurov Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-rc@freebsd.org, freebsd-current@freebsd.org, dougb@freebsd.org Subject: Re: [RFC] ifconfig description support in rc.d X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion related to /etc/rc.d design and implementation." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Nov 2010 18:08:53 -0000 On Fri, Nov 19, 2010 at 2:55 AM, Sergey Kandaurov wrote= : > On 11 October 2010 14:29, Hiroki Sato wrote: >> Hi, >> >> pluknet wrote >> =A0in : >> >> pl> On 27 August 2010 00:09, Doug Barton 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) :)...