From 2032b765e70bf2638c33fea6437540f26aa24e2a Mon Sep 17 00:00:00 2001 From: yar Date: Sat, 28 Aug 2004 07:58:02 +0000 Subject: [PATCH] Avoid double appearing of cloned interfaces in the output from list_net_interfaces() when network_interfaces=auto. Rationale: Since the auto case is special, the lesser evil had to be chosen among not adding cloned interfaces to _tmplist or removing duplicates from _tmplist after adding cloned interfaces. Since list_net_interfaces() must not use /usr/bin tools, the former "evil" appeared clearer and much more efficient. (See the PR audit trail for discussion.) PR: conf/63700 Reviewed by: brooks MFC after: 5 days --- etc/network.subr | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/etc/network.subr b/etc/network.subr index 64cfd6f9be85..b413e014331d 100644 --- a/etc/network.subr +++ b/etc/network.subr @@ -258,7 +258,9 @@ ipx_down() # nodhcp - all interfaces, excluding DHCP configured interfaces # dhcp - list only DHCP configured interfaces # If no argument is specified all network interfaces are output. -# Note that the list always includes cloned interfaces. +# Note that the list will include cloned interfaces if applicable. +# Cloned interfaces must already exist to have a chance to appear +# in the list if ${network_interfaces} is set to `auto'. # list_net_interfaces() { @@ -271,10 +273,9 @@ list_net_interfaces() _tmplist="`ifconfig -l`" ;; *) - _tmplist="${network_interfaces}" + _tmplist="${network_interfaces} ${cloned_interfaces}" ;; esac - _tmplist="${_tmplist} ${cloned_interfaces}" if [ -z "$type" ]; then echo $_tmplist