mirror of
https://github.com/urbit/shrub.git
synced 2024-12-30 07:35:19 +03:00
natpmp: also detect 172.16.0/0/12 ips as private.
This commit is contained in:
parent
1401d7bc5c
commit
88428961dd
@ -445,8 +445,8 @@ host = do
|
|||||||
) <|>
|
) <|>
|
||||||
( flag' NatWhenPrivateNetwork
|
( flag' NatWhenPrivateNetwork
|
||||||
$ long "port-forwarding-when-internal"
|
$ long "port-forwarding-when-internal"
|
||||||
<> help ("Try asking the router to forward when ip is 192.168.0.0/24 or" <>
|
<> help ("Try asking the router to forward when ip is 192.168.0.0/16, " <>
|
||||||
"10.0.0.0/8 (default).")
|
"172.16.0.0/12 or 10.0.0.0/8 (default).")
|
||||||
<> hidden
|
<> hidden
|
||||||
) <|>
|
) <|>
|
||||||
(pure $ NatWhenPrivateNetwork)
|
(pure $ NatWhenPrivateNetwork)
|
||||||
|
@ -104,6 +104,8 @@ portThread q stderr = do
|
|||||||
Left err -> do
|
Left err -> do
|
||||||
likelyIPAddress >>= \case
|
likelyIPAddress >>= \case
|
||||||
Just ip@(192, 168, _, _) -> warnBehindRouterAndErr ip err
|
Just ip@(192, 168, _, _) -> warnBehindRouterAndErr ip err
|
||||||
|
Just ip@(172, x, _, _)
|
||||||
|
| (x >= 16 && x <= 31) -> warnBehindRouterAndErr ip err
|
||||||
Just ip@(10, _, _, _) -> warnBehindRouterAndErr ip err
|
Just ip@(10, _, _, _) -> warnBehindRouterAndErr ip err
|
||||||
_ -> assumeOnPublicInternet
|
_ -> assumeOnPublicInternet
|
||||||
Right pmp -> foundRouter pmp
|
Right pmp -> foundRouter pmp
|
||||||
@ -245,6 +247,8 @@ likelyBehindRouter :: MonadIO m => m Bool
|
|||||||
likelyBehindRouter = do
|
likelyBehindRouter = do
|
||||||
likelyIPAddress >>= \case
|
likelyIPAddress >>= \case
|
||||||
Just ip@(192, 168, _, _) -> pure True
|
Just ip@(192, 168, _, _) -> pure True
|
||||||
|
Just ip@(172, x, _, _)
|
||||||
|
| (x >= 16 && x <= 31) -> pure True
|
||||||
Just ip@(10, _, _, _) -> pure True
|
Just ip@(10, _, _, _) -> pure True
|
||||||
_ -> pure False
|
_ -> pure False
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user