• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

c-ares / c-ares / #645
92%

Build:
DEFAULT BRANCH: main
Ran 22 Feb 2024 06:41PM UTC
Jobs 1
Files 153
Run time 13s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

22 Feb 2024 06:34PM UTC coverage: 80.758% (+0.04%) from 80.715%
#645

push

travis-ci

web-flow
Add flag to not use a default local named server on channel initialization (#713)

Hello, I work on an application for Microsoft which uses c-ares to
perform DNS lookups. We have made some minor changes to the library over
time, and would like to contribute these back to the project in case
they are useful more widely. This PR adds a new channel init flag,
described below.

Please let me know if I can include any more information to make this PR
better/easier for you to review. Thanks!

**Summary**
When initializing a channel with `ares_init_options()`, if there are no
nameservers available (because `ARES_OPT_SERVERS` is not used and
`/etc/resolv.conf` is either empty or not available) then a default
local named server will be added to the channel.

However in some applications a local named server will never be
available. In this case, all subsequent queries on the channel will
fail.

If we know this ahead of time, then it may be preferred to fail channel
initialization directly rather than wait for the queries to fail. This
gives better visibility, since we know that the failure is due to
missing servers rather than something going wrong with the queries.

This PR adds a new flag `ARES_FLAG_NO_DFLT_SVR`, to indicate that a
default local named server should not be added to a channel in this
scenario. Instead, a new error `ARES_EINITNOSERVER` is returned and
initialization fails.

**Testing**
I have added 2 new FV tests:
- `ContainerNoDfltSvrEmptyInit` to test that initialization fails when
no nameservers are available and the flag is set.
- `ContainerNoDfltSvrFullInit` to test that initialization still
succeeds when the flag is set but other nameservers are available.

Existing FVs are all passing.

**Documentation**
I have had a go at manually updating the docs to describe the new
flag/error, but couldn't see any contributing guidance about testing
this. Please let me know if you'd like anything more here.
... (continued)

8209 of 10165 relevant lines covered (80.76%)

3219.63 hits per line

Jobs
ID Job ID Ran Files Coverage
1 #645.1 22 Feb 2024 06:41PM UTC 0
80.76
Source Files on build #645
Detailed source file information is not available for this build.
  • Back to Repo
  • 035c4c37 on github
  • Prev Build on main
  • Next Build on main
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc