Skip to content

Commit 7e8dad5

Browse files
committed
Revert "fake proc name failed on LRX21R"
This reverts commit 185e760.
1 parent 185e760 commit 7e8dad5

6 files changed

Lines changed: 20 additions & 134 deletions

File tree

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ rm -rf assets/armeabi-v7a
1515
rm -rf assets/x86
1616
mkdir -p assets/armeabi-v7a
1717
mkdir -p assets/x86
18-
for app in pdnsd redsocks ss-local ss-tunnel
18+
for app in pdnsd redsocks ss-local ss-tunnel tun2socks
1919
do
2020
try mv libs/armeabi-v7a/$app assets/armeabi-v7a/
2121
try mv libs/x86/$app assets/x86/

src/main/java/com/github/shadowsocks/Tun2Socks.java

Lines changed: 0 additions & 49 deletions
This file was deleted.

src/main/jni/Android.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ LOCAL_CFLAGS += -DBADVPN_THREADWORK_USE_PTHREAD -DBADVPN_LINUX -DBADVPN_BREACTOR
214214
LOCAL_CFLAGS += -DBADVPN_USE_SELFPIPE -DBADVPN_USE_EPOLL
215215
LOCAL_CFLAGS += -DBADVPN_LITTLE_ENDIAN -DBADVPN_THREAD_SAFE
216216
LOCAL_CFLAGS += -DNDEBUG -DANDROID
217-
LOCAL_CFLAGS += -DTUN2SOCKS_JNI
217+
# LOCAL_CFLAGS += -DTUN2SOCKS_JNI
218218

219219
LOCAL_C_INCLUDES:= \
220220
$(LOCAL_PATH)/badvpn/lwip/src/include/ipv4 \
@@ -288,9 +288,9 @@ LOCAL_MODULE := tun2socks
288288

289289
LOCAL_LDLIBS := -ldl -llog
290290

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

293-
include $(BUILD_SHARED_LIBRARY)
293+
include $(BUILD_EXECUTABLE)
294294

295295
# OpenSSL
296296
openssl_subdirs := $(addprefix $(LOCAL_PATH)/openssl/,$(addsuffix /Android.mk, \

src/main/jni/badvpn/tun2socks/tun2socks.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,13 @@ int main (int argc, char **argv)
402402
goto fail0;
403403
}
404404

405+
if (options.fake_proc) {
406+
// Fake process name to cheat on Lollipop
407+
strcpy(argv[0], "com.github.shadowsocks");
408+
prctl(PR_SET_NAME, "com.github.shadowsocks");
409+
}
410+
411+
405412
// handle --help and --version
406413
if (options.help) {
407414
print_version();
@@ -661,6 +668,7 @@ void print_help (const char *name)
661668
" [--loglevel <0-5/none/error/warning/notice/info/debug>]\n"
662669
" [--channel-loglevel <channel-name> <0-5/none/error/warning/notice/info/debug>] ...\n"
663670
#ifdef ANDROID
671+
" [--fake-proc]\n"
664672
" [--tunfd <fd>]\n"
665673
" [--tunmtu <mtu>]\n"
666674
" [--dnsgw <dns_gateway_address>]\n"
@@ -810,6 +818,9 @@ int parse_arguments (int argc, char *argv[])
810818
i += 2;
811819
}
812820
#ifdef ANDROID
821+
else if (!strcmp(arg, "--fake-proc")) {
822+
options.fake_proc = 1;
823+
}
813824
else if (!strcmp(arg, "--tunfd")) {
814825
if (1 >= argc - i) {
815826
fprintf(stderr, "%s: requires an argument\n", arg);

src/main/jni/tun2socks-jni.cpp

Lines changed: 0 additions & 80 deletions
This file was deleted.

src/main/scala/com/github/shadowsocks/ShadowsocksVpnService.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,13 @@ class ShadowsocksVpnService extends VpnService with BaseService {
320320
else
321321
cmd += " --dnsgw %s:8153".format(PRIVATE_VLAN.format("1"))
322322

323+
if (Utils.isLollipopOrAbove) {
324+
cmd += " --fake-proc";
325+
}
326+
323327
if (BuildConfig.DEBUG) Log.d(TAG, cmd)
324328

325-
Tun2Socks.start(cmd.split(" "))
329+
System.exec(cmd);
326330
}
327331

328332
/** Called when the activity is first created. */

0 commit comments

Comments
 (0)