Move away from using ifconfig to ip link for enabling / disabling bridge devices

This commit is contained in:
Michael Stucki 2015-08-25 10:18:02 +02:00
parent c3508870fd
commit 31bb4eadf9
2 changed files with 4 additions and 4 deletions

View file

@ -162,7 +162,7 @@ module Vagrant
bridge_name
]
@sudo_wrapper.run(*cmd)
@sudo_wrapper.run('ifconfig', bridge_name, 'up')
@sudo_wrapper.run('ip', 'link', 'set', bridge_name, 'up')
end
cmd = [
@ -181,7 +181,7 @@ module Vagrant
def bridge_exists?(bridge_name)
@logger.info "Checking whether bridge #{bridge_name} exists"
brctl_output = `ifconfig -a | grep -q #{bridge_name}`
brctl_output = `ip link | grep -q #{bridge_name}`
$?.to_i == 0
end
@ -196,7 +196,7 @@ module Vagrant
return unless bridge_exists?(bridge_name)
@logger.info "Removing bridge #{bridge_name}"
@sudo_wrapper.run('ifconfig', bridge_name, 'down')
@sudo_wrapper.run('ip', 'link', 'set', bridge_name, 'down')
@sudo_wrapper.run('brctl', 'delbr', bridge_name)
end

View file

@ -106,7 +106,7 @@ Whitelist.add '<%= cmd_paths['tar'] %>', '--numeric-owner', '-cvzf', %r{/tmp/.*/
Whitelist.add '<%= cmd_paths['chown'] %>', /\A\d+:\d+\z/, %r{\A/tmp/.*/rootfs\.tar\.gz\z}
# - Private network script and commands
Whitelist.add '<%= cmd_paths['ip'] %>', 'addr', 'add', /(\d+|\.)+\/24/, 'dev', /.+/
Whitelist.add '<%= cmd_paths['ifconfig'] %>', /.+/, /(up|down)/
Whitelist.add '<%= cmd_paths['ip'] %>', 'link', 'set', /.+/, /(up|down)/
Whitelist.add '<%= cmd_paths['brctl'] %>', /(addbr|delbr)/, /.+/
Whitelist.add_regex %r{<%= pipework_regex %>}, '**'