Enable the use of wildcards in the #ethertable section of

/etc/hosts to map MAC addresses to hostnames.

Main use is to get addresses for vmware interfaces.
This commit is contained in:
Luigi Rizzo 2001-09-27 16:47:45 +00:00
parent 5119d237e5
commit e8b19bc63e

View File

@ -47,10 +47,13 @@ hostname=""
while read a b c ; do
if [ "$a" = "#ethertable" ] ; then
hostname="."
elif [ "X$hostname" = "X." -a "X$a" = "X#" -a "X$b" = "X$main_ether" ]
then
hostname=$c
break
elif [ "X$hostname" = "X." -a "X$a" = "X#" ] ; then
case X${main_ether} in
X${b} ) # so we can use wildcards
hostname=$c
break
;;
esac
fi
done < /etc/hosts
if [ "X$hostname" = "X" -o "X$hostname" = "X." ] ; then