Subject: CVS commit: pkgsrc/net/libcares
From: Thomas Klausner
Date: 2023-11-06 14:54:49
Message id: 20231106135449.8BD4CFA2C@cvs.NetBSD.org

Log Message:
libcares: update to 1.21.0.

Version 1.21.0 (26 Oct 2023)

Brad House (26 Oct 2023)
- SonarCloud: reduce reported complexity that exists for no reason.

- SonarCloud: fix some #undef codesmells

- formatting

- document ARES_RR_* records

- no reason to limit on truncation

- linguist fixes

- don't use test cases to determine language of c-ares

- fix grammar

- fix count

GitHub (25 Oct 2023)
- [Brad House brought this change]

  1.21.0 release prep (#585)

Brad House (25 Oct 2023)
- fix build warning

GitHub (25 Oct 2023)
- [Brad House brought this change]

  SonarCloud: clean up more codesmells (#584)

Brad House (25 Oct 2023)
- resolve reported memory leaks

- add test vector said to cause a memory leak

GitHub (25 Oct 2023)
- [Brad House brought this change]

  sonarcloud: fix more codesmells (#583)

- [Brad House brought this change]

  sonarcloud easy codesmells (#582)

  Fix By: Brad House (@bradh352)

- [Brad House brought this change]

  Modernization: replace multiple hand-parsers with new memory-safe parser (#581)

  New DNS record parsing code. The old code was basically just some helper \ 
macros and functions for parsing an entire DNS message. The caller had to know \ 
the RFCs to use the parsers, except for some pre-made exceptions. The new \ 
parsing code parses the entire DNS message into an opaque data structure in a \ 
memory safe manner with various accessors for reading and manipulating the data.

  The existing parser helpers for the various record types were reimplemented as \ 
wrappers around the new parser.

  The accessors allow easy iteration across the DNS record datastructure, and \ 
can be used to easily create dig-like output without needing to know anything \ 
about the various record types and formats as dynamic helpers are provided for \ 
enumeration of values and data types of those values.

  At some point in the future, this new DNS record structure, accessors, and \ 
parser will be exposed publicly. This is not done at this point as we don't want \ 
to do that until the API is completely stable. Likely a write() function to \ 
output the DNS record back into an actual message buffer will be introduced with \ 
the stable API as well.

  Some subtle bugs in the existing code were uncovered, some which had test \ 
cases which turned out to be bogus. Validation with third-party implementations \ 
(e.g. BIND9) were performed to validate such cases were indeed bugs.

  Adding additional RR parsers such as for TLSA (#470) or SVCB/HTTPS (#566) are \ 
trivial now since focus can be put on only parsing the data within the RR, not \ 
the entire message. That said, as the new parser is not yet public, it isn't \ 
clear the best way to expose any new RRs (probably best to wait for the new \ 
parser to be public rather than hacking in another legacy function).

  Some additional RRs that are part of DNS RFC1035 or EDNS RFC6891 that didn't \ 
have previously implemented parsers are now also implemented (e.g. HINFO, OPT). \ 
Any unrecognized RRs are encapsulated into a "RAW_RR" as binary data \ 
which can be inserted or extracted, but are otherwise not interpreted in any \ 
way.

  Fix By: Brad House (@bradh352)

- [Gregor Jasny brought this change]

  feat: use CMake to control symbol visibility (#574)

  In contrast to #572 this solution does not need any extra headers. But it is \ 
also limited to GCC-like compilers.

  Fix By: Gregor Jasny (@gjasny)

- [Brad House brought this change]

  remove ares_nowarn helpers #580

  Now that the code internally is using proper datatypes, there is no longer a \ 
need for ares_nowarn helpers. Remove them.

  Fix By: Brad House (@bradh352)

Brad House (16 Oct 2023)
- clang-format: fix structure alignment

  It appears the structure alignment chosen just doesn't work right.
  Switch to 'left', it appears to be mostly correct.

  Fix By: Brad House (@bradh352)

GitHub (15 Oct 2023)
- [Brad House brought this change]

  Reformat code using clang-format (#579)

  c-ares uses multiple code styles, standardize on one. Talking with @bagder he \ 
feels strongly about maintaining an 80 column limit, but feels less strongly \ 
about things I feel strongly about (like alignment).

  Can re-run the formatter on the codebase via:
  ```
  clang-format -i */*.c */*.h */*/*.c */*/*.h
  ```

  Fix By: Brad House (@bradh352)

Brad House (15 Oct 2023)
- inet_ntop requires ares_private.h

- SonarCloud: Fix additional code smells

  Fix By: Brad House (@bradh352)

- SonarCloud: Ignore codesmells c89 doesn't support

  C89 doesn't support iterator declaration in for loop, kill warning.

  Fix By: Brad House (@bradh352)

GitHub (15 Oct 2023)
- [Brad House brought this change]

  set compiler standard to ISO C90/ANSI C89 (#577)

  SonarCloud is outputting some code smells for things that aren't possible for \ 
C89. Hopefully setting the code standard to C89/C90 properly will fix those \ 
bogus warnings.

  Fix By: Brad House (@bradh352)

Brad House (15 Oct 2023)
- fix new ares_strcpy to ensure null termination

- build fix

GitHub (15 Oct 2023)
- [Brad House brought this change]

  SonarCloud: Fix up codesmells due to strlen(), strcpy(), and strncpy() (#576)

  Create ares_strlen() and ares_strcpy() in order to resolve SonarCloud \ 
codesmells related to their use.

  ares_strlen() just becomes null-safe.

  ares_strcpy() is equivalent to strlcpy(), so unlike strncpy() it guarantees \ 
NULL termination.

  Fix By: Brad House (@bradh352)

Brad House (15 Oct 2023)
- SonarCloud: try to appease it better

- SonarCloud: Fix reported bugs

  SonarCloud reported a few bugs, this commit should fix those reports.

  Fix By: Brad House (@bradh352)

GitHub (15 Oct 2023)
- [Brad House brought this change]

  Fix internal datatype usage and warnings (#573)

  PR #568 increased the warning levels and c-ares code emitted a bunch of \ 
warnings. This PR fixes those warnings and starts transitioning internal data \ 
types into more proper forms (e.g. data lengths should be size_t not int). It \ 
does, however, have to manually cast back to what the public API needs due to \ 
API and ABI compliance (we aren't looking to break integrations, just clean up \ 
internals).

  Fix By: Brad House (@bradh352)

Brad House (15 Oct 2023)
- SonarCloud: exclude tests

- fix source directories

GitHub (15 Oct 2023)
- [Brad House brought this change]

  Sonarcloud (#575)

- [Brad House brought this change]

  Increase compiler warnings by default (#568)

  c-ares was missing a couple of common compiler warnings during building that \ 
are widely recognized as a best practice. This PR makes no code changes, only \ 
build system changes to increase warning levels.

  This PR does cause some new warnings to be emitted, a follow-up PR will \ 
address those.

  Fix By: Brad House (@bradh352)

- [Brad House brought this change]

  introduce ares_bool_t datatype (#570)

  c-ares currently uses int for boolean, which can be confusing as there are \ 
some functions which return int but use '0' as the success condition. Some \ 
internal variable usage is similar. Lets try to identify the boolean use cases \ 
and split them out into their own data type of ares_bool_t. Since we're trying \ 
to keep C89 compatibility, we can't rely on stdbool.h or the _Bool C99 data \ 
type, so we'll define our own.

  Also, chose using an enum rather than say unsigned char or int because of the \ 
type safety benefits it provides. Compilers should warn if you try to pass, \ 
ARES_TRUE on to a ares_status_t enum (or similar) since they are different \ 
enums.

  Fix By: Brad House (@bradh352)

Brad House (12 Oct 2023)
- Socket callbacks were passed SOCK_STREAM instead of SOCK_DGRAM on udp

  A regression was introduced in 1.20.0 that would pass SOCK_STREAM on udp
  connections due to code refactoring.  If a client application validated this
  data, it could cause issues as seen in gRPC.

  Fixes Issue: #571
  Fix By: Brad House (@bradh352)

- Enhance test of ares_getsock()

  In an attempt to see if ares_getsock() was broken as per #571, do
  further sanity checks of the results of ares_getsock().  It seems
  as though ares_getsock() is fine.

  Fix By: Brad House (@bradh352)

GitHub (10 Oct 2023)
- [Brad House brought this change]

  Tool: STAYOPEN flag could make tools not terminate (#569)

  If a flag is set to keep the connections to the DNS servers open even if there \ 
are no queries, the tools would not exit until the remote server closed the \ 
connection due to the user of ares_fds() to determine if there are any active \ 
queries. Instead, rely on ares_timeout() returning NULL if there are no active \ 
queries (technically this returns the value passed to max_tv in ares_timeout(), \ 
but in our use case, that is always NULL).

  Fixes Issue: #452
  Fix By: Brad House (@bradh352)

- [Brad House brought this change]

  ares_status_t enum for status codes (#567)

  The list of possible error codes in c-ares was a #define list. This not only \ 
doesn't provide for any sort of type safety but it also lacks clarification on \ 
what a function may return or what it takes, as an int could be an ares status, \ 
a boolean, or possibly even a length in the current code.

  We are not changing any public APIs as though the C standard states the \ 
underlying size and type of an enum is int, there are compiler attributes to \ 
override this as well as compiler flags like -fshort-enums. GCC in particular is \ 
known to expand an enum's width based on the data values (e.g., it can emit a \ 
64bit integer enum).

  All internal usages should be changed by this PR, but of course, there may be \ 
some I missed.

  Fix By: Brad House (@bradh352)

Daniel Stenberg (9 Oct 2023)
- docs: provide better man page references

  When referring to another c-ares function use \fI function(3) \fP to let
  the webpage rendering find and cross-link them appropriately.

  SEE ALSO references should be ".BR name (3),", with a space before the
  open parenthesis. This helps the manpage to HTML renderer.

  Closes #565

Files:
RevisionActionfile
1.36modifypkgsrc/net/libcares/Makefile
1.20modifypkgsrc/net/libcares/PLIST
1.30modifypkgsrc/net/libcares/distinfo