Raw socket mode that should work for 'everyone'
git-svn-id: file:///home/svn/framework3/trunk@5595 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
cef76df19c
commit
bb1db8253a
|
@ -39,18 +39,11 @@ class Rex::Socket::Comm::Local
|
||||||
# Special-cased because of how different it is from UDP/TCP
|
# Special-cased because of how different it is from UDP/TCP
|
||||||
#
|
#
|
||||||
def self.create_ip(param)
|
def self.create_ip(param)
|
||||||
sock = ::Socket.open(::Socket::PF_INET, ::Socket::SOCK_RAW, ::Socket::IPPROTO_RAW)
|
sock = ::Socket.open(::Socket::AF_INET, ::Socket::SOCK_RAW, ::Socket::IPPROTO_RAW)
|
||||||
|
|
||||||
if(::Socket.const_defined?('SOL_IP'))
|
unless sock.getsockopt(::Socket::IPPROTO_IP, ::Socket::IP_HDRINCL)
|
||||||
unless sock.getsockopt(::Socket::SOL_IP, ::Socket::IP_HDRINCL)
|
sock.setsockopt(::Socket::IPPROTO_IP, ::Socket::IP_HDRINCL, true)
|
||||||
sock.setsockopt(::Socket::SOL_IP, ::Socket::IP_HDRINCL, true)
|
end
|
||||||
end
|
|
||||||
else
|
|
||||||
# Support for BSD
|
|
||||||
unless sock.getsockopt(::Socket::IPPROTO_IP, ::Socket::IP_HDRINCL)
|
|
||||||
sock.setsockopt(::Socket::IPPROTO_IP, ::Socket::IP_HDRINCL, true)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return sock if (param.bare?)
|
return sock if (param.bare?)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue