fix a very old bug in redsocks
This commit is contained in:
@@ -780,7 +780,7 @@ static int redsocks_init_instance(redsocks_instance *instance)
|
||||
int on = 1;
|
||||
int fd = -1;
|
||||
|
||||
fd = socket(AF_INET, SOCK_STREAM, 0);
|
||||
fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
if (fd == -1) {
|
||||
log_errno(LOG_ERR, "socket");
|
||||
goto fail;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2013 Jorrit "Chainfire" Jongma
|
||||
* Copyright (C) 2012-2014 Jorrit "Chainfire" Jongma
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2013 Jorrit "Chainfire" Jongma
|
||||
* Copyright (C) 2012-2014 Jorrit "Chainfire" Jongma
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,6 +18,7 @@ package eu.chainfire.libsuperuser;
|
||||
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
|
||||
import com.github.shadowsocks.BuildConfig;
|
||||
|
||||
/**
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2013 Jorrit "Chainfire" Jongma
|
||||
* Copyright (C) 2012-2014 Jorrit "Chainfire" Jongma
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2013 Jorrit "Chainfire" Jongma
|
||||
* Copyright (C) 2012-2014 Jorrit "Chainfire" Jongma
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2013 Jorrit "Chainfire" Jongma
|
||||
* Copyright (C) 2012-2014 Jorrit "Chainfire" Jongma
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -341,6 +341,7 @@ class Shadowsocks
|
||||
ab.clear()
|
||||
ab.append("kill -9 `cat /data/data/com.github.shadowsocks/redsocks.pid`")
|
||||
ab.append("rm /data/data/com.github.shadowsocks/redsocks.conf")
|
||||
ab.append("rm /data/data/com.github.shadowsocks/redsocks.pid")
|
||||
ab.append(Utils.getIptables + " -t nat -F OUTPUT")
|
||||
|
||||
Console.runRootCommand(ab.toArray)
|
||||
|
||||
@@ -137,18 +137,27 @@ class ShadowsocksNatService extends Service with BaseService {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, cmd.mkString(" "))
|
||||
Core.sstunnel(cmd.toArray)
|
||||
} else {
|
||||
val conf = {
|
||||
ConfigUtils.PDNSD.format("127.0.0.1")
|
||||
}
|
||||
val cmdBuf = new ArrayBuffer[String]
|
||||
cmdBuf += ("ss-tunnel"
|
||||
, "-b", "127.0.0.1"
|
||||
, "-l", "8163"
|
||||
, "-L", "8.8.8.8:53"
|
||||
, "-s", config.proxy
|
||||
, "-p", config.remotePort.toString
|
||||
, "-k", config.sitekey
|
||||
, "-m", config.encMethod
|
||||
, "-f", Path.BASE + "ss-tunnel.pid")
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, cmdBuf.mkString(" "))
|
||||
Core.sstunnel(cmdBuf.toArray)
|
||||
|
||||
val conf = ConfigUtils
|
||||
.PDNSD_BYPASS.format("127.0.0.1", getString(R.string.exclude), 8163)
|
||||
ConfigUtils.printToFile(new File(Path.BASE + "pdnsd.conf"))(p => {
|
||||
p.println(conf)
|
||||
})
|
||||
|
||||
val args = "pdnsd -c " + Path.BASE + "pdnsd.conf"
|
||||
val cmd = Path.BASE + args
|
||||
|
||||
val cmd = Path.BASE + "pdnsd -c " + Path.BASE + "pdnsd.conf"
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, cmd)
|
||||
Console.runRootCommand(cmd)
|
||||
Core.pdnsd(cmd.split(" "))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,7 +181,7 @@ class ShadowsocksNatService extends Service with BaseService {
|
||||
p.println(conf)
|
||||
})
|
||||
val cmd = Path.BASE + args
|
||||
Console.runRootCommand(cmd)
|
||||
Console.runCommand(cmd)
|
||||
}
|
||||
|
||||
/** Called when the activity is first created. */
|
||||
|
||||
Reference in New Issue
Block a user