Commit Graph
565 Commits
Author SHA1 Message Date
Max Lv 41d93b126a Fix #626 2016-05-06 13:23:18 +08:00
Max Lv 72ee77ea35 Fix #615 2016-04-28 10:34:26 +08:00
Syrone Wong 7481ffffc7 clarify encrypt method info
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-04-24 21:25:26 +08:00
Kim 08f873adc7 Roll up year to 2016 2016-04-22 22:50:26 +08:00
Kim b3b522fd5e Fix missing leading space in macro LOGI() 2016-04-22 22:38:51 +08:00
Syrone Wong 0bbf6c36a7 use sodium_memzero() to clear sensitive data
Close #603

After use, sensitive data should be overwritten, but memset() and hand-written code can be silently stripped out by an optimizing compiler or by the linker.

The sodium_memzero() function tries to effectively zero len bytes starting at pnt, even if optimizations are being applied to the code.

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-04-22 18:00:19 +08:00
Kim c9098f40a5 Add friendly IP_TRANSPARENT fatal message 2016-04-21 14:54:17 +08:00
Kim dfa9e17c1b Add help option
* updated cli option 'help'

- all 5 apps supports cli option '-h' without error exit code
- supports long option '--help'

* fixed bad line brake
2016-04-21 06:22:58 +08:00
YumeMichi ebf24c1c01 Fix compile on 32-bit machine (#593)
redir.c:212:9: error: format ‘%ld’ expects argument of type ‘long int’, but argument 5 has type ‘ssize_t’ [-Werror=format=]
         LOGI("redir to %s:%d, len=%ld", ipstr, port, r);
         ^
2016-04-19 15:52:07 +08:00
Kim 3e0952de52 Refine verbose output in redir mode
* fix `ss-redir -v`.

It's now output messages while redirecting.
This is useful at the time building up a router.

* typo

* inet_ntop() -> dns_ntop()

* removed max().

max(INET_ADDRSTRLEN, INET6_ADDRSTRLEN) => INET6_ADDRSTRLEN
2016-04-19 14:05:12 +08:00
Max Lv 6c2c49ad60 Fix #586 2016-04-17 20:03:36 +08:00
Max Lv ac5f26c6fa Fix #585 2016-04-17 19:38:10 +08:00
Max Lv 8701f1dc65 Add missing headers 2016-04-16 01:02:12 +08:00
Max Lv 2363acf1f7 Fix a typo 2016-04-16 00:58:13 +08:00
Max Lv 114128668c Refine helper functions 2016-04-16 00:43:27 +08:00
Syrone Wong ebe79bbbd8 Refine memory management (#579)
- Added one macro to avoid dangling pointers
- Added two functions to perform NULL pointer check
  since the allocation is not guaranteed by C library, although it
  is a rare case, just for sanity
- Add NULL pointer check to brealloc() and bfree() and for sanity as well

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-04-15 09:16:38 -07:00
Syrone Wong 53c6a09b93 Reset errno to 0 before checking it
errno is never set to zero by any system call or library function,
and it's programmer's resposibility to reset it before doing checks.
Otherwise the error might be misleading.

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-04-15 08:35:16 -07:00
Syrone Wong 06d92c923c compare port as well
The whole remote_ctx is inserted into the cache and sockaddr_storage contains
both address and port.

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-04-15 08:34:35 -07:00
H2NCH2COOH 43fde8d39c Fix bug for ss-server udp sendto_remote error (#578) 2016-04-09 20:00:15 -07:00
H2NCH2COOH 117ddf4f33 Fix bug for ss-server when udp is sent with host not ip 2016-04-09 08:06:51 -07:00
Syrone Wong a17d2f19ac Fix sockaddr comparison (#575)
This may fix #565

It is not recommended to compare two structs via memcmp although they have been
memset to 0.
Added two helper functions to compare sockaddr_storage, one for address only and
the other one takes port into account.

These two functions are based on Unbound version in util/net_help.c, and
comform needs of shadowsocks-libev.

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-04-08 17:26:11 -07:00
Syrone Wong 58264c77fc Polish code
code issues found by Clang with
CFLAGS="-Os -Wall -Wextra -Werror=unused-const-variable -Wno-error=unused-parameter"
enabled

The details as follows:
- variable initialization issue, modified them as Clang suggested
- data type mismatch when comparing, fix them either by casting or changing
  the data type of index of iterator
- get_sockaddr() in netutils may return -1 thus changed returning type from
  size_t to ssize_t, which makes Clang happier
- recvfrom() in udprelay is identical, fix this by creating local variable
  for comparison  and assign back to buf->len when returning value is acceptable

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-04-07 21:28:23 -07:00
Max Lv ce0561a999 Fix #560 2016-03-14 09:50:59 +08:00
Max Lv 8539acd28f Merge pull request #487 from Chion82/master
Enable TCP keep-alive feature for remote connections
2016-03-11 12:05:48 +08:00
Max Lv da06378915 Clean up 2016-01-31 17:21:44 +08:00
Max Lv 2ac55a4a3f Reduce the latency of ss-redir 2016-01-26 10:40:23 +08:00
Max Lv e669a3a37c reset peer_name 2016-01-26 09:48:33 +08:00
Max Lv 0d64f11f47 Fix typo 2016-01-24 17:18:09 +08:00
Max Lv dbe1e01074 Add prefix option for Android 2016-01-24 16:32:37 +08:00
Max Lv 62a7dcbae8 Fix a typo 2016-01-19 08:57:30 +08:00
Kery Wu a0098cfdb9 Fix the crash issue in free_connections 2016-01-01 10:32:57 +08:00
Max Lv f09d280af0 Fix a typo
https://msdn.microsoft.com/zh-cn/library/windows/desktop/ms738573%28v=vs.85%29.aspx
2015-12-30 12:49:26 +08:00
aipsel cd0b5c8586 Fix to avoid memory leak.
If received data is invalid, this method can cause memory leak.
2015-12-29 00:45:10 +08:00
aipsel b86ecbbd5c add check to avoid Segmentation fault 2015-12-27 18:20:04 +08:00
Max Lv bc14591df9 Merge pull request #499 from Mygod/battery-opt
Reduce battery usage - transmit traffic stat with binary
2015-12-27 07:48:41 +08:00
Mygod 68eaf3b12d Reduce battery usage - transmit traffic stat with binary 2015-12-26 20:40:05 +08:00
Symeon Huang 05a15aa187 Support OTA in library interface 2015-12-25 14:46:33 +00:00
Max Lv 52739f7a14 Refine #495 2015-12-25 14:48:23 +08:00
Max Lv 96690ea08c Merge pull request #496 from kery/issue_495
Fix #495
2015-12-25 14:29:00 +08:00
Kery e73aab26cb Fix #495 2015-12-25 14:12:34 +08:00
Max Lv c18ae5f671 Fix #494 2015-12-25 12:40:46 +08:00
Max Lv e921f40aa8 Fix #493 2015-12-25 09:18:53 +08:00
Chion Tang 333c47a42a Add keepalive feature for remote connections 2015-12-22 14:07:04 +08:00
Max Lv e3a417932e Update ax_pthread 2015-12-20 20:50:04 +08:00
Max Lv 52ff163cd6 Fix a build error 2015-12-15 09:17:44 +08:00
Max Lv 47f984e61c Refine nofile option 2015-12-14 19:31:12 +08:00
Syrone Wong 5c3ed5c9c1 add IETF-compatible Chacha20 cipher support
Note:
- ChaCha20 with an extended (96 bit) nonce and a 32-bit counter has
been implemented as crypto_stream_chacha20_ietf() from LibSodium 1.0.4
- The name of new cipher is "chacha20-ietf"

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2015-12-13 19:30:41 +08:00
Max Lv d2ef245a05 Refine buffer allocation (2) 2015-12-13 10:57:55 +08:00
Max Lv 596f03665b Refine buffer allocation 2015-12-12 11:17:30 +08:00
Max Lv f3428e621a update Makefile.in 2015-12-11 12:11:54 +09:00