Commit Graph
2394 Commits
Author SHA1 Message Date
Max LvandClaude Opus 4.6 a0f51523ce CI: add unit test and stress test steps to GitHub Actions
Split the Test step into separate "Unit tests" (ctest) and "Stress test"
(stress_test.py with 10MB transfer across all AEAD ciphers) steps for
better visibility.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 17:03:23 +08:00
Max LvandClaude Opus 4.6 238b93cad4 Fix Linux build: link libm for test_jconf (json.c uses pow)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 16:57:58 +08:00
Max LvandClaude Opus 4.6 40083f1cb7 Fix Linux build: link libm for test_buffer and test_crypto, fix warnings
Both test_buffer and test_crypto link libbloom.so which uses log() from
libm. Also fix unused variable warnings in test_json.c that would fail
with -Werror.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 16:55:58 +08:00
Max LvandClaude Opus 4.6 9ec2620599 Fix test_ppbloom link: add libm for bloom's log()
On Linux, libbloom uses log() which requires explicit -lm linkage.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 16:52:36 +08:00
Max LvandClaude Opus 4.6 ccd6ab4b39 Fix test build on Linux: add stdint.h and link libm
- test_ppbloom.c: add missing #include <stdint.h> for uint8_t
- test_json: link against libm for pow() used in json.c

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 16:50:55 +08:00
Max LvandClaude Opus 4.6 995aa0d39e Fix CI: use mbedtls@3 on macOS, disable static build
- macOS: brew's mbedtls is now v4 (incompatible), use mbedtls@3
- Disable static build since CI runners lack static lib packages

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 16:49:06 +08:00
Max LvandClaude Opus 4.6 d472c5b85a Rewrite GitHub Actions: build and test directly on runner
Replace Docker-based CI with direct cmake build on ubuntu-latest and
macos-latest. Install dependencies via apt/brew, build with cmake,
run unit tests with ctest.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 16:47:46 +08:00
Max LvandClaude Opus 4.6 b8e250d7e2 Fix Docker build: disable static libs (not available in alpine)
Alpine's mbedtls-dev only provides shared libraries. Disable static
build since Docker only needs shared binaries.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 16:46:16 +08:00
Max LvandClaude Opus 4.6 cf0c053839 Fix Docker build: disable tests and remove git dep
The tests/ directory is excluded by .dockerignore, so pass
-DBUILD_TESTING=OFF to cmake. Submodules are already checked out
by actions/checkout, no need for git inside the container.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 16:44:55 +08:00
Max LvandClaude Opus 4.6 0cd823094b Update Dockerfiles: use CMake build and pcre2-dev
The alpine Dockerfile still used autotools (autogen.sh/configure) which
were removed. Switch to cmake build and replace pcre-dev with pcre2-dev.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 16:43:27 +08:00
Max LvandClaude Opus 4.6 e36d03b5f6 Migrate from PCRE to PCRE2
Replace legacy PCRE (libpcre3) with PCRE2 (libpcre2-8). PCRE1 has been
end-of-life since 2021.

- src/rule.h: use pcre2_code and pcre2_match_data types
- src/rule.c: pcre_compile -> pcre2_compile, pcre_exec -> pcre2_match,
  pcre_free -> pcre2_code_free, with proper error message retrieval
- cmake/FindPCRE.cmake -> cmake/FindPCRE2.cmake: find libpcre2-8 via
  pkg-config, pcre2-config, or manual search
- Update all CMakeLists.txt, config.h.cmake, configure.cmake, README.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 16:40:27 +08:00
Max LvandClaude Opus 4.6 1c404eccf4 Modernize build: switch to CMake, add unit tests, fix man pages
Remove autotools (configure.ac, Makefile.am, m4/, autogen.sh) and make
CMake the sole build system. Enhance CMake with proper Find modules for
MbedTLS, libsodium, PCRE, and c-ares with version/feature detection.
Add support for connmarktos, nftables, stack protector, and MinGW.

Add 10 unit test suites (CTest) covering base64, buffer, cache, crypto,
jconf, json, netutils, ppbloom, rule, and utils modules. Add a Python
stress test measuring bandwidth per cipher with memory leak detection.

Fix man page typos ("Resovle" -> "Resolve"), document missing TCP buffer
options, fix ss-manager duplicate --executable entry, add example section
to ss-tunnel, and document --workdir and --nftables-sets options.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 16:40:27 +08:00
David Korczynski b2a0c545d8 json: fix signed integer overflows
Signed integer overflows can happen in three distinct places. This
fixes it so an error happens when an overflow is observed.

Signed-off-by: David Korczynski <david@adalogics.com>
2025-12-29 17:44:06 +08:00
Lu jicongandZxl hhyccc 9afa3cacf9 Fix in 'mbedtls 3.6.0 ver' compilation failure issue
Fix mbedtls 3.6 compatibility

Co-authored-by: Zxl hhyccc <zxlhhy@gmail.com>
Signed-off-by: Lu jicong <jiconglu58@gmail.com>
2025-01-20 11:11:47 +08:00
GVerso d83ace0f0d Translation of README.md into Brazilian Portuguese. (#2946)
README.md translated to Brazilian Portuguese
2022-11-30 11:08:01 +08:00
Bill Zhong 288cba784e fix snap link and badge 2022-11-30 11:06:54 +08:00
Michael 3bcf258de1 Fix "missing configuration file" error during custom build using autotools 2022-11-23 09:39:54 +08:00
rickyrick2002 7f7f68afe4 replace fixed mbedtls version with variable $MBEDTLS_VER 2022-10-25 11:59:31 +08:00
rickyrick2002 a3b1dc7f37 update MbedTLS dependency link and add Debian / Ubuntu apt pkg-config 2022-10-25 11:59:31 +08:00
nishans08 d3e73c6ce6 fixes grammatical errors in README.md
221: You should jump this section and install them from distribution repository instead. -> You should jump to this section and install them from the distribution repository instead.

FIX #7
2022-07-28 10:24:48 +08:00
vndroid 5fdb6624e3 Update
- Fix path error
2022-06-28 16:22:11 +08:00
vndroid c13c464604 Update
- Solve the problem of not being able to enter the container
- Execute strip after compilation
- Support multi-threaded compilation
2022-06-28 15:32:11 +08:00
DDoSolitary 05e70d4317 fix c-ares link dep 2022-06-26 06:22:56 +08:00
Maxim Galaganov 549b9bedb9 Fix rpm build for fedora 36 2022-06-26 06:21:38 +08:00
Maxim Galaganov 9eeadf9137 Add submodules to git safe.directory for .copr build 2022-06-26 06:21:12 +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
Bill Zhong c2fc967c1a fix .copr build 2022-05-29 08:51:29 +08:00
Chen Shaoju 90f21abc2d Update README.md
Update the PKGBUILD url.
2022-05-29 08:50:41 +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
Alexandre ABRIOUX e21f8248b6 fix: being able to use empty DNS_ADDRS with docker image 2022-04-11 08:32:33 +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
Paul "Joey" Clark 3654658111 Add git submodule to the build docs
This confused me, and looking at the issues, it has confused other people as well. [1](https://github.com/shadowsocks/shadowsocks-libev/issues/2758)

I'm not sure if we can automate it though, e.g. in `autogen.sh`. Because some people might want to build with a modified version of the libraries.

Perhaps we could automatically fetch the submodules IF we see they are empty...

Anyway, for now, we can at least document this step.
2021-08-27 08:11:33 +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
Max Lv d1171f44d0 Revert ""DynamicUser=true" makes "/etc/init.d/shadowsocks-libev start" fail."
This reverts commit ca4caabac6.
2021-05-13 12:33:57 +08:00
lixingcong ed23402637 Fix memory leak in manager 2021-05-12 16:13:10 +08:00
abner_bob ca4caabac6 "DynamicUser=true" makes "/etc/init.d/shadowsocks-libev start" fail. 2021-05-12 16:12:56 +08:00
dependabot[bot] 16867e1c73 Bump docker/setup-qemu-action from 1 to 1.1.0
Bumps [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) from 1 to 1.1.0.
- [Release notes](https://github.com/docker/setup-qemu-action/releases)
- [Commits](https://github.com/docker/setup-qemu-action/compare/v1...v1.1.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-12 16:12:11 +08:00
dependabot[bot] 3b3ba96210 Bump actions/checkout from 2 to 2.3.4
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 2.3.4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v2.3.4)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-12 16:11:53 +08:00
dependabot[bot] a4a8fc1e04 Bump docker/login-action from 1 to 1.9.0
Bumps [docker/login-action](https://github.com/docker/login-action) from 1 to 1.9.0.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v1...v1.9.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-12 16:11:44 +08:00
dependabot[bot] ada0bae70a Bump docker/build-push-action from 2 to 2.4.0
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 2 to 2.4.0.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v2...v2.4.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-12 16:11:28 +08:00
dependabot[bot] da3aa4d6b9 Bump docker/setup-buildx-action from 1 to 1.3.0
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 1 to 1.3.0.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](https://github.com/docker/setup-buildx-action/compare/v1...v1.3.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-12 16:10:37 +08:00
Maxim Shpak 6329526199 Run systemd service after network is available (unit file fix)
There is a race condition between shadowsocks-libev.service and
systemd-resolved.service after reboot/on boot. The shadowsocks
service tries to start before the dns service is started properly
and fails showing the corresponding errors in the logs.
2021-03-31 07:39:59 +08:00