From owner-freebsd-net@FreeBSD.ORG Sat Oct 22 13:15:53 2011 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 380051065670 for ; Sat, 22 Oct 2011 13:15:53 +0000 (UTC) (envelope-from jdc@koitsu.dyndns.org) Received: from qmta01.emeryville.ca.mail.comcast.net (qmta01.emeryville.ca.mail.comcast.net [76.96.30.16]) by mx1.freebsd.org (Postfix) with ESMTP id 1FDA18FC15 for ; Sat, 22 Oct 2011 13:15:53 +0000 (UTC) Received: from omta09.emeryville.ca.mail.comcast.net ([76.96.30.20]) by qmta01.emeryville.ca.mail.comcast.net with comcast id np1N1h0010S2fkCA1p2b7t; Sat, 22 Oct 2011 13:02:35 +0000 Received: from koitsu.dyndns.org ([67.180.84.87]) by omta09.emeryville.ca.mail.comcast.net with comcast id np2p1h00h1t3BNj8Vp2pHG; Sat, 22 Oct 2011 13:02:50 +0000 Received: by icarus.home.lan (Postfix, from userid 1000) id 8C979102C1C; Sat, 22 Oct 2011 06:02:41 -0700 (PDT) Date: Sat, 22 Oct 2011 06:02:41 -0700 From: Jeremy Chadwick To: sthaug@nethelp.no Message-ID: <20111022130241.GA12632@icarus.home.lan> References: <20111022.141117.74664953.sthaug@nethelp.no> <20111022125528.GA12452@icarus.home.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20111022125528.GA12452@icarus.home.lan> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-net@freebsd.org, freebsd-stable@freebsd.org Subject: Re: How to set interface description containing space in 8.x X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2011 13:15:53 -0000 On Sat, Oct 22, 2011 at 05:55:28AM -0700, Jeremy Chadwick wrote: > On Sat, Oct 22, 2011 at 02:11:17PM +0200, sthaug@nethelp.no wrote: > > FreeBSD 8.x (well, at least 8.2) has the very nice feature of letting > > you set an interface *description* (just like you can on any Juniper/ > > Cisco/whatever router). This decription can contain spaces - so I can > > do for instance: > > > > xxx# ifconfig bge1 descr "abc def" > > > > xxx# ifconfig bge1 > > bge1: flags=8843 metric 0 mtu 1500 > > description: abc def > > options=8009b > > ether 00:13:72:20:b4:6f > > media: Ethernet autoselect (1000baseT ) > > status: active > > > > and we see that the decription includes a space. The question is - how > > can I include a description containing one or more spaces in rc.conf? > > > > The straighforward attempt, > > > > ifconfig_bge1="up descr abc def" > > > > doesn't work - "abc" and "def" are given as separate parameters to the > > ifconfig command, resulting in "abc" being used and "def" regarded as > > an extra parameter: > > > > xxx# /etc/rc.d/netif start bge1 > > ifconfig: def: bad value > > > > I have tried several variants, > > > > ifconfig_bge1="up descr abc\ def" > > ifconfig_bge1="up descr abc\\ def" > > ifconfig_bge1="up descr 'abc def'" > > ifconfig_bge1="up descr \"abc def\"" > > ifconfig_bge1="up descr abc_def" > > > > but none have the desired result. Can anybody shed a light on this? > > I have 100% success using apostrophes, as so: > > ifconfig_em1="... descr 'snakes and crumpets'" > > The "..." part of the string is just to indicate other stuff can go > there, presumably. My em1 interface isn't actually in use (no IP > configured, etc.). > > Result after running /etc/rc.d/netif start: > > em1: flags=8843 metric 0 mtu 1500 > description: snakes and crumpets > options=219b > ether 00:30:48:d2:22:d1 > media: Ethernet autoselect > status: no carrier > > This is on RELENG_8 dated 2011/09/28. > > If you want me to test it on my em0 interface (which is what actually has > an IP configured, etc.) and do a full reboot, I can do that. Let me > know. > > So there may have been some rc.d framework changes that address your > problem. Are you running -RELEASE? If so those fixes probably aren't > available. And here's the commit that fixed it (src/etc/network.subr, which is /etc/network.subr): http://www.freebsd.org/cgi/cvsweb.cgi/src/etc/network.subr#rev1.195.2.12 http://www.freebsd.org/cgi/query-pr.cgi?pr=156675 So your choices are: 1. Run RELENG_8 (8.2-STABLE) or higher, 2. Wait for 8.3-RELEASE, 3. Hand-hack /etc/network.subr to address this, which you will lose every time you run mergemaster (I strongly recommend you do not do this; breakage in network.subr could be very bad for you). I still think we should have ifconfig_XXX_descr though, just because having super long ifconfig_XXX lines in rc.conf is sometimes tedious and difficult to read. -- | Jeremy Chadwick jdc at parodius.com | | Parodius Networking http://www.parodius.com/ | | UNIX Systems Administrator Mountain View, CA, US | | Making life hard for others since 1977. PGP 4BD6C0CB |