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
This commit is contained in:
Yaroslav Tykhiy 2004-08-28 07:58:02 +00:00
parent cb7f04cf39
commit cd9d7d4d0c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=134429

View File

@ -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