Commit Graph
38 Commits
Author SHA1 Message Date
Max Lv dd5e954ab4 Clean up 2018-09-02 17:21:23 -07:00
Mygod 307088ed4a Support hostname resolving in VPN mode 2018-08-24 14:00:13 +08:00
FlyingheartCN 662b6db3f3 Fix Build Fail with GCC8 2018-05-04 01:41:36 +08:00
Linus Yang 2ed8791dab Re-add support for MinGW 2018-03-08 17:26:11 +08:00
Max Lv f8b18cc793 Refine the bind_to_address 2018-02-11 08:50:29 +08:00
Max Lv 85a64ae836 Bump version 2018-01-15 17:25:03 -08:00
Max Lv b95495e71d Remove the log of sockaddr_cmp 2018-01-12 22:55:26 +08:00
Max Lv ede744ae7c Add c-ares support (#1655)
* Replace udns with c-ares

* Get IO loop work

* Clean up

* Avoid initializing nameservers each query

* Add ARES_OPT_SERVERS

* Refine resolv_cancel

* Fix a memory leak

* Replace udns.h with ares.h

* Fix all inet_* fucntions

* Clean up

* Enable servers_ports when VERSION_MINOR >= 11

* Avoid ares_inet_XtoX

* Handle multipe nameservers correctly

* Use ares_set_servers for IPv4 and IPv6 mixed list

* Refine c-ares for udprelay

* Refine ares_set_servers()

* Refine the timer based on ares_timeout

* Avoid resolv_cancel

* Fix an issue of null pointer

* Fix another null pointer issue

* Refine the order of resolv_shutdown

* Fix the corrupted ev io
2017-08-31 09:16:07 +08:00
Aaron LI e65b3b1505 Move <sys/socket.h> inclusion to fix build on DFlyBSD
The ``<sys/socket.h>`` header should be included in ``src/netutils.h``
before the usage of ``struct sockaddr_storage``, otherwise build failed
with errors such as:

```
In file included from udprelay.c:53:0:
netutils.h:68:22: error: 'struct sockaddr_storage' declared inside parameter list [-Werror]
                      int ipv6first);
                      ^
netutils.h:68:22: error: its scope is only this definition or declaration, which is probably not what you want [-Werror]
```

Tested on DragonFly BSD 4.9-development and Debian Linux testing.
2017-05-24 20:00:53 +08:00
Max Lv 4ebe5aeb12 Add SIP004 (AEAD) support 2017-01-29 10:10:44 +08:00
Max Lv 3f8cd982e5 Drop MinGW32 support 2017-01-24 20:10:31 +08:00
Syrone Wong 9db8c3abe8 zeroize some structs before using
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-12-08 04:11:43 -06:00
Max Lv f38aedc71a Refine the ipv6first resolving 2016-11-12 11:15:32 +08:00
Max Lv 5cd294879b Add -6 option for #942 2016-11-12 11:01:05 +08:00
Max Lv 6d57b3cb56 Fix #912 2016-10-30 08:34:43 +08:00
Max Lv aac4240e9f Fix #909 2016-10-29 13:40:40 +08:00
Max Lv cfae8dcfcc Refine outbound feature #905 2016-10-29 08:11:53 +08:00
Max Lv b28638ab80 Clean up 2016-09-09 13:17:58 +08:00
Max Lv a3a51b8414 Refine hostname validation 2016-09-06 09:01:51 +08:00
Max Lv bf194fef75 Add validation of domain name 2016-08-31 09:45:47 +08:00
tim-le ad17d91b42 fix bugs with when ss-server bind_address enabled (#725)
* SO_REUSEADDR for remote sockfd

avoid  ERROR: bind_to_address: Address already in use

* set addr->sin_port to be 0
2016-07-14 18:08:10 -05:00
Max Lv 55dea8b973 Fix #690 2016-06-28 15:33:55 +08:00
Max Lv fd4adca789 Fix #627 2016-05-06 15:36:37 +08:00
Max Lv e3deb0668d Fix the mismatch types 2016-05-06 15:10:09 +08:00
Max Lv bb50fc22ca Add option for binding to address #626 2016-05-06 14:52:33 +08:00
Kim 08f873adc7 Roll up year to 2016 2016-04-22 22:50:26 +08:00
Max Lv 114128668c Refine helper functions 2016-04-16 00:43:27 +08: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 e921f40aa8 Fix #493 2015-12-25 09:18:53 +08:00
Max Lv b0600a8784 Refine buffer handling 2015-11-30 15:03:04 +08:00
Max Lv 248abd3d02 clean up 2015-05-10 20:45:23 +08:00
Max Lv 9431b9b0c3 Add TPROXY support for redir mode 2015-05-05 14:37:27 +08:00
Max Lv 339372af39 fix #277 2015-03-06 09:25:45 +08:00
Max Lv b875797839 clean up 2015-03-05 14:16:28 +08:00
Max Lv 726a1b7dd7 clean up 2015-01-22 09:12:19 +08:00
Max Lv ba889d277d fix #227 2015-01-15 15:26:46 +09:00
Max Lv 40e9be0021 Avoid getaddrinfo() in the main loop 2015-01-12 16:49:47 +09:00