Skip to content

Commit

Permalink
Revert "fake proc name failed on LRX21R"
Browse files Browse the repository at this point in the history
This reverts commit 185e760.
  • Loading branch information
madeye committed Nov 26, 2014
1 parent 185e760 commit 7e8dad5
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 134 deletions.
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ rm -rf assets/armeabi-v7a
rm -rf assets/x86
mkdir -p assets/armeabi-v7a
mkdir -p assets/x86
for app in pdnsd redsocks ss-local ss-tunnel
for app in pdnsd redsocks ss-local ss-tunnel tun2socks
do
try mv libs/armeabi-v7a/$app assets/armeabi-v7a/
try mv libs/x86/$app assets/x86/
Expand Down
49 changes: 0 additions & 49 deletions src/main/java/com/github/shadowsocks/Tun2Socks.java

This file was deleted.

6 changes: 3 additions & 3 deletions src/main/jni/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ LOCAL_CFLAGS += -DBADVPN_THREADWORK_USE_PTHREAD -DBADVPN_LINUX -DBADVPN_BREACTOR
LOCAL_CFLAGS += -DBADVPN_USE_SELFPIPE -DBADVPN_USE_EPOLL
LOCAL_CFLAGS += -DBADVPN_LITTLE_ENDIAN -DBADVPN_THREAD_SAFE
LOCAL_CFLAGS += -DNDEBUG -DANDROID
LOCAL_CFLAGS += -DTUN2SOCKS_JNI
# LOCAL_CFLAGS += -DTUN2SOCKS_JNI

LOCAL_C_INCLUDES:= \
$(LOCAL_PATH)/badvpn/lwip/src/include/ipv4 \
Expand Down Expand Up @@ -288,9 +288,9 @@ LOCAL_MODULE := tun2socks

LOCAL_LDLIBS := -ldl -llog

LOCAL_SRC_FILES := $(addprefix badvpn/, $(TUN2SOCKS_SOURCES)) tun2socks-jni.cpp
LOCAL_SRC_FILES := $(addprefix badvpn/, $(TUN2SOCKS_SOURCES))

include $(BUILD_SHARED_LIBRARY)
include $(BUILD_EXECUTABLE)

# OpenSSL
openssl_subdirs := $(addprefix $(LOCAL_PATH)/openssl/,$(addsuffix /Android.mk, \
Expand Down
11 changes: 11 additions & 0 deletions src/main/jni/badvpn/tun2socks/tun2socks.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,13 @@ int main (int argc, char **argv)
goto fail0;
}

if (options.fake_proc) {
// Fake process name to cheat on Lollipop
strcpy(argv[0], "com.github.shadowsocks");
prctl(PR_SET_NAME, "com.github.shadowsocks");
}


// handle --help and --version
if (options.help) {
print_version();
Expand Down Expand Up @@ -661,6 +668,7 @@ void print_help (const char *name)
" [--loglevel <0-5/none/error/warning/notice/info/debug>]\n"
" [--channel-loglevel <channel-name> <0-5/none/error/warning/notice/info/debug>] ...\n"
#ifdef ANDROID
" [--fake-proc]\n"
" [--tunfd <fd>]\n"
" [--tunmtu <mtu>]\n"
" [--dnsgw <dns_gateway_address>]\n"
Expand Down Expand Up @@ -810,6 +818,9 @@ int parse_arguments (int argc, char *argv[])
i += 2;
}
#ifdef ANDROID
else if (!strcmp(arg, "--fake-proc")) {
options.fake_proc = 1;
}
else if (!strcmp(arg, "--tunfd")) {
if (1 >= argc - i) {
fprintf(stderr, "%s: requires an argument\n", arg);
Expand Down
80 changes: 0 additions & 80 deletions src/main/jni/tun2socks-jni.cpp

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,13 @@ class ShadowsocksVpnService extends VpnService with BaseService {
else
cmd += " --dnsgw %s:8153".format(PRIVATE_VLAN.format("1"))

if (Utils.isLollipopOrAbove) {
cmd += " --fake-proc";
}

if (BuildConfig.DEBUG) Log.d(TAG, cmd)

Tun2Socks.start(cmd.split(" "))
System.exec(cmd);
}

/** Called when the activity is first created. */
Expand Down

0 comments on commit 7e8dad5

Please sign in to comment.