Skip to content

Commit

Permalink
Revert "bypass system dns"
Browse files Browse the repository at this point in the history
This reverts commit 1a09f8d.
  • Loading branch information
madeye committed Apr 10, 2014
1 parent 1a09f8d commit 06934b3
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 18 deletions.
1 change: 0 additions & 1 deletion src/main/java/com/github/shadowsocks/System.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,4 @@ public class System {

public static native void exec(String cmd);
public static native String getABI();
public static native String getDNS1();
}
11 changes: 1 addition & 10 deletions src/main/jni/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,11 @@
#include <stdlib.h>
#include <unistd.h>
#include <cpu-features.h>
#include <sys/system_properties.h>

#define LOGI(...) do { __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__); } while(0)
#define LOGW(...) do { __android_log_print(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__); } while(0)
#define LOGE(...) do { __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__); } while(0)

jstring Java_com_github_shadowsocks_system_getdns1(JNIEnv *env, jobject thiz) {
char dns1[PROP_VALUE_MAX];
__system_property_get("net.dns1", dns1);
return env->NewStringUTF(dns1);
}

jstring Java_com_github_shadowsocks_system_getabi(JNIEnv *env, jobject thiz) {
AndroidCpuFamily family = android_getCpuFamily();
uint64_t features = android_getCpuFeatures();
Expand Down Expand Up @@ -52,9 +45,7 @@ static JNINativeMethod method_table[] = {
{ "exec", "(Ljava/lang/String;)V",
(void*) Java_com_github_shadowsocks_system_exec },
{ "getABI", "()Ljava/lang/String;",
(void*) Java_com_github_shadowsocks_system_getabi },
{ "getDNS1", "()Ljava/lang/String;",
(void*) Java_com_github_shadowsocks_system_getdns1 }
(void*) Java_com_github_shadowsocks_system_getabi }
};

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class ShadowsocksNatService extends Service with BaseService {
} else {
val conf = {
if (config.isGFWList)
ConfigUtils.PDNSD_BYPASS.format("127.0.0.1", System.getDNS1, getString(R.string.exclude))
ConfigUtils.PDNSD_BYPASS.format("127.0.0.1", getString(R.string.exclude))
else
ConfigUtils.PDNSD.format("127.0.0.1")
}
Expand Down Expand Up @@ -313,8 +313,8 @@ class ShadowsocksNatService extends Service with BaseService {
init_sb.append(cmd_bypass.replace("0.0.0.0", "127.0.0.1"))
if (config.isGFWList) {
// Bypass DNS in China
init_sb.append(cmd_bypass.replace("-p tcp -d 0.0.0.0", "-d " + System.getDNS1))
init_sb.append(cmd_bypass.replace("-p tcp -d 0.0.0.0", "-d 114.114.114.114"))
init_sb.append(cmd_bypass.replace("-p tcp -d 0.0.0.0", "-d 114.114.115.115"))
}
if (hasRedirectSupport) {
init_sb
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {

def isByass(net: SubnetUtils): Boolean = {
val info = net.getInfo
info.isInRange(config.proxy) || info.isInRange("114.114.114.114") || info.isInRange(System.getDNS1)
info.isInRange(config.proxy) || info.isInRange("114.114.114.114") || info.isInRange("114.114.115.115")
}

def startShadowsocksDaemon() {
Expand All @@ -92,7 +92,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
def startDnsDaemon() {
val conf = {
if (config.isGFWList)
ConfigUtils.PDNSD_BYPASS.format("0.0.0.0", System.getDNS1, getString(R.string.exclude))
ConfigUtils.PDNSD_BYPASS.format("0.0.0.0", getString(R.string.exclude))
else
ConfigUtils.PDNSD.format("0.0.0.0")
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/scala/com/github/shadowsocks/utils/ConfigUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@ object ConfigUtils {
|
|server {
| label = "china-servers";
| ip = %s, 114.114.114.114;
| ip = 114.114.114.114, 114.114.115.115;
| uptest = none;
| preset = on;
| include = %s;
| policy = excluded;
| timeout = 2;
| timeout = 3;
|}
|
|server {
Expand Down Expand Up @@ -197,4 +197,4 @@ object ConfigUtils {
new Config(isGlobalProxy, isGFWList, isBypassApps, isTrafficStat, isUdpDns, profileName, proxy,
sitekey, encMethod, proxiedAppString, remotePort, localPort)
}
}
}

0 comments on commit 06934b3

Please sign in to comment.