Commit Graph
1233 Commits
Author SHA1 Message Date
DDoSolitary 05e70d4317 fix c-ares link dep 2022-06-26 06:22:56 +08:00
Maxim Galaganov d61d09aa0c Detect kernel support for MPTCP at runtime 2022-06-23 10:38:32 +08:00
zonyitoo 01dd7df1da Redir UDP send back sockets should always be IPv6
ref shadowsocks/shadowsocks-rust#855

When receiving UDP packets from remote servers, Redir will have to
create transparent sockets to bind() on those target addresses and then
relay data back to the local client. Target addresses may be IPv4 or
IPv6 addresses, so we may have to create that transprent sockets based
on the target addresses' family.

The most simpliest and easiest way is to always create IPv6 sockets and
converts IPv4 binding addresses and peer addresses to IPv4-mapped-IPv6.
2022-06-04 16:48:45 +08:00
Tristan Schmelcher 1630764b02 Fix --mptcp on kernels with mainlined MPTCP.
Mainlined MPTCP on Linux 5.6+ is enabled with IPPROTO_MPTCP rather than setsockopt.
2022-05-23 09:11:50 +08:00
Fabrice Fontaine 0c23224e92 fix maybe-uninitialized errors
Set {listen,server}_sock to -1 when needed as already done in
src/manager.c by commit ecf1fcc845 to
avoid the following build failure:

local.c: In function 'create_and_bind':
local.c:218:12: error: 'listen_sock' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  218 |     return listen_sock;
      |            ^~~~~~~~~~~

Fixes:
 - http://autobuild.buildroot.org/results/27471a878ff52a972ac087d534e44fb0c50808f6

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2022-04-11 08:28:07 +08:00
Max Lv 46382c23fa Disable fragmentation for all the outgoing UDP packets 2022-02-15 11:48:43 +08:00
Max Lv b911755900 Remove the fragmentation check for the first AEAD chunk 2021-08-19 08:38:02 +08:00
Gilles Depeyrot abcf85e983 fix order of tests to avoid strstr on NULL value 2021-07-16 09:36:54 +08:00
Gilles Depeyrot 0a7d178134 properly terminate string which recvfrom does not do 2021-07-16 09:36:26 +08:00
Gilles Depeyrot 49ead5e570 apply memory leak fix for create_and_bind to create_server_socket 2021-07-16 09:36:07 +08:00
Gilles Depeyrot a19328a977 close socket to avoid memory leak when error occurs 2021-07-16 09:35:39 +08:00
Gilles Depeyrot 8bcffa54b5 fix check for return value of open when redirecting to null device 2021-07-16 09:34:57 +08:00
Aven 4bbbe212eb Add support of nftables firewall
The change is to support the 'fail2ban' feature. Instead of
blocking IPs by server itself, server just add malicious IPs
to specified sets of nftables. So admin can configure rules
to deal with those IPs.

Notes: cap_net_admin capability is required.

Example configuration:
 # nft add table ip fail2ban
 # nft add chain ip fail2ban input { type filter hook input priority 0 \; }
 # nft add set ip fail2ban badips { type ipv4_addr \; flags dynamic, timeout \; timeout 1h \; }
 # nft add rule ip fail2ban input ip saddr @badips drop
 # ss-server -c config.json --nftables-sets badips
2021-07-01 12:05:39 +08:00
lixingcong ed23402637 Fix memory leak in manager 2021-05-12 16:13:10 +08:00
lixingcong e04b73d1b6 Fix memory leak 2021-03-17 09:54:43 +08:00
Fabrice Fontaine 7e5922aa44 configure.ac: use pkg-config to find netfilter_conntrack
Use pkg-config to retrieve the dependencies of netfilter_conntrack
and avoid the following build failure when building statically:

configure:13096: /data/buildroot-test/instance-1/output-1/host/bin/x86_64-linux-gcc -o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -Os   -static -I/data/buildroot-test/instance-1/output-1/host/x86_64-buildroot-linux-uclibc/sysroot/usr/include -DPCRE_STATIC -pthread -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -static -L/data/buildroot-test/instance-1/output-1/host/x86_64-buildroot-linux-uclibc/sysroot/usr/lib conftest.c -lnetfilter_conntrack -lnfnetlink -lev  -lcares -lsodium -lmbedcrypto -lpcre  >&5
/data/buildroot-test/instance-1/output-1/host/opt/ext-toolchain/bin/../lib/gcc/x86_64-buildroot-linux-uclibc/8.3.0/../../../../x86_64-buildroot-linux-uclibc/bin/ld: /data/buildroot-test/instance-1/output-1/host/x86_64-buildroot-linux-uclibc/sysroot/usr/lib/libnetfilter_conntrack.a(api.o): in function `nfct_fill_hdr.constprop.4':
api.c:(.text+0x3f): undefined reference to `mnl_nlmsg_put_header'

Fixes:
 - http://autobuild.buildroot.org/results/6cad497a7ab941a0ee3fd7007defc81e30cdcbe0

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2021-03-11 12:20:18 +08:00
Jared Pyzynski 13f472077d Fix "ERROR: [udp] remote_recv_bind: Address already in use" when multiple reuse_port-enabled ss-redir instances are listening on the same address 2021-01-30 07:27:00 +08:00
Roger Shimizu cfe0c2cba0 Fix ftbfs for Hurd since there is no IPV6_TCLASS defined 2021-01-09 14:53:48 -08:00
Not Sure b68157e6f7 Fix typo. 2020-12-23 07:13:14 +08:00
Not Sure 36d9993bbf Add --tcp-incoming-rcvbuf and --tcp-outgoing-rcvbuf which allow precise control over TCP receive buffers. 2020-12-23 07:13:14 +08:00
Not Sure 920dbac0d3 Missing config file parsing logic. 2020-12-23 07:13:14 +08:00
Not Sure 5617841694 Add --tcp-incoming-sndbuf and --tcp-outgoing-sndbuf which allow precise control over TCP send buffers.
- This is very useful in advanced scenarios such as ss-redir or chaining of servers using TPROXY
  to avoid bufferbloat-like performance degradation due to default large buffers of OS.
2020-12-23 07:13:14 +08:00
SamHurwitz 72db525aac Fix manager not passing -i option 2020-10-17 14:58:31 +05:00
babarosaM33 a727596faa jconf: fix memory leak 2020-08-04 21:56:45 +08:00
zfl9 78784507f1 add tcp_tproxy option, use tproxy instead of redirect (tcp) 2020-07-18 16:23:21 +08:00
Max Lv 25be24c01f Align the report format for UDP packet 2020-06-20 06:56:31 +08:00
Max Lv e8ca659cea report suspicious UDP packet for fail2ban 2020-06-20 06:45:37 +08:00
Max Lv 3ff9d33898 Merge pull request #2698 from DDoSolitary/patch-cmake-mingw
Fix support for building with CMake and MinGW.
2020-05-02 15:15:25 +08:00
DDoSolitary 93336adf66 Fix static linking issues on Windows. 2020-05-02 13:36:38 +08:00
DDoSolitary f1f3e9d6ca Fix support for building with CMake and MinGW. 2020-05-02 13:25:11 +08:00
root 02f25e588c add ss-manager read manager_address from config.json 2020-05-02 10:57:36 +08:00
Max Lv 236c98d6d9 Merge pull request #2685 from JamisHoo/master
Also apply LIB_ONLY for dynamic library, fix #2443
2020-04-29 11:37:16 +08:00
Max Lv aa9fe8cceb Fix #2692 2020-04-27 09:44:22 +08:00
Max Lv 33a1932023 Fix #2687 2020-04-17 13:42:30 +08:00
Jamis Hoo bbb2849b60 Also apply LIB_ONLY for shared library, fix #2443 2020-04-13 22:08:43 +08:00
Jamis Hoo 138186b3db Add include_directories property for shared_libraries 2020-03-29 17:35:22 +08:00
ideal af722a4b92 Fix a tiny memory leak 2020-03-15 01:21:51 +08:00
Max Lv 6f7a6fd7e3 Merge pull request #2628 from Mygod/kill-sniparser
Remove sniparser
2020-02-20 17:50:49 +08:00
Max Lv 64d3235c67 Fix #2620 2020-02-15 11:06:42 +08:00
Max Lv 8c251b2bc5 Fix build 2020-02-12 15:48:22 +08:00
Mygod 1c818ebca7 Fix build 2020-02-11 23:55:58 -05:00
Mygod 355adddff1 Remove unused is_remote_dns option 2020-02-11 23:52:48 -05:00
Mygod 301fea635b Remove sniparser 2020-02-11 23:48:30 -05:00
babarosaM33 81bbd98d8b udprelay: exclude udp remote_recv_sendto buff full
before:
udp send buff full would not reset timeout trigger
after:
fix it
2020-02-08 17:55:07 +08:00
babarosaM33 a5111fe32f updrelay: cleanup 2020-02-07 15:11:14 +08:00
Max Lv 0686909bb0 Merge pull request #2610 from babarosaM33/bloom_reset
ppbloom: save free() and subsequent init() overhead
2020-01-29 19:54:02 +08:00
Max Lv 6f9bd72def Merge pull request #2609 from babarosaM33/bloom_slots
crypto: lower bloom filter error rate
2020-01-29 19:40:20 +08:00
babarosaM33 a5005664a7 ppbloom: save free() and subsequent init() overhead
init utilizes calloc which malloc and memset.

need cherry-pick commit of libbloom
2020-01-29 18:57:19 +08:00
babarosaM33 88c4d2aaab crypto: lower bloom filter error rate
before patch:
full bloom filter error rate before reset 1-(1-1e-6)^5e5=1-0.606=0.394

after patch:
1-(1-1e-10)^5e5=1-0.99995=5e-5
2020-01-29 16:31:14 +08:00
babarosaM33 30d5b85fe7 Revert "ppbloom:remove unnecessay bloom_check"
ppbloom_add only checks current bloom filter not both PING PONG filters

This reverts commit 9ae59819be.
2020-01-29 16:09:10 +08:00