From 38d491f059d2dd3b0922b72f014351fa7808a46c Mon Sep 17 00:00:00 2001 From: eugen Date: Tue, 14 Nov 2017 09:31:56 +0000 Subject: [PATCH] MFC r325559: ifconfig__descr Add suitable knob ifconfig__descr for static interface description. Document availability of interface descriptions within rc.conf(5). Approved by: avg (mentor) git-svn-id: svn://svn.freebsd.org/base/stable/10@325799 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- etc/network.subr | 7 ++++--- share/man/man5/rc.conf.5 | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/etc/network.subr b/etc/network.subr index d621b2c6d..cf10c329a 100644 --- a/etc/network.subr +++ b/etc/network.subr @@ -124,7 +124,7 @@ ifn_vnet0() # ifconfig_up() { - local _cfg _ipv6_opts ifconfig_args + local _cfg _ifconfig_descr _ipv6_opts ifconfig_args _cfg=1 # Make sure lo0 always comes up. @@ -216,8 +216,9 @@ ifconfig_up() ifalias $1 link alias ifalias $1 ether alias - if [ ${_cfg} -eq 0 ]; then - ${IFCONFIG_CMD} $1 up + _ifconfig_descr=`get_if_var $1 ifconfig_IF_descr` + if [ -n "${_ifconfig_descr}" ]; then + ${IFCONFIG_CMD} $1 description "${_ifconfig_descr}" fi if wpaif $1; then diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index 34256b03a..c4f5d8ded 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -1575,6 +1575,23 @@ is set to 1. .Pp Default is .Dq Li NO . +.It Va ifconfig_ Ns Ao Ar interface Ac Ns _descr +.Pq Vt str +This assigns arbitrary description to an interface. +The +.Xr sysctl 8 +variable +.Va net.ifdescr_maxlen +limits its length. +This static setting may be overridden by commands +started with dynamic interface configuration utilities +like +.Xr dhclient 8 +hooks. The description can be seen with +.Xr ifconfig 8 +command and it may be exported with +.Xr bsnmpd 1 +daemon using its MIB-2 module. .It Va ifconfig_ Ns Ao Ar interface Ac Ns _ipv6 .Pq Vt str IPv6 functionality on an interface should be configured by -- 2.42.0