From cedc7c5870acbd959502cd26116674a2b720b066 Mon Sep 17 00:00:00 2001 From: Eugene Grosbein Date: Wed, 8 Nov 2017 16:53:11 +0000 Subject: [PATCH] Add suitable knob ifconfig__descr for static interface description. Document availability of interface descriptions within rc.conf(5). Approved by: avg (mentor), mav (mentor) MFC after: 3 days --- etc/network.subr | 7 ++++++- share/man/man5/rc.conf.5 | 17 +++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/etc/network.subr b/etc/network.subr index 3ae66c667cd5..daa7442088aa 100644 --- a/etc/network.subr +++ b/etc/network.subr @@ -122,7 +122,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. @@ -214,6 +214,11 @@ ifconfig_up() ifalias $1 link alias ifalias $1 ether alias + _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 /etc/rc.d/wpa_supplicant start $1 _cfg=0 # XXX: not sure this should count diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index 76415f06b6e2..c8f3cdec2331 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -1616,6 +1616,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