From owner-freebsd-current@FreeBSD.ORG Fri Nov 19 10:55:43 2010 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DFDE01065672 for ; Fri, 19 Nov 2010 10:55:43 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-qy0-f182.google.com (mail-qy0-f182.google.com [209.85.216.182]) by mx1.freebsd.org (Postfix) with ESMTP id 4B4168FC13 for ; Fri, 19 Nov 2010 10:55:43 +0000 (UTC) Received: by qyk9 with SMTP id 9so595126qyk.13 for ; Fri, 19 Nov 2010 02:55:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=oe4cvvvBeNuc59PY2r6QPCfHn3b++VLtw4YnNTbw2+4=; b=or1qR64DTnKNSC7Y+epwWTbPyjUzfA8v/JS8umEwq+ESE8sV36PaJ4bQm5yNOmPSrX Zj/ZA0PzxVCy4LOF4srZJXXAIpVAf8SI/Or/LZ21F0vOwiM7ts4b/4uaBUwiazvzalcu 98Fr8gnEvyiudJOA9aQu4qKT+8qcsDCQqc1yM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=HGWt/w7iQP21XI2HKd2RSLKCWXpmRXcvlptBGk+ZIvduP8GfA8Azxj2/ncamulVuf4 2GAH0tlr5jYRHMyn2GqVGaPDGEiOLny/9/a78++S0VE6KbQTbBdSLzsm1zyD10rxMlmA o3SYRvEzE8oOp+tRQEK5qM61dl0fB89q/8zLE= MIME-Version: 1.0 Received: by 10.229.229.135 with SMTP id ji7mr1686531qcb.100.1290164142194; Fri, 19 Nov 2010 02:55:42 -0800 (PST) Received: by 10.229.69.135 with HTTP; Fri, 19 Nov 2010 02:55:42 -0800 (PST) In-Reply-To: <20101011.192914.82309657.hrs@allbsd.org> References: <4C76CA06.5010001@FreeBSD.org> <20101011.192914.82309657.hrs@allbsd.org> Date: Fri, 19 Nov 2010 13:55:42 +0300 Message-ID: From: Sergey Kandaurov To: Hiroki Sato Content-Type: multipart/mixed; boundary=0016363b8f2065c2b3049565bf68 Cc: dougb@freebsd.org, freebsd-rc@freebsd.org, freebsd-current@freebsd.org Subject: Re: [RFC] ifconfig description support in rc.d X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Nov 2010 10:55:44 -0000 --0016363b8f2065c2b3049565bf68 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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 c= ommit 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. --=20 wbr, pluknet P.S. Google marks patches as (application/octet-stream). Bad Google. --0016363b8f2065c2b3049565bf68 Content-Type: application/octet-stream; name="descr.rc.d.netif.patch" Content-Disposition: attachment; filename="descr.rc.d.netif.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_ggoyd0vv1 SW5kZXg6IGV0Yy9uZXR3b3JrLnN1YnIKPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gZXRjL25ldHdvcmsuc3Vicgko cmV2aXNpb24gMjE1NDIzKQorKysgZXRjL25ldHdvcmsuc3Vicgkod29ya2luZyBjb3B5KQpAQCAt NDcsNiArNDcsNyBAQAogCWlwdjRfdXAgJHtpZm59ICYmIGNmZz0wCiAJaXB2Nl91cCAke2lmbn0g JiYgY2ZnPTAKIAlpcHhfdXAgJHtpZm59ICYmIGNmZz0wCisJaWZkZXNjcl91cCAke2lmbn0gJiYg Y2ZnPTAKIAljaGlsZGlmX2NyZWF0ZSAke2lmbn0gJiYgY2ZnPTAKIAogCXJldHVybiAkY2ZnCkBA IC02OSw2ICs3MCw3IEBACiAJaXB2NF9kb3duICR7aWZufSAmJiBjZmc9MAogCWlmY29uZmlnX2Rv d24gJHtpZm59ICYmIGNmZz0wCiAJaWZzY3JpcHRfZG93biAke2lmbn0gJiYgY2ZnPTAKKwlpZmRl c2NyX2Rvd24gJHtpZm59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