Commit Graph
654 Commits
Author SHA1 Message Date
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
Max Lv 1164dc28ca fix a typo for #474 2015-12-09 17:53:37 +08:00
Syrone Wong 06eef7fdd1 use sha1_hmac function directly for PolarSSL
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2015-12-08 11:46:54 +08:00
Max Lv 125cce3ff1 Remove internal hmac-sha1 2015-12-08 10:50:08 +08:00
crvv d0cd1b427b Also refine TCP fastopen 2015-12-07 18:26:20 +08:00
Max Lv e7a1d1e333 Refine TCP fastopen 2015-12-07 12:47:28 +08:00
crvv 3d6528a565 server side TCP fast open support on Darwin 2015-12-07 00:46:04 +08:00
crvv 002e3e5394 client side TCP fast open support on Darwin 2015-12-07 00:46:04 +08:00
crvv c7ad107aab do not undefine TCP_FASTOPEN on Darwin 2015-12-07 00:46:04 +08:00
Syrone Wong 0f4db65e23 use mbed TLS provided sha1-hmac function
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2015-12-06 12:28:41 +08:00
Max Lv 156223a366 Fix a potential timing attack by @swordfeng 2015-12-06 09:46:13 +08:00
Max Lv eeac81e8fa Refine doc 2015-12-03 15:35:50 +09:00