Allow auto interfaces to be given a specific name

This commit is contained in:
Matt Churchyard
2021-01-06 10:47:38 +00:00
parent 52a504e409
commit 79f44430d7
3 changed files with 10 additions and 2 deletions

View File

@@ -25,7 +25,7 @@
# POSSIBILITY OF SUCH DAMAGE.
VERSION=1.5-devel
VERSION_INT=105012
VERSION_INT=105013
VERSION_BSD=$(uname -K)
PATH=${PATH}:/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin

View File

@@ -529,7 +529,7 @@ vm::bhyve_device_disks(){
#
vm::bhyve_device_networking(){
local _type _switch _mac _custom_tap _tap _sid _mtu
local _num=0 _member_type _sw_type
local _num=0 _member_type _sw_type _iname
while true; do
config::get "_type" "network${_num}_type"
@@ -538,6 +538,7 @@ vm::bhyve_device_networking(){
config::get "_switch" "network${_num}_switch"
config::get "_mac" "network${_num}_mac"
config::get "_custom_tap" "network${_num}_device"
config::get "_iname" "network${_num}_name"
# set a static mac if we don't have one
[ -z "${_mac}" ] && vm::generate_static_mac
@@ -564,6 +565,8 @@ vm::bhyve_device_networking(){
# create interface
if [ -n "${_custom_tap}" ]; then
_tap="${_custom_tap}"
elif [ -n "${_iname}" ]; then
_tap=$(ifconfig tap create name "${_iname}")
else
_tap=$(ifconfig tap create)
fi

View File

@@ -247,6 +247,11 @@ network0_switch="public"
#
network0_device=""
# network0_name
# if specified, the interface will be given this name
#
network0_name="web1"
# network0_mac
# This allows you to specify a fixed mac address for this interface inside the guest.
# When a guest is run, vm-bhyve will automatically assign a mac address for each