1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-06 17:50:40 +03:00
Commit Graph

8 Commits

Author SHA1 Message Date
Yihong Wu
b91d9af5e3 Mayaqua/DNS: Fix memory safety in DNS operation threads
Fix #1329
2021-12-12 20:05:36 +08:00
Yihong Wu
e6bf956806 Return and cache all addresses from DNS resolver 2021-12-10 16:18:45 +08:00
Yihong Wu
b178f26e52
Reduce redundant loop
Co-authored-by: Davide Beatrici <github@davidebeatrici.dev>
2021-12-04 16:16:22 +08:00
Yihong Wu
9692a8d961 Fix DNS resolution when no IPv6 address is configured 2021-12-03 14:18:43 +08:00
domosekai
883d4d4cd7 Mayaqua/DNS.c: Fix DNS resolution in dual stack environment 2021-07-05 11:10:03 +00:00
Davide Beatrici
2f801f30de Fix compile errors on OpenBSD
- <pthread.h> included for the "pthread_t" type definition.
- <net/ethernet.h> include removed as the header doesn't exist.
- AI_ALL and AI_V4MAPPED defined to 0 as the options don't exist.
2021-05-03 19:58:12 +02:00
Davide Beatrici
3a595b4a46 Mayaqua/DNS.c: Fix memory leaks
52 bytes in 2 blocks are definitely lost in loss record 5 of 13
   at 0x483877F: malloc (vg_replace_malloc.c:307)
   by 0x4ABB1BB: UnixMemoryAlloc (Unix.c:2033)
   by 0x4A7FABF: InternalMalloc (Memory.c:3819)
   by 0x4A7B769: MallocEx (Memory.c:3650)
   by 0x4A7B769: Malloc (Memory.c:3641)
   by 0x4AA71A9: CopyStr (Str.c:1884)
   by 0x4A61A9C: DnsCacheReverseUpdate (DNS.c:257)
   by 0x4A62123: DnsResolveReverse (DNS.c:506)
   by 0x4A93EB3: GetHostName (Network.c:15023)
   by 0x4A93EB3: AcceptInitEx (Network.c:12589)
   by 0x4934659: TCPAcceptedThread (Listener.c:172)
   by 0x4A76469: ThreadPoolProc (Kernel.c:872)
   by 0x4ABD159: UnixDefaultThreadProc (Unix.c:1589)
   by 0x51C2EA6: start_thread (pthread_create.c:477)

2,280 (684 direct, 1,596 indirect) bytes in 9 blocks are definitely lost in loss record 11 of 13
   at 0x483877F: malloc (vg_replace_malloc.c:307)
   by 0x4C65AC5: gaih_inet.constprop.0 (getaddrinfo.c:1058)
   by 0x4C67224: getaddrinfo (getaddrinfo.c:2256)
   by 0x4A61E06: DnsResolver (DNS.c:404)
   by 0x4A76469: ThreadPoolProc (Kernel.c:872)
   by 0x4ABD159: UnixDefaultThreadProc (Unix.c:1589)
   by 0x51C2EA6: start_thread (pthread_create.c:477)
   by 0x4C7CDEE: clone (clone.S:95)
2021-04-21 22:35:45 +02:00
Davide Beatrici
0472f9c286 Rewrite DNS API from scratch into dedicated file(s)
From a functional point of view, the main improvement is that GetIP() now always prioritizes IPv6 over IPv4.
The previous implementation always returned an IPv4 address, unless not available: in such case it failed.
This means that now connections to hostnames should be established via IPv6 if available.

From a programmer point of view, getting rid of the insane wrappers is enough to justify a complete rewrite.

As an extra, several unrelated unused global variables are removed.
2021-04-18 01:46:59 +02:00