-
Notifications
You must be signed in to change notification settings - Fork 28.1k
/
CHANGES
5696 lines (3450 loc) · 186 KB
/
CHANGES
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Changelog for the c-ares project. Generated with git2changes.pl
Version 1.20.0 (6 Oct 2023)
Brad House (6 Oct 2023)
- fix slist search off by 1
GitHub (6 Oct 2023)
- [Brad House brought this change]
1.20.0 release prep (#557)
- [Brad House brought this change]
ares__buf should return standard error codes. more helpers implemented. (#558)
The purpose of this PR is to hopefully make the private API of this set of routines less likely to need to be changed in a future release. While this is not a public API, it could become harder in the future to change usage as it becomes more widely used within c-ares.
Fix By: Brad House (@bradh352)
- [Brad House brought this change]
Update from 1989 MIT license text to modern MIT license text (#556)
ares (and thus c-ares) was originally licensed under the 1989 MIT license text:
https://fedoraproject.org/wiki/Licensing:MIT#Old_Style_(no_advertising_without_permission)
This change updates the license to the modern MIT license as recognized here:
https://opensource.org/license/mit/
care has been taken to ensure correct attributions remain for the authors contained within the copyright headers, and all authors with attributions in the headers have been contacted for approval regarding the change. Any authors which were not able to be contacted, the original copyright maintains, luckily that exists in only a single file `ares_parse_caa_reply.c` at this time.
Please see PR #556 for the documented approvals by each contributor.
Fix By: Brad House (@bradh352)
- [Brad House brought this change]
Test Harness: use ares_timeout() to calculate the value to pass to select() these days. (#555)
The test framework was using 100ms timeout passed to select(), and not using ares_timeout() to calculate the actual recommended value based on the queries in queue. Using ares_timeout() tests the functionality of ares_timeout() itself and will provide more responsive results.
Fix By: Brad House (@bradh352)
- [Brad House brought this change]
Fix for TCP back to back queries (#552)
As per #266, TCP queries are basically broken. If we get a partial reply, things just don't work, but unlike UDP, TCP may get fragmented and we need to properly handle that.
I've started creating a basic parser/buffer framework for c-ares for memory safety reasons, but it also helps for things like this where we shouldn't be manually tracking positions and fetching only a couple of bytes at a time from a socket. This parser/buffer will be expanded and used more in the future.
This also resolves #206 by allowing NULL to be specified for some socket callbacks so they will auto-route to the built-in c-ares functions.
Fixes: #206, #266
Fix By: Brad House (@bradh352)
- [Brad House brought this change]
remove acountry from built tools as nerd.dk is gone (#554)
The acountry utility required a third party DNSBL service from nerd.dk in order to operate. That service has been offline for about a year and there is no other comparable service offering. We are keeping the code in the repository as an example, but no longer building it.
Fixes: #537
Fix By: Brad House (@bradh352)
- [Brad House brought this change]
Don't requeue any queries for getaddrinfo() during destruction. (#553)
During ares_destroy(), any outstanding queries are terminated, however ares_getaddrinfo() had an ordering issue with status codes which in some circumstances could lead to a new query being enqueued rather than honoring the termination.
Fixes #532
Fix By: @Chilledheart and Brad House (@bradh352)
- [Brad House brought this change]
ares_getaddrinfo(): Fail faster on AF_UNSPEC if we've already received one address class (#551)
As per #541, when using AF_UNSPEC with ares_getaddrinfo() (and in turn with ares_gethostbynam()) if we receive a successful response for one address class, we should not allow the other address class to continue on with retries, just return the address class we have.
This will limit the overall query time to whatever timeout remains for the pending query for the other address class, it will not, however, terminate the other query as it may still prove to be successful (possibly coming in less than a millisecond later) and we'd want that result still. It just turns off additional error processing to get the result back quicker.
Fixes Bug: #541
Fix By: Brad House (@bradh352)
- [Sam Morris brought this change]
Avoid producing an ill-formed result when qualifying a name with the root domain (#546)
This prevents the result of qualifying "name" with "." being "name.." which is ill-formed.
Fixes Bug: #545
Fix By: Sam Morris (@yrro)
- [Brad House brought this change]
Configuration option to limit number of UDP queries per ephemeral port (#549)
Add a new ARES_OPT_UDP_MAX_QUERIES option with udp_max_queries parameter that can be passed to ares_init_options(). This value defaults to 0 (unlimited) to maintain existing compatibility, any positive number will cause new UDP ephemeral ports to be created once the threshold is reached, we'll call these 'connections' even though its technically wrong for UDP.
Implementation Details:
* Each server entry in a channel now has a linked-list of connections/ports for udp and tcp. The first connection in the list is the one most likely to be eligible to accept new queries.
* Queries are now tracked by connection rather than by server.
* Every time a query is detached from a connection, the connection that it was attached to will be checked to see if it needs to be cleaned up.
* Insertion, lookup, and searching for connections has been implemented as O(1) complexity so the number of connections will not impact performance.
* Remove is_broken from the server, it appears it would be set and immediately unset, so must have been invalidated via a prior patch. A future patch should probably track consecutive server errors and de-prioritize such servers. The code right now will always try servers in the order of configuration, so a bad server in the list will always be tried and may rely on timeout logic to try the next.
* Various other cleanups to remove code duplication and for clarification.
Fixes Bug: #444
Fix By: Brad House (@bradh352)
- [Brad House brought this change]
its not 1991 anymore, lower default timeout and retry count (#542)
A lot of time has passed since the original timeouts and retry counts were chosen. We have on and off issues reported due to this. Even on geostationary satellite links, latency is worst case around 1.5s. This PR changes the per-server timeout to 2s and the retry count lowered from 4 to 3.
Fix By: Brad House (@bradh352)
- [Brad House brought this change]
Modernization: Implement base data-structures and replace usage (#540)
c-ares currently lacks modern data structures that can make coding easier and more efficient. This PR implements a new linked list, skip list (sorted linked list), and hashtable implementation that are easy to use and hard to misuse. Though these implementations use more memory allocations than the prior implementation, the ability to more rapidly iterate on the codebase is a bigger win than any marginal performance difference (which is unlikely to be visible, modern systems are much more powerful than when c-ares was initially created).
The data structure implementation favors readability and audit-ability over performance, however using the algorithmically correct data type for the purpose should offset any perceived losses.
The primary motivation for this PR is to facilitate future implementation for Issues #444, #135, #458, and possibly #301
A couple additional notes:
The ares_timeout() function is now O(1) complexity instead of O(n) due to the use of a skiplist.
Some obscure bugs were uncovered which were actually being incorrectly validated in the test cases. These have been addressed in this PR but are not explicitly discussed.
Fixed some dead code warnings in ares_rand for systems that don't need rc4
Fix By: Brad House (@bradh352)
- [Jérôme Duval brought this change]
fix missing prefix for CMake generated libcares.pc (#530)
'pkg-config grpc --cflags' complains with:
Variable 'prefix' not defined in libcares.pc
Fix By: Jérôme Duval (@korli)
bradh352 (11 Jul 2023)
- windows get_DNS_Windows port fix for ipv6
- windows get_DNS_Windows port is in network byte order
- backoff to debian 11 due to coverage check failure
- extend on PR #534, windows should also honor a port
GitHub (11 Jul 2023)
- [Brad House brought this change]
Support configuration of DNS server ports (#534)
As per https://man.openbsd.org/OpenBSD-5.1/resolv.conf.5 we should
support bracketed syntax for resolv.conf entries to contain an optional
port number.
We also need to utilize this format for configuration of MacOS
DNS servers as seen when using the Viscosity OpenVPN client, where
it starts a private DNS server listening on localhost on a non-standard
port.
Fix By: Brad House (@bradh352)
Daniel Stenberg (9 Jun 2023)
- provide SPDX identifiers and a REUSE CI job to verify
All files have their licence and copyright information clearly
identifiable. If not in the file header, they are set separately in
.reuse/dep5.
All used license texts are provided in LICENSES/
GitHub (30 May 2023)
- [Alexey A Tikhonov brought this change]
Remove unreachable code as reported by Coverity (#527)
Coverity reported some code as unreachable. A manual inspection confirmed the reports.
Fix By: Alexey A Tikhonov (@alexey-tikhonov)
- [Ben Noordhuis brought this change]
rand: add support for getrandom() (#526)
glibc provides arc4random_buf() but musl does not and /dev/urandom is
not always available.
- [Tim Wojtulewicz brought this change]
Replace uses of sprintf with snprintf (#525)
sprintf isn't safe even if you think you are using it right. Switch to snprintf().
Fix By: Tim Wojtulewicz (@timwoj)
bradh352 (23 May 2023)
- update version and release procedure
GitHub (22 May 2023)
- [Douglas R. Reno brought this change]
INSTALL.md: Add Watcom instructions and update Windows documentation URLs (#524)
This commit adds instructions on how to use the WATCOM compiler to build c-ares. This was just tested on c-ares-1.19.1 and works well.
While going through the links for the C Runtime documentation for Windows systems, I discovered that all three of the KB articles that were linked are now nonexistent. This commit replaces KB94248 with the current replacement available on Microsoft's website, which also makes the other two KB articles obsolete.
Fix By: Douglas R. Reno (@renodr)
Version 1.19.1 (22 May 2023)
bradh352 (22 May 2023)
- Makefile.inc Windows requires tabs not spaces for nmake
GitHub (22 May 2023)
- [Daniel Stenberg brought this change]
ares_expand_name: fix compiler warnings (#522)
Fix some compiler warnings (not introduced in this release)
Fix By: Daniel Stenberg (@bagder)
bradh352 (22 May 2023)
- windows MSVC compiler fix on 32bit
- update security advisory links
- minor CI issues fixes for imported inet_net_pton
- ares_rand static analysis fixes from CI
- windows build fix
- security release notes
GitHub (22 May 2023)
- [Brad House brought this change]
Merge pull request from GHSA-9g78-jv2r-p7vc
- [Brad House brought this change]
Merge pull request from GHSA-x6mf-cxr9-8q6v
* Merged latest OpenBSD changes for inet_net_pton_ipv6() into c-ares.
* Always use our own IP conversion functions now, do not delegate to OS
so we can have consistency in testing and fuzzing.
* Removed bogus test cases that never should have passed.
* Add new test case for crash bug found.
Fix By: Brad House (@bradh352)
- [Brad House brought this change]
Merge pull request from GHSA-8r8p-23f3-64c2
* segment random number generation into own file
* abstract random code to make it more modular so we can have multiple backends
* rand: add support for arc4random_buf() and also direct CARES_RANDOM_FILE reading
* autotools: fix detection of arc4random_buf
* rework initial rc4 seed for PRNG as last fallback
* rc4: more proper implementation, simplified for clarity
* clarifications
bradh352 (20 May 2023)
- add public release note information
- bump version to 1.19.1
GitHub (6 May 2023)
- [Gregor Jasny brought this change]
test: fix warning about uninitialized memory (#515)
fix warning in tests
Fix By: Gregor Jasny (@gjasny)
- [lifenjoiner brought this change]
Turn off IPV6_V6ONLY on Windows if it is supported (#520)
Turn off IPV6_V6ONLY on Windows if it is supported, support for IPv4-mapped IPv6 addresses.
IPV6_V6ONLY refs:
https://en.wikipedia.org/wiki/IPv6#IPv4-mapped_IPv6_addresses
https://github.com/golang/go/blob/master/src/net/ipsock_posix.go
https://en.wikipedia.org/wiki/Unix-like
off:
https://www.kernel.org/doc/html/latest/networking/ip-sysctl.html#proc-sys-net-ipv6-variables
https://man.netbsd.org/inet6.4
https://man.freebsd.org/cgi/man.cgi?query=inet6
https://github.com/apple-oss-distributions/xnu/blob/main/bsd/man/man4/inet6.4
on:
https://learn.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options
acts like off, but returns 1 and dummy setting:
https://man.dragonflybsd.org/?command=inet6
https://man.dragonflybsd.org/?command=ip6
unsupported and read-only returns 1:
https://man.openbsd.org/inet6.4
default value refs:
https://datatracker.ietf.org/doc/html/rfc3493#section-5.3
https://www.kernel.org/doc/html/latest/networking/ip-sysctl.html#proc-sys-net-ipv6-variables
- [Brad House brought this change]
Merge pull request from GHSA-54xr-f67r-4pc4
* CARES_RANDOM_FILE should always default to /dev/urandom
During cross-compilation, CARES_RANDOM_FILE may not be able to be appropriately
detected, therefore we should always set it to /dev/urandom and allow the
entity requesting compilation override the value. The code does appropriately
fall back if CARES_RANDOM_FILE cannot be opened.
* use set not option
bradh352 (18 Mar 2023)
- ares_getaddrinfo using service of "0" should be allowed
As per #517 glibc allows a service/servname of "0" to be treated the
same as if NULL was provided. Also, add a sanity check to ensure
the port number is in range instead of a blind cast.
Fixes: #517
Fix By: Brad House (@bradh352)
GitHub (10 Feb 2023)
- [Nikolaos Chatzikonstantinou brought this change]
fix memory leak in ares_send (#511)
When the condition channel->nservers < 1 holds, the function returns
prematurely, without deallocating query->tcpbuf. We rearrange the
check to be done prior to the allocations, avoiding the memory
leak. In this way, we also avoid unnecessary allocations if
channel->nservers < 1 holds.
Fix By: Nikolaos Chatzikonstantinou (@createyourpersonalaccount)
- [Nikolaos Chatzikonstantinou brought this change]
change comment style to old-style (#513)
Following the README.md guidelines,
"Comments must be written in the old-style"
the comment is changed to the old style.
Fix By: Nikolaos Chatzikonstantinou (@createyourpersonalaccount)
- [Nikolaos Chatzikonstantinou brought this change]
use strncasecmp in ares__strsplit (#512)
strncasecmp on platforms that don't already have it is already #define'd to a private implementation. There is no need to have OS-specific logic. Also removes ares__strsplit.h as a header as ares_private.h already includes it.
Fix By: Nikolaos Chatzikonstantinou (@createyourpersonalaccount)
- [Yijie Ma brought this change]
Fix a typo in ares_init_options.3 (#510)
that -> than
Fix By: Yijie Ma (@yijiem)
- [Douglas R. Reno brought this change]
Watcom Portability Improvements (#509)
- Modify the Watcom Makefile for the source code reorganization (#352)
- Add *.map files into .gitignore
- Fix build errors with Watcom's builtin Windows SDK (which is rather
outdated). It's smart enough to understand Windows Vista, but doesn't
have PMIB_UNICASTIPADDRESS_TABLE or MIB_IPFORWARD_ROW2.
It may be possible to use a different Windows SDK with the Watcom
compiler, such as the most recent Windows 10 SDK. Alternatively the SDK
in OpenWatcom 2.0 (which is in development) should fix this.
I have no problems testing this Makefile prior to releases, just give me
a ping.
Tested with Windows Vista, Windows 7, and Windows 10 using 'adig',
'acountry', and 'ahost'. This also seems to work on Windows XP, though
this is likely due to the compiler in use.
Fix By: Douglas R. Reno (@renodr)
Fixes Bug: #352
- [Jay Freeman (saurik) brought this change]
ignore aminclude_static.am, as generated by AX_AM_MACROS_STATIC (#508)
Fix By: Jay Freeman (@saurik)
- [Jay Freeman (saurik) brought this change]
sync ax_pthread.m4 with upstream (#507)
The version in the repository is many years old so this PR simply pulls in the latest
available revision from:
http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=tree;f=m4
Fix By: Jay Freeman (@saurik)
- [Chilledheart brought this change]
Windows: Invalid stack variable out of scope for HOSTS file path (#502)
In some conditions Windows might try to use a stack address that has gone out of scope when determining where to read the hosts data from for file lookups.
Fix By: @Chilledheart
- [Brad House brought this change]
sync ax_cxx_compile_stdcxx_11.m4 with upstream (#505)
It was reported that ax_cxx_compile_stdcxx_11.m4 was not compatible with uclibc.
The version in the repository is many years old so this PR simply pulls in the latest
available revision from:
http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=tree;f=m4
Fixes Bug: #504
Fix By: Brad House (@bradh352)
Version 1.19.0 (18 Jan 2023)
bradh352 (18 Jan 2023)
- Prep for 1.19.0 release
- Fix inverted logic in 25523e2
Fix .localhost. handling in prior commit
Fix By: Brad House (@bradh352)
- RFC6761 localhost definition includes subdomains
RFC6761 6.3 states:
The domain "localhost." and any names falling within ".localhost."
We were only honoring "localhost".
Fixes: #477
Fix By: Brad House (@bradh352)
- docs: ARES_OPT_UDP_PORT and ARES_OPT_TCP_PORT docs wrong byte order
As per #487, documentation states the port should be in network byte
order, but we can see from the test cases using MockServers on
different ports that this is not the case, it is definitely in host
byte order.
Fix By: Brad House (@bradh352)
GitHub (18 Jan 2023)
- [hopper-vul brought this change]
Add str len check in config_sortlist to avoid stack overflow (#497)
In ares_set_sortlist, it calls config_sortlist(..., sortstr) to parse
the input str and initialize a sortlist configuration.
However, ares_set_sortlist has not any checks about the validity of the input str.
It is very easy to create an arbitrary length stack overflow with the unchecked
`memcpy(ipbuf, str, q-str);` and `memcpy(ipbufpfx, str, q-str);`
statements in the config_sortlist call, which could potentially cause severe
security impact in practical programs.
This commit add necessary check for `ipbuf` and `ipbufpfx` which avoid the
potential stack overflows.
fixes #496
Fix By: @hopper-vul
bradh352 (18 Jan 2023)
- Fix build due to str-split sed gone wrong
Fix By: Brad House (@bradh352)
- cirrus-ci: switch to scan-build-py for MacOS
MacOS seems to work better with scan-build-py
Fix By: Brad House (@bradh352)
- ares_strsplit* -> ares__strsplit* to comply with internal function naming
Inspired by #495, but was missing test cases and would failed to build.
Fix By: Brad House (@bradh352), Daniel Stenberg (@bagder)
- Cirrus-CI: MacOS Homebrew has changed from /usr/local/opt to /opt/homebrew
Fix paths for homebrew.
Fix By: Brad House (@bradh352)
- cirrus-ci: iOS build needs to use ARM MacOS image
CirrusCI removed Intel-based MacOS images. Need to switch
iOS builds to use new ARM images as well.
Fix By: Brad House (@bradh352)
- cirrus-ci: new MacOS image
Cirrus-CI has recently EOL'd Intel MacOS VMs, switch to the latest
ARM-based image.
Fix By: Brad House (@bradh352)
- acountry was passing stack variable to callback
Recent ASAN versions picked up that acountry was passing stack
variables to ares_gethostbyname() then leaving the stack context.
We will now allocate a buffer for this.
Fix By: Brad House (@bradh352)
GitHub (13 Dec 2022)
- [Daniel Stenberg brought this change]
docs: reformat/cleanup man pages SYNOPSIS sections (#494)
To make them render "nicer" in both terminals and on the website.
- Removes the bold
- Removes .PP lines
- Indents them more like proper code style
Fix By: Daniel Stenberg (@bagder)
- [Nikolaos Chatzikonstantinou brought this change]
bug fix: new ares_strsplit (#492)
* add ares_strsplit unit test
The test reveals a bug in the implementation of ares_strsplit when the
make_set parameter is set to 1, as distinct domains are confused for
equal:
out = ares_strsplit("example.com, example.co", ", ", 1, &n);
evaluates to n = 1 with out = { "example.com" }.
* bugfix and cleanup of ares_strsplit
The purpose of ares_strsplit in c-ares is to split a comma-delimited
string of unique (up to letter case) domains. However, because the
terminating NUL byte was not checked in the substrings when comparing
for uniqueness, the function would sometimes drop domains it should
not. For example,
ares_strsplit("example.com, example.co", ",")
would only result in a single domain "example.com".
Aside from this bugfix, the following cleanup is performed:
1. The tokenization now happens with the help of strcspn instead of the
custom function is_delim.
2. The function list_contains has been inlined.
3. The interface of ares_strsplit has been simplified by removing the
parameter make_set since in practice it was always 1.
4. There are fewer passes over the input string.
5. We resize the table using realloc() down to its minimum size.
6. The docstring of ares_strsplit is updated and also a couple typos
are fixed.
There occurs a single use of ares_strsplit and since the make_set
parameter has been removed, the call in ares_init.c is modified
accordingly. The unit test for ares_strsplit is also updated.
Fix By: Nikolaos Chatzikonstantinou (@createyourpersonalaccount)
bradh352 (23 Oct 2022)
- CirrusCI: update freebsd image
Old FreeBSD image for CirrusCI has issues with newer symbols, update to later one.
Fix By: Brad House (@bradh352)
GitHub (23 Oct 2022)
- [Stephen Sachs brought this change]
Fix Intel compiler deprecated options (#485)
Options `-we ###` and `-wd ###` should not include a whitespace. They are also deprecated and `-diag-error` and `-diag-disable` are their replacements.
Intel compiler 2021.6 is not able to be used in configure without the proposed patch.
Fix By: Stephen Sachs (@stephenmsachs)
- [Jonathan Ringer brought this change]
Allow for CMake to use absolute install paths (#486)
Generated libcares.pc could have bad paths when using absolute paths.
Fix By: Jonathan Ringer (@jonringer)
- [Thomas Dreibholz brought this change]
Fix for issue #488: ensure that the number of iovec entries does not exceed system limits. (#489)
c-ares could try to exceed maximum number of iovec entries supported by system.
Fix By: Thomas Dreibholz (@dreibh)
- [bsergean brought this change]
Add include guards to ares_data.h (#491)
All the other header files in the src/lib folder do have an include guard so it look like an overthought.
Fix By: @bsergean
- [Brad Spencer brought this change]
Fix typo in docs for ares_process_fd (#490)
A single letter was missing
Fix By: Brad Spencer (@b-spencer)
- [lifenjoiner brought this change]
tools: refine help (#481)
fix invalid help options and documentation typos
Fix By: @lifenjoiner
- [lifenjoiner brought this change]
Git: ignore CMake temporary files (#480)
exclude more files from git
Fix By: @lifenjoiner
- [lifenjoiner brought this change]
adig: fix `-T` option (#479)
Helper was missing flag to enable TCP mode of operation.
Fix By: @lifenjoiner
- [Frank brought this change]
Add vcpkg installation instructions (#478)
Update to include vcpkg installation instructions
Fix By: @FrankXie05
- [marc-groundctl brought this change]
Convert total timeout to per-query (#467)
On Apple platforms, libresolv reports the total timeout in retrans, not the per-query time. This patch undoes that math to get the per-query time, which is what c-ares expects. This is not perfect because libresolv is inconsistent on whether the timeout is multiplied by retry or retry+1, but I don't see any way to distinguish these cases.
Fix By: Marc Aldorasi (@marc-groundctl)
- [marc-groundctl brought this change]
Don't include version info in the static library (#468)
The static library should not contain version info, since it would be linked into an executable or dll with its own version info.
Fix By: @marc-groundctl
- [Ridge Kennedy brought this change]
Fix ares_getaddrinfo() numerical address fast path with AF_UNSPEC (#469)
The conversion of numeric IPv4 addresses in fake_addrinfo() is broken when
the family is AF_UNSPEC. The initial call to ares_inet_pton with AF_INET
will succeed, but the subsequent call using AF_INET6 will fail. This results
in the fake_addrinfo() fast path failing, and ares_getaddrinfo() making a
query when none should be required.
Resolve this by only attempting the call to ares_inet_pton with AF_INET6
if the initial call with AF_INET was unsuccessful.
Fix By: Ridge Kennedy (@ridgek)
- [Manish Mehra brought this change]
Configurable hosts path for file_lookup (#465)
This changeset adds support for configurable hosts file
ARES_OPT_HOSTS_FILE (similar to ARES_OPT_RESOLVCONF).
Co-authored-by: Manish Mehra (@mmehra)
bradh352 (27 Apr 2022)
- CMake: Windows DLLs lack version information
The cares.rc was not included in the build for CMake. Conditionally
add it when building for Windows.
Fix By: Brad House (@bradh352)
Fixes Bug: #460
GitHub (27 Apr 2022)
- [Kai Pastor brought this change]
CMake: Guard target creation in exported config (#464)
User projects may call 'find_package(c-ares)' multiple times (e.g.
via dependencies), but targets must be created only once.
Shared and static target must be treated independently.
Fix By: Kai Pastor (@dg0yt)
bradh352 (27 Apr 2022)
- Honor valid DNS result even if other class returned an error
When using ares_getaddrinfo() with PF_UNSPEC, if a DNS server returned
good data on an A record, followed by bad data on an AAAA record, the
good record would be thrown away and an error returned.
If we got a good response from one of the two queries, regardless of
the order returned, we should honor that.
Fix By: Dmitry Karpov (dkarpov@roku.com)
Signed Off By: Brad House (@bradh352)
GitHub (2 Apr 2022)
- [Sam James brought this change]
configure.ac: fix STDC_HEADERS typo (#459)
There is no autoconf macro called STDC_HEADERS. AC_HEADER_STDC however does
exist and it defines the STDC_HEADERS macro for use.
Not clear that STDC_HEADERS from its use in the repo is needed but
would rather not meddle with it for now.
Fixes an annoying warning on `./configure`:
```
/var/tmp/portage/net-dns/c-ares-1.18.1/work/c-ares-1.18.1/configure: 24546: STDC_HEADERS: not found
```
Signed-off-by: Sam James <sam@gentoo.org>
bradh352 (2 Mar 2022)
- Asterisks should be allowed in host validation as CNAMEs may reference wildcard domains
CloudFlare appears to use this logic in CNAMEs as per
https://github.com/nodejs/node/issues/42171
Fixes: #457
Fix By: Brad House (@bradh352)
- Don't return on file lookup failure, set status
When resolving a host via /etc/hosts, don't return with a predefined
error as there may be other tries.
Fix By: Brad House (@bradh352)
- 'localhost' special treatment enhancement
Since localhost is special-cased, any errors should be ignored when
reading /etc/hosts as otherwise we could return an error if there
were for instance an invalidly formatted /etc/hosts or if /etc/hosts
had a permissions error while reading.
This exact behavior appears to have been seen on OS/400 PASE
environments which allows AIX binares to run.
Fix By: Brad House (@bradh352)
- If chain building c-ares as part of another project, detect of res_servicename could fail (#451)
If libresolv is already included with the build, c-ares wouldn't properly detect its use.
May fix: #451
Fix by: Brad House (@bradh352)
- no analyze capability on ios
- attempt to use scan-build on ios
- disable tests on ios
- fix switch statement
- code coverage had gotten disabled
- looks like shell expansion doesn't work with cirrus-ci, lets do it another way
- attempt to autobuild for iOS
GitHub (8 Dec 2021)
- [Brad House brought this change]
Windows: rework/simplify initialization code, drop long EOL systems (#445)
There was a lot of windows initialization code specific to the era that predates Windows Vista such as reading DNS configuration from the registry, and dynamically loading libraries to get access to functions that didn't exist in XP or earlier releases.
Vista was released in January 2007, and was EOL'd in 2017, and support for Vista is still maintained with this patch set.
XP was EOL'd in Apr 8 2014.
I believe the last OS based on something earlier than Vista was POSReady 2009, as it was XP based for some reason, and that was EOL'd in January 2019. Considering any POS system falls under the PCI-DSS rules, they aren't allow to run POSReady 2009 any more so there is no reason to try to continue supporting such systems.
We have also targeted with our build system Vista support for the last few years, and while developers could change the target, we haven't had any reports that they have.
bradh352 (9 Nov 2021)
- Fix memory leak in reading /etc/hosts
When an /etc/hosts lookup is performed, but fails with ENOTFOUND, and
a valid RFC6761 Section 6.3 fallback is performed, it could overwrite
variables that were already set and therefore leave the pointers
dangling, never to be cleaned up.
Clean up explicitly on ENOTFOUND when returning from the file parser.
Fixes: #439
Fix By: Brad House (@bradh352)
GitHub (2 Nov 2021)
- [Bobby Reynolds brought this change]
Fix cross-compilation from Windows to Linux due to CPACK logic (#436)
When determining value for CPACK_PACKAGE_ARCHITECTURE, prefer to use
value from CMAKE_SYSTEM_PROCESSOR before falling back to uname output.
Additionally, if building from a Windows host, emit a fatal error
instead of attempting to call uname.
Fix By: Bobby Reynolds (@reynoldsbd)
bradh352 (1 Nov 2021)
- fix coveralls link
- coveralls needs token
- coveralls appears to require git
- fix a couple of coveralls vars
- more coveralls fixes
- add code coverage libs to LDADD instead of _LIBS
- make verbose
- try to fix code coverage building
- need -y for install
- try to fix asan/ubsan/lsan when built with clang. try to support code coverage properly.
- try another path
- fix pip
- attempt to enable some other build types that travis supported
Version 1.18.1 (26 Oct 2021)
bradh352 (26 Oct 2021)
- missed version
- 1.18.1 release prep
- ares_getaddrinfo() was returning the wrong size for ai_addrlen
ai_addrlen was erroneously returning 16 bytes instead of the
sizeof(struct sockaddr_in6). This is a regression introduced
in 1.18.0.
Reported by: James Brown <jbrown@easypost.com>
Fix By: Brad House (@bradh352)
- Windows: autotools force linking to iphlpapi
GitHub (26 Oct 2021)
- [Gregor Jasny brought this change]
Fix typo detected by lintian (#434)
typo in docs for ares_parse_uri_reply
Fix By: Gregor Jasny (@gjasny)
Version 1.18.0 (25 Oct 2021)
bradh352 (25 Oct 2021)
- replace Travis badge with Cirrus-CI badge
- c-ares 1.18.0 release prep
GitHub (21 Oct 2021)
- [Jérôme Duval brought this change]
Haiku: port (#431)
Port for Haiku. Slight CMake changes, header changes, and resolv.conf/hosts paths specific to Haiku.
Port By: Jérôme Duval (@korli)
bradh352 (19 Oct 2021)
- valgrind: fix reported invalid read
- make sure distcheck runs
- detect oddities and skip test if necessary
- fix null ptr deref in strlen
- bend over backwards for testing file access, something is weird on debian
- chmod(fn, 0) is failing on debian
- maybe process needs to be called
- split test output
- clean up a couple of compiler warnings
- use helper function for addrinfo to simplify code
- INSTANTIATE_TEST_CASE_P -> INSTANTIATE_TEST_SUITE_P as new convention in googletest
- gmock: update from 1.8.0 to 1.11.0
- Cirrus-CI: fix debian arm build
- Cirrus-CI: more updates for proper testing
- install proper packages for asan and analyze
- fix crash in tests
- try to disable container tests
- need g++ for tests on debian
- try cirrus-ci again
- whitespace
- start bringing up cirrus-ci
- prep for adding new ci
- fix cut and paste error
GitHub (18 Oct 2021)
- [Brad House brought this change]
RFC6761: special case "localhost" (#430)
As per RFC6761 Section 6.3, "localhost" lookups need to be special cased to return loopback addresses, and not forward queries to recursive dns servers.
We first look up via files (/etc/hosts or equivalent), and if that fails, we then attempt a system-specific address enumeration for loopback addresses (currently Windows-only), and finally fallback to ::1 and 127.0.0.1.
Fix By: Brad House (@bradh352)
Fixes Bug: #399
- [Brad House brought this change]
Reimplement ares_gethostbyname() by wrapping ares_getaddrinfo() (#428)
ares_gethostbyname() and ares_getaddrinfo() do a lot of similar things, however ares_getaddrinfo() has some desirable behaviors that should be imported into ares_gethostbyname(). For one, it sorts the address lists for the most likely to succeed based on the current system routes. Next, when AF_UNSPEC is specified, it properly handles search lists instead of first searching all of AF_INET6 then AF_INET, since ares_gethostbyname() searches in parallel. Therefore, this PR should also resolve the issues attempted in #94.
A few things this PR does:
1. ares_parse_a_reply() and ares_parse_aaaa_reply() had very similar code to translate struct ares_addrinfo into a struct hostent as well as into struct ares_addrttl/ares_addr6ttl this has been split out into helper functions of ares__addrinfo2hostent() and ares__addrinfo2addrttl() to prevent this duplicative code.