diff options
Diffstat (limited to 'standalone/android/haskell-patches/socks_0.4.2_0001-remove-IPv6-stuff.patch')
-rw-r--r-- | standalone/android/haskell-patches/socks_0.4.2_0001-remove-IPv6-stuff.patch | 152 |
1 files changed, 90 insertions, 62 deletions
diff --git a/standalone/android/haskell-patches/socks_0.4.2_0001-remove-IPv6-stuff.patch b/standalone/android/haskell-patches/socks_0.4.2_0001-remove-IPv6-stuff.patch index 5a343d875..fc9569573 100644 --- a/standalone/android/haskell-patches/socks_0.4.2_0001-remove-IPv6-stuff.patch +++ b/standalone/android/haskell-patches/socks_0.4.2_0001-remove-IPv6-stuff.patch @@ -1,43 +1,29 @@ -From abab0f8202998a3e88c5dc5f67a8245da6c174b3 Mon Sep 17 00:00:00 2001 -From: Joey Hess <joey@kitenet.net> -Date: Thu, 28 Feb 2013 23:36:20 -0400 +From 28e6a6599ee91e15aa7b2f9d25433490f192f22e Mon Sep 17 00:00:00 2001 +From: foo <foo@bar> +Date: Sat, 21 Sep 2013 23:17:29 +0000 Subject: [PATCH] remove IPv6 stuff --- - Network/Socks5.hs | 1 - - Network/Socks5/Command.hs | 16 ++-------------- - Network/Socks5/Types.hs | 3 +-- - Network/Socks5/Wire.hs | 2 -- - 4 files changed, 3 insertions(+), 19 deletions(-) + Network/Socks5/Command.hs | 8 +------- + Network/Socks5/Conf.hs | 1 - + Network/Socks5/Lowlevel.hs | 1 - + Network/Socks5/Types.hs | 18 +----------------- + Network/Socks5/Wire.hs | 2 -- + 5 files changed, 2 insertions(+), 28 deletions(-) -diff --git a/Network/Socks5.hs b/Network/Socks5.hs -index 67b0060..80efb9c 100644 ---- a/Network/Socks5.hs -+++ b/Network/Socks5.hs -@@ -54,7 +54,6 @@ socksConnectAddr :: Socket -> SockAddr -> SockAddr -> IO () - socksConnectAddr sock sockserver destaddr = withSocks sock sockserver $ do - case destaddr of - SockAddrInet p h -> socks5ConnectIPV4 sock h p >> return () -- SockAddrInet6 p _ h _ -> socks5ConnectIPV6 sock h p >> return () - _ -> error "unsupported unix sockaddr type" - - -- | connect a new socket to the socks server, and connect the stream to a FQDN diff --git a/Network/Socks5/Command.hs b/Network/Socks5/Command.hs -index 2952706..db994c9 100644 +index 8ce06ec..222d954 100644 --- a/Network/Socks5/Command.hs +++ b/Network/Socks5/Command.hs -@@ -9,9 +9,8 @@ - -- - module Network.Socks5.Command - ( socks5Establish -- , socks5ConnectIPV4 -- , socks5ConnectIPV6 - , socks5ConnectDomainName -+ , socks5ConnectIPV4 - -- * lowlevel interface - , socks5Rpc - ) where -@@ -23,7 +22,7 @@ import qualified Data.ByteString as B +@@ -12,7 +12,6 @@ module Network.Socks5.Command + , Connect(..) + , Command(..) + , connectIPV4 +- , connectIPV6 + , connectDomainName + -- * lowlevel interface + , rpc +@@ -28,7 +27,7 @@ import qualified Data.ByteString as B import qualified Data.ByteString.Char8 as BC import Data.Serialize @@ -46,50 +32,92 @@ index 2952706..db994c9 100644 import Network.Socket.ByteString import Network.Socks5.Types -@@ -46,17 +45,6 @@ socks5ConnectIPV4 socket hostaddr port = onReply <$> socks5Rpc socket request - onReply (SocksAddrIPV4 h, p) = (h, p) - onReply _ = error "ipv4 requested, got something different" +@@ -64,11 +63,6 @@ connectIPV4 socket hostaddr port = onReply <$> rpc_ socket (Connect $ SocksAddre + where onReply (SocksAddrIPV4 h, p) = (h, p) + onReply _ = error "ipv4 requested, got something different" --socks5ConnectIPV6 :: Socket -> HostAddress6 -> PortNumber -> IO (HostAddress6, PortNumber) --socks5ConnectIPV6 socket hostaddr6 port = onReply <$> socks5Rpc socket request -- where -- request = SocksRequest -- { requestCommand = SocksCommandConnect -- , requestDstAddr = SocksAddrIPV6 hostaddr6 -- , requestDstPort = fromIntegral port -- } -- onReply (SocksAddrIPV6 h, p) = (h, p) -- onReply _ = error "ipv6 requested, got something different" +-connectIPV6 :: Socket -> HostAddress6 -> PortNumber -> IO (HostAddress6, PortNumber) +-connectIPV6 socket hostaddr6 port = onReply <$> rpc_ socket (Connect $ SocksAddress (SocksAddrIPV6 hostaddr6) port) +- where onReply (SocksAddrIPV6 h, p) = (h, p) +- onReply _ = error "ipv6 requested, got something different" - -- TODO: FQDN should only be ascii, maybe putting a "fqdn" data type -- in front to make sure and make the BC.pack safe. - socks5ConnectDomainName :: Socket -> String -> PortNumber -> IO (SocksAddr, PortNumber) + connectDomainName :: Socket -> String -> PortNumber -> IO (SocksHostAddress, PortNumber) +diff --git a/Network/Socks5/Conf.hs b/Network/Socks5/Conf.hs +index c29ff7b..007d382 100644 +--- a/Network/Socks5/Conf.hs ++++ b/Network/Socks5/Conf.hs +@@ -47,5 +47,4 @@ defaultSocksConfFromSockAddr sockaddr = SocksConf server SocksVer5 + where server = SocksAddress haddr port + (haddr,port) = case sockaddr of + SockAddrInet p h -> (SocksAddrIPV4 h, p) +- SockAddrInet6 p _ h _ -> (SocksAddrIPV6 h, p) + _ -> error "unsupported unix sockaddr type" +diff --git a/Network/Socks5/Lowlevel.hs b/Network/Socks5/Lowlevel.hs +index c10d9b9..2c3d59c 100644 +--- a/Network/Socks5/Lowlevel.hs ++++ b/Network/Socks5/Lowlevel.hs +@@ -17,7 +17,6 @@ resolveToSockAddr :: SocksAddress -> IO SockAddr + resolveToSockAddr (SocksAddress sockHostAddr port) = + case sockHostAddr of + SocksAddrIPV4 ha -> return $ SockAddrInet port ha +- SocksAddrIPV6 ha6 -> return $ SockAddrInet6 port 0 ha6 0 + SocksAddrDomainName bs -> do he <- getHostByName (BC.unpack bs) + return $ SockAddrInet port (hostAddress he) + diff --git a/Network/Socks5/Types.hs b/Network/Socks5/Types.hs -index 5dc7d5e..12dea99 100644 +index 7fbec25..17c7c83 100644 --- a/Network/Socks5/Types.hs +++ b/Network/Socks5/Types.hs -@@ -17,7 +17,7 @@ module Network.Socks5.Types +@@ -19,7 +19,7 @@ module Network.Socks5.Types import Data.ByteString (ByteString) import Data.Word import Data.Data --import Network.Socket (HostAddress, HostAddress6) -+import Network.Socket (HostAddress) +-import Network.Socket (HostAddress, HostAddress6, PortNumber) ++import Network.Socket (HostAddress, PortNumber) import Control.Exception + import qualified Data.ByteString.Char8 as BC + import Numeric (showHex) +@@ -53,12 +53,10 @@ data SocksMethod = + data SocksHostAddress = + SocksAddrIPV4 !HostAddress + | SocksAddrDomainName !ByteString +- | SocksAddrIPV6 !HostAddress6 + deriving (Eq,Ord) - data SocksCommand = -@@ -38,7 +38,6 @@ data SocksMethod = - data SocksAddr = - SocksAddrIPV4 HostAddress - | SocksAddrDomainName ByteString -- | SocksAddrIPV6 HostAddress6 - deriving (Show,Eq) + instance Show SocksHostAddress where + show (SocksAddrIPV4 ha) = "SocksAddrIPV4(" ++ showHostAddress ha ++ ")" +- show (SocksAddrIPV6 ha6) = "SocksAddrIPV6(" ++ showHostAddress6 ha6 ++ ")" + show (SocksAddrDomainName dn) = "SocksAddrDomainName(" ++ BC.unpack dn ++ ")" - data SocksReply = + -- | Converts a HostAddress to a String in dot-decimal notation +@@ -69,20 +67,6 @@ showHostAddress num = concat [show q1, ".", show q2, ".", show q3, ".", show q4] + (num''',q3) = num'' `quotRem` 256 + (_,q4) = num''' `quotRem` 256 + +--- | Converts a IPv6 HostAddress6 to standard hex notation +-showHostAddress6 :: HostAddress6 -> String +-showHostAddress6 (a,b,c,d) = +- (concat . intersperse ":" . map (flip showHex "")) +- [p1,p2,p3,p4,p5,p6,p7,p8] +- where (a',p2) = a `quotRem` 65536 +- (_,p1) = a' `quotRem` 65536 +- (b',p4) = b `quotRem` 65536 +- (_,p3) = b' `quotRem` 65536 +- (c',p6) = c `quotRem` 65536 +- (_,p5) = c' `quotRem` 65536 +- (d',p8) = d `quotRem` 65536 +- (_,p7) = d' `quotRem` 65536 +- + -- | Describe a Socket address on the SOCKS protocol + data SocksAddress = SocksAddress !SocksHostAddress !PortNumber + deriving (Show,Eq,Ord) diff --git a/Network/Socks5/Wire.hs b/Network/Socks5/Wire.hs -index 2cfed52..d3bd9c5 100644 +index 3ab95a8..2881988 100644 --- a/Network/Socks5/Wire.hs +++ b/Network/Socks5/Wire.hs -@@ -41,12 +41,10 @@ data SocksResponse = SocksResponse +@@ -46,12 +46,10 @@ data SocksResponse = SocksResponse getAddr 1 = SocksAddrIPV4 <$> getWord32be getAddr 3 = SocksAddrDomainName <$> (getWord8 >>= getByteString . fromIntegral) @@ -101,7 +129,7 @@ index 2cfed52..d3bd9c5 100644 -putAddr (SocksAddrIPV6 (a,b,c,d)) = putWord8 4 >> mapM_ putWord32host [a,b,c,d] getSocksRequest 5 = do - cmd <- toEnum . fromIntegral <$> getWord8 + cmd <- toEnum . fromIntegral <$> getWord8 -- 1.7.10.4 |