From c43ab95f8619d403e57baffddd41158aa3380eb7 Mon Sep 17 00:00:00 2001 From: Kostyantyn Fomin Date: Wed, 6 Aug 2014 14:10:05 -0700 Subject: [PATCH] Fix Issue 4307: FreeBSD fix interface device names in /etc/rc.conf https://github.com/mitchellh/vagrant/issues/4307 Fix details: Pass network interface name to template renderer and use it in static and dhcp templates to render /etc/rc.conf entries. modified: plugins/guests/freebsd/cap/configure_networks.rb modified: templates/guests/freebsd/network_dhcp.erb modified: templates/guests/freebsd/network_static.erb Verification scenario: Check if /etc/rc.conf contains vtnet entries when paravirtualized NIC devices are used in FreeBSD guest. --- plugins/guests/freebsd/cap/configure_networks.rb | 2 +- templates/guests/freebsd/network_dhcp.erb | 2 +- templates/guests/freebsd/network_static.erb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/guests/freebsd/cap/configure_networks.rb b/plugins/guests/freebsd/cap/configure_networks.rb index 80267ca23..30d793cfa 100644 --- a/plugins/guests/freebsd/cap/configure_networks.rb +++ b/plugins/guests/freebsd/cap/configure_networks.rb @@ -27,7 +27,7 @@ module VagrantPlugins end entry = TemplateRenderer.render("guests/freebsd/network_#{network[:type]}", - options: network) + options: network, ifname: ifname) # Write the entry to a temporary location temp = Tempfile.new("vagrant") diff --git a/templates/guests/freebsd/network_dhcp.erb b/templates/guests/freebsd/network_dhcp.erb index bee4a47b0..672b01f94 100644 --- a/templates/guests/freebsd/network_dhcp.erb +++ b/templates/guests/freebsd/network_dhcp.erb @@ -1,3 +1,3 @@ #VAGRANT-BEGIN -ifconfig_em<%= options[:interface] %>="DHCP" +ifconfig_em<%= ifname %>="DHCP" #VAGRANT-END diff --git a/templates/guests/freebsd/network_static.erb b/templates/guests/freebsd/network_static.erb index 3b24b1eeb..0edc518cb 100644 --- a/templates/guests/freebsd/network_static.erb +++ b/templates/guests/freebsd/network_static.erb @@ -1,3 +1,3 @@ #VAGRANT-BEGIN -ifconfig_em<%= options[:interface] %>="inet <%= options[:ip] %> netmask <%= options[:netmask] %>" +ifconfig_<%= ifname %>="inet <%= options[:ip] %> netmask <%= options[:netmask] %>" #VAGRANT-END