From bb1db8253a2642701fb178db2dbffe971a7d8ecd Mon Sep 17 00:00:00 2001 From: HD Moore Date: Fri, 25 Jul 2008 05:05:32 +0000 Subject: [PATCH] Raw socket mode that should work for 'everyone' git-svn-id: file:///home/svn/framework3/trunk@5595 4d416f70-5f16-0410-b530-b9f4589650da --- lib/rex/socket/comm/local.rb | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/lib/rex/socket/comm/local.rb b/lib/rex/socket/comm/local.rb index 35a215e483..8278079bc3 100644 --- a/lib/rex/socket/comm/local.rb +++ b/lib/rex/socket/comm/local.rb @@ -39,18 +39,11 @@ class Rex::Socket::Comm::Local # Special-cased because of how different it is from UDP/TCP # def self.create_ip(param) - sock = ::Socket.open(::Socket::PF_INET, ::Socket::SOCK_RAW, ::Socket::IPPROTO_RAW) - - if(::Socket.const_defined?('SOL_IP')) - unless sock.getsockopt(::Socket::SOL_IP, ::Socket::IP_HDRINCL) - sock.setsockopt(::Socket::SOL_IP, ::Socket::IP_HDRINCL, true) - 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 + sock = ::Socket.open(::Socket::AF_INET, ::Socket::SOCK_RAW, ::Socket::IPPROTO_RAW) + + unless sock.getsockopt(::Socket::IPPROTO_IP, ::Socket::IP_HDRINCL) + sock.setsockopt(::Socket::IPPROTO_IP, ::Socket::IP_HDRINCL, true) + end return sock if (param.bare?)