Dont use ipv6 sockets for unconnected udp on freebsd

git-svn-id: file:///home/svn/framework3/trunk@5278 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2008-01-06 21:51:07 +00:00
parent 7123cce773
commit df67cb42f9
2 changed files with 10 additions and 1 deletions

View File

@ -30,6 +30,11 @@ def self.is_linux
(RUBY_PLATFORM =~ /linux/) ? true : false
end
def self.is_freebsd
(RUBY_PLATFORM =~ /freebsd/) ? true : false
end
def self.open_browser(url='http://metasploit.com/')
case RUBY_PLATFORM
when /mswin32/

View File

@ -48,8 +48,12 @@ class Rex::Socket::Comm::Local
# Force IPv6 mode for non-connected UDP sockets
if (type == ::Socket::SOCK_DGRAM and not param.peerhost)
# FreeBSD allows IPv6 socket creation, but throws an error on sendto()
if (not Rex::Compat.is_freebsd())
usev6 = true
end
end
local = Rex::Socket.resolv_nbo(param.localhost) if param.localhost
peer = Rex::Socket.resolv_nbo(param.peerhost) if param.peerhost