diff --git a/CHANGELOG.md b/CHANGELOG.md index 70c45a4..26145c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ FEATURES: - Add support for salt-minion and add latest dev release for ubuntu codenamed saucy [#116](https://github.com/fgrehm/vagrant-lxc/pull/116) - Add support for using a sudo wrapper script [#90](https://github.com/fgrehm/vagrant-lxc/issues/90) + - `redir` will log to `/var/log/syslog` if `REDIR_LOG` env var is provided IMPROVEMENTS: diff --git a/lib/vagrant-lxc/action/forward_ports.rb b/lib/vagrant-lxc/action/forward_ports.rb index 75084ff..e548e7e 100644 --- a/lib/vagrant-lxc/action/forward_ports.rb +++ b/lib/vagrant-lxc/action/forward_ports.rb @@ -72,8 +72,10 @@ module Vagrant end def redirect_port(host_ip, host_port, guest_ip, guest_port) - host_ip = "--laddr=#{host_ip} " if host_ip - redir_cmd = "redir #{host_ip}--lport=#{host_port} --caddr=#{guest_ip} --cport=#{guest_port} 2>/dev/null" + params = %W( --lport=#{host_port} --caddr=#{guest_ip} --cport=#{guest_port} ) + params.unshift "--laddr=#{host_ip}" if host_ip + params << '--syslog' if ENV['REDIR_LOG'] + redir_cmd = "redir #{params.join(' ')} 2>/dev/null" @logger.debug "Forwarding port with `#{redir_cmd}`" spawn redir_cmd