Commit 3b6eff6d authored by Max Lv's avatar Max Lv

Fix #905

parent 528fea13
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" package="com.github.shadowsocks" xmlns:tools="http://schemas.android.com/tools" package="com.github.shadowsocks"
android:versionCode="160" android:versionCode="161"
android:versionName="3.2.0"> android:versionName="3.2.1">
<uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
......
...@@ -116,6 +116,5 @@ ...@@ -116,6 +116,5 @@
<item>196.0.0.0/6</item> <item>196.0.0.0/6</item>
<item>200.0.0.0/5</item> <item>200.0.0.0/5</item>
<item>208.0.0.0/4</item> <item>208.0.0.0/4</item>
<item>224.0.0.0/3</item>
</string-array> </string-array>
</resources> </resources>
...@@ -178,18 +178,22 @@ class ShadowsocksNatService extends BaseService { ...@@ -178,18 +178,22 @@ class ShadowsocksNatService extends BaseService {
def startDnsDaemon() { def startDnsDaemon() {
val reject = if (profile.ipv6) "224.0.0.0/3" else "224.0.0.0/3, ::/0"
val conf = profile.route match { val conf = profile.route match {
case Route.BYPASS_CHN | Route.BYPASS_LAN_CHN | Route.GFWLIST => { case Route.BYPASS_CHN | Route.BYPASS_LAN_CHN | Route.GFWLIST => {
ConfigUtils.PDNSD_DIRECT.formatLocal(Locale.ENGLISH, getApplicationInfo.dataDir, ConfigUtils.PDNSD_DIRECT.formatLocal(Locale.ENGLISH, getApplicationInfo.dataDir,
"127.0.0.1", profile.localPort + 53, "1.2.4.8, 114.114.114.114", "", profile.localPort + 63, "") "127.0.0.1", profile.localPort + 53, "1.2.4.8, 114.114.114.114",
reject, profile.localPort + 63, reject)
} }
case Route.CHINALIST => { case Route.CHINALIST => {
ConfigUtils.PDNSD_DIRECT.formatLocal(Locale.ENGLISH, getApplicationInfo.dataDir, ConfigUtils.PDNSD_DIRECT.formatLocal(Locale.ENGLISH, getApplicationInfo.dataDir,
"127.0.0.1", profile.localPort + 53, "8.8.8.8, 208.67.222.222", "", profile.localPort + 63, "") "127.0.0.1", profile.localPort + 53, "8.8.8.8, 208.67.222.222",
reject, profile.localPort + 63, reject)
} }
case _ => { case _ => {
ConfigUtils.PDNSD_LOCAL.formatLocal(Locale.ENGLISH, getApplicationInfo.dataDir, ConfigUtils.PDNSD_LOCAL.formatLocal(Locale.ENGLISH, getApplicationInfo.dataDir,
"127.0.0.1", profile.localPort + 53, profile.localPort + 63, "") "127.0.0.1", profile.localPort + 53, profile.localPort + 63, reject)
} }
} }
......
...@@ -296,19 +296,21 @@ class ShadowsocksVpnService extends VpnService with BaseService { ...@@ -296,19 +296,21 @@ class ShadowsocksVpnService extends VpnService with BaseService {
} }
def startDnsDaemon() { def startDnsDaemon() {
val ipv6 = if (profile.ipv6) "" else "reject = ::/0;" val reject = if (profile.ipv6) "224.0.0.0/3" else "224.0.0.0/3, ::/0"
val conf = profile.route match { val conf = profile.route match {
case Route.BYPASS_CHN | Route.BYPASS_LAN_CHN | Route.GFWLIST => { case Route.BYPASS_CHN | Route.BYPASS_LAN_CHN | Route.GFWLIST => {
ConfigUtils.PDNSD_DIRECT.formatLocal(Locale.ENGLISH, getApplicationInfo.dataDir, ConfigUtils.PDNSD_DIRECT.formatLocal(Locale.ENGLISH, getApplicationInfo.dataDir,
"0.0.0.0", profile.localPort + 53, "1.2.4.8, 114.114.114.114", ipv6, profile.localPort + 63, ipv6) "0.0.0.0", profile.localPort + 53, "1.2.4.8, 114.114.114.114",
reject, profile.localPort + 63, reject)
} }
case Route.CHINALIST => { case Route.CHINALIST => {
ConfigUtils.PDNSD_DIRECT.formatLocal(Locale.ENGLISH, getApplicationInfo.dataDir, ConfigUtils.PDNSD_DIRECT.formatLocal(Locale.ENGLISH, getApplicationInfo.dataDir,
"0.0.0.0", profile.localPort + 53, "8.8.8.8, 208.67.222.222", ipv6, profile.localPort + 63, ipv6) "0.0.0.0", profile.localPort + 53, "8.8.8.8, 208.67.222.222",
reject, profile.localPort + 63, reject)
} }
case _ => { case _ => {
ConfigUtils.PDNSD_LOCAL.formatLocal(Locale.ENGLISH, getApplicationInfo.dataDir, ConfigUtils.PDNSD_LOCAL.formatLocal(Locale.ENGLISH, getApplicationInfo.dataDir,
"0.0.0.0", profile.localPort + 53, profile.localPort + 63, ipv6) "0.0.0.0", profile.localPort + 53, profile.localPort + 63, reject)
} }
} }
Utils.printToFile(new File(getApplicationInfo.dataDir + "/pdnsd-vpn.conf"))(p => { Utils.printToFile(new File(getApplicationInfo.dataDir + "/pdnsd-vpn.conf"))(p => {
......
...@@ -83,7 +83,7 @@ object ConfigUtils { ...@@ -83,7 +83,7 @@ object ConfigUtils {
| label = "local"; | label = "local";
| ip = 127.0.0.1; | ip = 127.0.0.1;
| port = %d; | port = %d;
| %s | reject = %s;
| reject_policy = negate; | reject_policy = negate;
| reject_recursively = on; | reject_recursively = on;
|} |}
...@@ -117,8 +117,8 @@ object ConfigUtils { ...@@ -117,8 +117,8 @@ object ConfigUtils {
| ip = %s; | ip = %s;
| timeout = 3; | timeout = 3;
| query_method = udp_only; | query_method = udp_only;
| %s | reject = %s;
| reject_policy = negate; | reject_policy = fail;
| reject_recursively = on; | reject_recursively = on;
|} |}
| |
...@@ -127,7 +127,7 @@ object ConfigUtils { ...@@ -127,7 +127,7 @@ object ConfigUtils {
| ip = 127.0.0.1; | ip = 127.0.0.1;
| query_method = tcp_only; | query_method = tcp_only;
| port = %d; | port = %d;
| %s | reject = %s;
| reject_policy = negate; | reject_policy = negate;
| reject_recursively = on; | reject_recursively = on;
|} |}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment