diff --git a/CHANGELOG.md b/CHANGELOG.md index 730d9edb4..d70dc049f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ - Chef-solo provisioner now supports encrypted data bags. [GH-816] - Enable the NAT DNS proxy by default, allowing your DNS to continue working when you switch networks. [GH-834] + - Checking for port forwarding collisions also checks for other applications + that are potentially listening on that port as well. [GH-821] ## 1.0.1 (March 11, 2012) diff --git a/lib/vagrant/action/vm/check_port_collisions.rb b/lib/vagrant/action/vm/check_port_collisions.rb index 3bb46d80e..254b351ad 100644 --- a/lib/vagrant/action/vm/check_port_collisions.rb +++ b/lib/vagrant/action/vm/check_port_collisions.rb @@ -1,9 +1,13 @@ +require "vagrant/util/is_port_open" + module Vagrant module Action module VM # Action that checks to make sure there are no forwarded port collisions, # and raises an exception if there is. class CheckPortCollisions + include Util::IsPortOpen + def initialize(app, env) @app = app end @@ -29,7 +33,7 @@ module Vagrant hostport = options[:hostport].to_i hostport = current[options[:name]] if current.has_key?(options[:name]) - if existing.include?(hostport) + if existing.include?(hostport) || is_port_open?("localhost", hostport) # We have a collision! Handle it send("handle_#{handler}".to_sym, options, existing) end