From 7f1225c9521c2e4936c5ccf73f1cc34e8c459bb3 Mon Sep 17 00:00:00 2001 From: joe Date: Fri, 5 Jul 2013 02:51:07 -0400 Subject: unmap6mapped4 function in whosocket. --- whosocket.hs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'whosocket.hs') diff --git a/whosocket.hs b/whosocket.hs index 97912eff..7fd44b4d 100644 --- a/whosocket.hs +++ b/whosocket.hs @@ -23,6 +23,7 @@ import Data.Maybe (listToMaybe,mapMaybe,catMaybes) import Network.Socket import System.Environment import Control.Arrow (first) +import System.Endian usage = do putStrLn $ "whosocket numeric-address port" @@ -38,6 +39,8 @@ whosocket addr_str port_str = do (Just addr_str) (Just port_str) let addr = head $ map addrAddress info + putStrLn $ "addr = "++show addr + putStrLn $ "unmap6mapped4 addr = "++show (unmap6mapped4 addr) r <- getLocalPeerCred' addr -- putStrLn $ "r{"++show addr++"} = " ++ show r @@ -152,3 +155,8 @@ identifyTTY tty_pids uid inode = do let tty' = if take 3 tty=="tty" then Just (L.pack tty) else lookup tty dts return tty' + + +-- PEER NAME: [::ffff:127.0.0.1]:34307 +unmap6mapped4 addr@(SockAddrInet6 port _ (0,0,0xFFFF,a) _) = SockAddrInet port (toBE32 a) +unmap6mapped4 addr = addr -- cgit v1.2.3