mirror of
https://github.com/urbit/shrub.git
synced 2024-12-19 00:13:12 +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
|
||||
$ long "port-forwarding-when-internal"
|
||||
<> help ("Try asking the router to forward when ip is 192.168.0.0/24 or" <>
|
||||
"10.0.0.0/8 (default).")
|
||||
<> help ("Try asking the router to forward when ip is 192.168.0.0/16, " <>
|
||||
"172.16.0.0/12 or 10.0.0.0/8 (default).")
|
||||
<> hidden
|
||||
) <|>
|
||||
(pure $ NatWhenPrivateNetwork)
|
||||
|
@ -104,6 +104,8 @@ portThread q stderr = do
|
||||
Left err -> do
|
||||
likelyIPAddress >>= \case
|
||||
Just ip@(192, 168, _, _) -> warnBehindRouterAndErr ip err
|
||||
Just ip@(172, x, _, _)
|
||||
| (x >= 16 && x <= 31) -> warnBehindRouterAndErr ip err
|
||||
Just ip@(10, _, _, _) -> warnBehindRouterAndErr ip err
|
||||
_ -> assumeOnPublicInternet
|
||||
Right pmp -> foundRouter pmp
|
||||
@ -245,6 +247,8 @@ likelyBehindRouter :: MonadIO m => m Bool
|
||||
likelyBehindRouter = do
|
||||
likelyIPAddress >>= \case
|
||||
Just ip@(192, 168, _, _) -> pure True
|
||||
Just ip@(172, x, _, _)
|
||||
| (x >= 16 && x <= 31) -> pure True
|
||||
Just ip@(10, _, _, _) -> pure True
|
||||
_ -> pure False
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user