Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Apr 2011 11:37:18 GMT
From:      "Alexander V. Chernikov" <melifaro@ipfw.ru>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   conf/156675: [patch] add ifconfig_IF_description variable
Message-ID:  <201104271137.p3RBbI1C047336@red.freebsd.org>
Resent-Message-ID: <201104271140.p3RBe9IA003545@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         156675
>Category:       conf
>Synopsis:       [patch] add ifconfig_IF_description variable
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Apr 27 11:40:09 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Alexander V. Chernikov
>Release:        FreeBSD 8.2-STABLE
>Organization:
JSC "Meganet"
>Environment:
FreeBSD silicium.meganet.ru 8.2-STABLE FreeBSD 8.2-STABLE #1: Mon Apr 18 18:22:06 MSD 2011     root@silicium.meganet.ru:/usr/obj/usr/src/sys/ROUTER  amd64

>Description:
Since 8.X it is possible to network interface description via ifconfig vlanX description my long description

Setting such description (any data with spaces) via ifconfig_IF=".. description 'my long description' ..." resuls in setting description "my" (e.g. data before first space)

Various common escaping ('', \ , \"\") does not help
>How-To-Repeat:
echo ifconfig_vlan555=\"description \'1 2 3\' vlan 255 vlandev IFACE\" >> /etc/rc.conf
ifconfig vlan555 create
ifconfig


>Fix:
Proposed solution is to add new ifconfig_IF_description rc.conf variable

Patch attached with submission follows:

--- etc/network.subr.orig	2011-04-27 13:15:24.125829072 +0400
+++ etc/network.subr	2011-04-27 13:44:36.713516613 +0400
@@ -90,6 +90,12 @@
 		_cfg=0
 	fi
 
+	# set interface description
+	description=`get_if_var $1 ifconfig_IF_description`
+	if [ -n "${description}" ]; then
+		ifconfig $1 description "${description}"
+	fi
+
 	if wpaif $1; then
 		/etc/rc.d/wpa_supplicant start $1
 		_cfg=0		# XXX: not sure this should count
--- share/man/man5/rc.conf.5.orig	2011-01-24 18:17:10.000000000 +0300
+++ share/man/man5/rc.conf.5	2011-04-27 14:16:08.508775228 +0400
@@ -1078,6 +1078,10 @@
 .Xr ifconfig 8
 while the order of the other arguments is preserved.
 .Pp
+Interface description can be set via
+.Va ifconfig_ Ns Ao Ar interface Ac Ns Va _description
+variable
+.Pp
 One can configure more than one IPv4 address with the
 .Va ipv4_addrs_ Ns Aq Ar interface
 variable.


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201104271137.p3RBbI1C047336>