summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaulo Alcantara <paulo@paulo.ac>2018-04-04 15:14:39 -0300
committerPaulo Alcantara <paulo@paulo.ac>2018-04-04 15:14:39 -0300
commit8bc207aab4b124b5a78546e78cde7e9c412d11b2 (patch)
tree95e2f31d72e5e1412003aa98216f365444f33401
parentb18091d44fcc95dd88909707816669c836993040 (diff)
downloadvmhtool-8bc207aab4b124b5a78546e78cde7e9c412d11b2.tar.gz
vmhtool-8bc207aab4b124b5a78546e78cde7e9c412d11b2.tar.xz
vmhtool-8bc207aab4b124b5a78546e78cde7e9c412d11b2.zip
Fix creation of bridge device.
Signed-off-by: Paulo Alcantara <paulo@paulo.ac>
-rwxr-xr-xvmhelper28
1 files changed, 11 insertions, 17 deletions
diff --git a/vmhelper b/vmhelper
index 0906196..db312a6 100755
--- a/vmhelper
+++ b/vmhelper
@@ -117,21 +117,18 @@ sub is_net_iface_created {
return 0;
}
+sub create_bridge_dev {
+ system("sudo /sbin/brctl addbr $bridge_iface");
+ system("sudo /bin/ip addr flush dev $eth_iface");
+ system("sudo /sbin/brctl addif $bridge_iface $eth_iface");
+ system("sudo /bin/ip addr add dev $bridge_iface $bridge_ipaddr/24");
+ system("sudo /bin/ip route delete default via $router_ipaddr > /dev/null 2>&1");
+ system("sudo /bin/ip link set dev $bridge_iface up");
+ system("sudo /bin/ip route add default via $router_ipaddr");
+}
+
sub create_tap_dev {
- unless (is_net_iface_created($bridge_iface)) {
- my @cmds = (
- "sudo /sbin/brctl addbr $bridge_iface",
- "sudo /bin/ip addr flush dev $eth_iface",
- "sudo /sbin/brctl addif $bridge_iface $eth_iface",
- "sudo /bin/ip addr add dev $bridge_iface $bridge_ipaddr/24",
- "sudo /bin/ip route delete default via $router_ipaddr > /dev/null 2>&1",
- "sudo /bin/ip link set dev $bridge_iface up",
- "sudo /bin/ip route add default via $router_ipaddr"
- );
- foreach (@cmds) {
- system($_) == 0 or die "failed to create bridge device: $?";
- }
- }
+ create_bridge_dev() unless is_net_iface_created($bridge_iface);
my $user = $ENV{'USER'};
die "failed to determine username" unless $user;
@@ -349,9 +346,6 @@ sub setup_shared_dirs {
rem_old_shares() and return unless $shared_dirs;
my @dirs = split(/,/, $shared_dirs);
- foreach (@dirs) {
- print "share: $_\n";
- }
my $args = '';
my $count = 0;
my $arg = "-fsdev local,security_model=none,id=%s,path=%s -device virtio-9p-pci,id=%s,fsdev=%s,mount_tag=%s";