summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreugen <eugen@FreeBSD.org>2017-11-14 09:29:02 +0000
committereugen <eugen@FreeBSD.org>2017-11-14 09:29:02 +0000
commite683b49c3e3b94e2c0f2704881e1fb1acd1c090b (patch)
tree63cde58c177882329b4a42b1e1e16c4bdde5a6bd
parent5fa0b747dd0ded7e865817abaeedca615a937a3c (diff)
downloadFreeBSD-src-e683b49c3e3b94e2c0f2704881e1fb1acd1c090b.zip
FreeBSD-src-e683b49c3e3b94e2c0f2704881e1fb1acd1c090b.tar.gz
MFC r325559: ifconfig_<interface>_descr
Add suitable knob ifconfig_<interface>_descr for static interface description. Document availability of interface descriptions within rc.conf(5). Approved by: avg (mentor)
-rw-r--r--etc/network.subr7
-rw-r--r--share/man/man5/rc.conf.517
2 files changed, 23 insertions, 1 deletions
diff --git a/etc/network.subr b/etc/network.subr
index 2410e2d..0c13a60 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 c2f7a02..dbd37bd 100644
--- a/share/man/man5/rc.conf.5
+++ b/share/man/man5/rc.conf.5
@@ -1578,6 +1578,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
OpenPOWER on IntegriCloud