Please answer these questions before submitting your issue. Thanks!
3.0.0
linux 2.6.36 asuswrt merlin
compile and run
using this command line not work
admin@NETGEAR-BD26:/jffs# ss-tunnel -b 0.0.0.0 -s vps_ip_not_show -p 5071 -c /koolshare/ss/ss.json -l 7913 -L 8.8.8.8:53 -u
Segmentation fault
this is fine
ss-tunnel -b 0.0.0.0 -s vps_ip_not_show -p 5071 -m chacha20 -k mjy211 -l 7913 -L 8.8.8.8:53 -u
2017-02-03 23:10:33 INFO: initializing ciphers... chacha20
2017-02-03 23:10:33 INFO: UDP relay enabled
it seems the -c option can only use it alone in ss-tunnel,ss-local and ss-redir is ok
What's the config file in detail?
{
"server":"vps_ip_not_show",
"server_port":5071,
"local_port":3333,
"password":"mjy211",
"timeout":600,
"method":"chacha20"
}
Could you please have a try with binaries I build: https://github.com/xc2/shadowsocks-libev-tomato/releases/tag/3.0.0-1
Could you try the latest commit? I cannot reproduce it locally.
@xc2 It looks very cool!
@xc2 You may add a link to your repo to our README with a pull request.
@xc2 your build works the same as mine,
but still Segmentation fault in my scenario
@madeye the latest code still have this problem, maybe I should try toolchain with higher version of gcc
@sadoneli What's the last commit without this issue? Or could you build a debug version and run gdb our your router?
@madeye Thank you. I will create a pr when I'm prepared.
In 2.6.1,it works fine,on the merlin router , I only need to generate one ss.json file on my router, and ss-locoal, ss-redir, ss-tunnel can use it by adding additional args, in the case if ss-redir ,I can use it directly by ss-redir -b 0.0.0.0 -c $CONFIG_FILE $ARG_OTA -u -f /var/run/shadowsocks.pid ss-local -b 0.0.0.0 -l 23456 -c $CONFIG_FILE $ARG_OTA -u and for ss-tunnel ss-tunnel -b 0.0.0.0 -s 127.0.0.1 -p 5071 -m chacha20 -k mjy211 -l 7913 -L 8.8.8.8:53 -u because I use KCP, so I can modifiy the server with additional arg -s 127.0.0.1
I didn't compile version between 2.6.1 and 3.0.0, so I don't known which version this issue begain to appear.
in 3.0.0 lateset code by this morning, ss-redir and ss-local works fine by command above ,but ss-tunnel still problem
ss-local:https://github.com/koolshare/koolshare.github.io/blob/acelan_softcenter_ui/shadowsocks/shadowsocks/ss/start.sh#L166
@sadoneli Without -u, would this issue happen?
admin@NETGEAR-BD26:/jffs# ss-tunnel -b 0.0.0.0 -s 47.90.. -p 5072 -c /koolshare/ss/ss.json -l 1055 -L 8.8.8.8:53
Segmentation fault
admin@NETGEAR-BD26:/jffs# ss-tunnel -b 0.0.0.0 -s 47.90.. -p 5072 -c /koolshare/ss/ss.json -l 1055 -L 8.8.8.8:53 -u
Segmentation fault
admin@NETGEAR-BD26:/jffs# ss-tunnel -b 0.0.0.0 -s 47.90.. -p 5072 -c /koolshare/ss/ss.json -l 1055 -L 8.8.8.8:53 -U
Segmentation fault
Could you try these commands?
ss-tunnel -b 0.0.0.0 -s 47.90.***.*** -p 5072 -c /koolshare/ss/ss.json -l 1055 -L 8.8.8.8:53 -m aes-128-gcm
ss-tunnel -b 0.0.0.0 -s 47.90.***.*** -p 5072 -c /koolshare/ss/ss.json -l 1055 -L 8.8.8.8:53 -m aes-128-ctr
ss-tunnel -s 47.90.***.*** -p 5072 -c /koolshare/ss/ss.json -l 1055 -L 8.8.8.8:53 -m aes-128-ctr
Also, could you try 6892951?
admin@NETGEAR-BD26:/jffs/.koolshare# ss-tunnel -b 0.0.0.0 -s 47.90.1.1 -p 5072 -c /koolshare/ss/ss.json -l 1057 -L 8.8.8.8:53 -m aes-128-gcm
Segmentation fault
admin@NETGEAR-BD26:/jffs/.koolshare# ss-tunnel -b 0.0.0.0 -s 47.90.1.1 -p 5072 -c /koolshare/ss/ss.json -l 1055 -L 8.8.8.8:53 -m aes-128-ctr
Segmentation fault
admin@NETGEAR-BD26:/jffs/.koolshare# ss-tunnel -s 47.90.1.1 -p 5072 -c /koolshare/ss/ss.json -l 1055 -L 8.8.8.8:53 -m aes-128-ctr
Segmentation fault
all https://github.com/shadowsocks/shadowsocks-libev/commit/68929513d31af4e90a3fb7eadc4938535b872519
What about this?
ss-tunnel -s 47.90.1.1 -p 5072 -c /koolshare/ss/ss.json -l 1055
admin@NETGEAR-BD26:/jffs# ss-tunnel -s 47.90.1.1 -p 5072 -c /koolshare/ss/ss.json -l 1055
shadowsocks-libev 3.0.0
maintained by Max Lv <[email protected]> and Linus Yang <[email protected]>
usage:
ss-tunnel
-s <server_host> Host name or IP address of your remote server.
-p <server_port> Port number of your remote server.
-l <local_port> Port number of your local server.
-k <password> Password of your remote server.
-m <encrypt_method> Encrypt method: rc4-md5,
aes-128-gcm, aes-192-gcm, aes-256-gcm,
aes-128-cfb, aes-192-cfb, aes-256-cfb,
aes-128-ctr, aes-192-ctr, aes-256-ctr,
camellia-128-cfb, camellia-192-cfb,
camellia-256-cfb, bf-cfb,
chacha20-poly1305, chacha20-ietf-poly1305
salsa20, chacha20 and chacha20-ietf.
The default cipher is rc4-md5.
[-a <user>] Run as another user.
[-f <pid_file>] The file path to store pid.
[-t <timeout>] Socket timeout in seconds.
[-c <config_file>] The path to config file.
[-n <number>] Max number of open files.
[-i <interface>] Network interface to bind.
[-b <local_address>] Local address to bind.
[-u] Enable UDP relay.
[-U] Enable UDP relay and disable TCP relay.
[-L <addr>:<port>] Destination server address and port
for local port forwarding.
[--reuse-port] Enable port reuse.
[--mtu <MTU>] MTU of your network interface.
[--mptcp] Enable Multipath TCP on MPTCP Kernel.
[--plugin <name>] Enable SIP003 plugin. (Experimental)
[--plugin-opts <options>] Set SIP003 plugin options. (Experimental)
[-v] Verbose mode.
[-h, --help] Print this message.
really odd
Then try this:
ss-tunnel -s 47.90.1.1 -p 5072 -c /koolshare/ss/ss.json -l 1055 -L 8.8.8.8
Also, could you add some printf() in the main() in tunnel.c? It will help to detect which part of code cause the issue.
admin@NETGEAR-BD26:/tmp/home/root# ss-tunnel -s 47.90.1.1 -p 5072 -c /koolshare/ss/ss.json -l 1055 -L 8.8.8.8
2017-02-04 18:07:48 ERROR: tunnel port is not defined
I am not familiar with c, but I try my best to test it
add
when defined port 53
admin@NETGEAR-BD26:/tmp/home/root# ss-tunnel -s 47.90.1.1 -p 5072 -c /koolshare/ss/ss.json -l 1055 -L 8.8.8.8:53
Segmentation fault
It seems that the crash happens before LOGI("initializing ciphers... %s", method);, as no output of this line before segmentation fault.
But according to your new tests, it may happen after that line. So, we'd better add enough printf("Line number: %d", __LINE__); to locate the problem.
I have add some printf in the tunnel.c
and found this place
printf("a=%d\n",7);
// parse tunnel addr
parse_addr(tunnel_addr_str, &tunnel_addr);
if (tunnel_addr.port == NULL) {
FATAL("tunnel port is not defined");
}
printf("a=%d\n",8);
this is the log
admin@NETGEAR-BD26:/jffs# ./ss-tunnel -s 47.90.1.1 -p 5072 -c /koolshare/ss/ss.json -l 1055 -L 8.8.8.8:53
a=1
a=2
a=3
a=4
a=5
a=6
a=7
Segmentation fault
the program can no proceed to a=8
Cool! Let me look into that function.
to go futher more
printf("a=%d\n",7);
// parse tunnel addr
parse_addr(tunnel_addr_str, &tunnel_addr);
printf("a=%d\n",8);
if (tunnel_addr.port == NULL) {
FATAL("tunnel port is not defined");
}
printf("a=%d\n",9);
admin@NETGEAR-BD26:/jffs# ./ss-tunnel -s 47.90.1.1 -p 5072 -c /koolshare/ss/ss.json -l 1055 -L 8.8.8.8:53
a=1
a=2
a=3
a=4
a=5
a=6
a=7
Segmentation fault
It seem iusse is on this line https://github.com/shadowsocks/shadowsocks-libev/blob/master/src/tunnel.c#L984
Please try dde1bf7.
nice! it works!
admin@NETGEAR-BD26:/jffs# ss-tunnel -b 0.0.0.0 -s 47.90.1.1 -p 5072 -c /koolshare/ss/ss.json -l 1055 -L 8.8.8.8:53 -u
2017-02-04 18:40:05 INFO: initializing ciphers... chacha20-ietf-poly1305
2017-02-04 18:40:08 INFO: UDP relay enabled
2017-02-04 18:40:08 INFO: listening at 0.0.0.0:1055
2017-02-04 18:40:08 INFO: running from root user
Cool! Thanks for the debugging effort!
same word to you~
Most helpful comment
Please try dde1bf7.