diff options
author | joe <joe@jerkface.net> | 2013-07-05 02:51:07 -0400 |
---|---|---|
committer | joe <joe@jerkface.net> | 2013-07-05 02:51:07 -0400 |
commit | 7f1225c9521c2e4936c5ccf73f1cc34e8c459bb3 (patch) | |
tree | 13bd42ab1f95895e92598e4a820af071eb24cf14 /whosocket.hs | |
parent | af30d520e948542d112ede4cdeb1faf954b88045 (diff) |
unmap6mapped4 function in whosocket.
Diffstat (limited to 'whosocket.hs')
-rw-r--r-- | whosocket.hs | 8 |
1 files changed, 8 insertions, 0 deletions
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) | |||
23 | import Network.Socket | 23 | import Network.Socket |
24 | import System.Environment | 24 | import System.Environment |
25 | import Control.Arrow (first) | 25 | import Control.Arrow (first) |
26 | import System.Endian | ||
26 | 27 | ||
27 | usage = do | 28 | usage = do |
28 | putStrLn $ "whosocket numeric-address port" | 29 | putStrLn $ "whosocket numeric-address port" |
@@ -38,6 +39,8 @@ whosocket addr_str port_str = do | |||
38 | (Just addr_str) | 39 | (Just addr_str) |
39 | (Just port_str) | 40 | (Just port_str) |
40 | let addr = head $ map addrAddress info | 41 | let addr = head $ map addrAddress info |
42 | putStrLn $ "addr = "++show addr | ||
43 | putStrLn $ "unmap6mapped4 addr = "++show (unmap6mapped4 addr) | ||
41 | r <- getLocalPeerCred' addr | 44 | r <- getLocalPeerCred' addr |
42 | -- putStrLn $ "r{"++show addr++"} = " ++ show r | 45 | -- putStrLn $ "r{"++show addr++"} = " ++ show r |
43 | 46 | ||
@@ -152,3 +155,8 @@ identifyTTY tty_pids uid inode = do | |||
152 | 155 | ||
153 | let tty' = if take 3 tty=="tty" then Just (L.pack tty) else lookup tty dts | 156 | let tty' = if take 3 tty=="tty" then Just (L.pack tty) else lookup tty dts |
154 | return tty' | 157 | return tty' |
158 | |||
159 | |||
160 | -- PEER NAME: [::ffff:127.0.0.1]:34307 | ||
161 | unmap6mapped4 addr@(SockAddrInet6 port _ (0,0,0xFFFF,a) _) = SockAddrInet port (toBE32 a) | ||
162 | unmap6mapped4 addr = addr | ||