Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a function to parse a srv reply with ttl #393

Closed
wants to merge 51 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
7a26cb6
add a function to parse a srv reply with ttl
kylebevans Jan 25, 2021
4c9f2b6
remove print statements
kylebevans Jan 25, 2021
ab66778
make ares_parse_srv_reply a wrapper for cares_parse_srv_reply
kylebevans Jan 30, 2021
73d8bf5
return const char* from cares_srv_reply_get_host
kylebevans Jan 30, 2021
eb34dbe
use ares_strdup in ares_parse_srv_reply to copy host string
kylebevans Jan 31, 2021
a86be7e
add new structs and parse functions to support TTL for these RRs:
kylebevans Mar 10, 2021
ce230f7
check hostent->h_addr_list[0] before free
kylebevans Mar 10, 2021
7078113
Merge branch 'master' into kylebevans-ttl
kylebevans Mar 10, 2021
3d06d06
fix loop off by one for freeing h_aliases
kylebevans Mar 10, 2021
a6c585c
modify ptr parsing to use the last hostname as h_name
kylebevans Mar 11, 2021
b55ccb9
use ptr_curr instead of ptr_out to get h_name
kylebevans Mar 11, 2021
08de712
fix memory leaks
kylebevans Mar 13, 2021
7eae6d8
remove debug prints and fix unrelated Container test leak
kylebevans Mar 13, 2021
a82fed6
Merge branch 'main' into kylebevans-ttl
kylebevans Nov 7, 2021
3179732
406 - Validate hostnames in DNS responses
kylebevans Nov 7, 2021
1e03b81
fix a missed a conflict in ares.h
kylebevans Nov 7, 2021
d36bec7
add is_hostname parameter back in one spot
kylebevans Nov 7, 2021
2814894
change struct cares_ to just cares_ for declarations
kylebevans Nov 7, 2021
7fcb191
change ttl in ares_uri_reply to be unsigned int
kylebevans Nov 7, 2021
487d072
change ARES_DATATYPE_C prefix to CARES_DATATYPE_ prefix
kylebevans Nov 7, 2021
97143cc
return const from cares_get_next functions
kylebevans Nov 12, 2021
699a9cd
create cares_memdup function as sugar for malloc/memcpy pattern
kylebevans Nov 12, 2021
3286a5d
save progress
kylebevans Dec 29, 2021
aed6a71
save progress
kylebevans Dec 29, 2021
baf30b8
save progress
kylebevans Dec 30, 2021
6983bc3
add free routine for container
kylebevans Dec 30, 2021
39c8e55
add malloc routine for container
kylebevans Dec 31, 2021
385a3fe
change cares_parse_srv_reply to use container
kylebevans Dec 31, 2021
697b9fd
change ares_parse_srv_reply to use container
kylebevans Dec 31, 2021
de092f3
fix errors and warnings
kylebevans Dec 31, 2021
9583762
fix errors and warnings
kylebevans Dec 31, 2021
e22efd5
add debugging
kylebevans Jan 1, 2022
f349105
fix crashes and add debugging
kylebevans Jan 2, 2022
867e3f7
fix crashes
kylebevans Jan 2, 2022
0f5ba50
remove print statements
kylebevans Jan 2, 2022
9268be0
Add build/test instructions for asan
kylebevans Jan 2, 2022
13aec44
update build/test instructions for asan
kylebevans Jan 2, 2022
86daca3
update build/test instructions for asan
kylebevans Jan 2, 2022
9f7b8b9
update build/test instructions for asan
kylebevans Jan 2, 2022
487cb0c
attempt to fix leak
kylebevans Jan 2, 2022
84d87cb
attempt to fix leak
kylebevans Jan 2, 2022
f131cf2
add missing break statement
kylebevans Jan 2, 2022
8bca0fa
free srv_host on error
kylebevans Jan 2, 2022
979f715
add debugging
kylebevans Jan 2, 2022
183a999
fix leak if no srv rr type
kylebevans Jan 3, 2022
e247b6e
add fuzzing loop instrution
kylebevans Jan 3, 2022
e1bb47d
fix typo for cares_free_container.h
kylebevans Jan 3, 2022
73248f7
remove debugging print statements
kylebevans Jan 3, 2022
337db1d
Update instructions for lsan
kylebevans Jan 4, 2022
be37e6a
Update instructions for lsan
kylebevans Jan 4, 2022
e82ff03
change srv to csrv
kylebevans Jan 4, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@ CHANGES.dist
c-ares-*.tar.gz.asc
ares_parse_mx_reply.pdf
/[0-9]*.patch
.dirstamp
build
29 changes: 29 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,32 @@ To improve the chances of the c-ares maintainers responding to your request:

- Also send an email to the mailing list at `[email protected]` describing your change.
- To follow any associated discussion, please subscribe to the [mailing list](http://lists.haxx.se/listinfo/c-ares).

To build locally with asan:
```
export BUILD_TYPE=asan
export CFLAGS=-fsanitize=address
export CXXFLAGS=-fsanitize=address
export LDFLAGS=-fsanitize=address
autoreconf -fi
./configure --disable-symbol-hiding --enable-expose-statics --enable-maintainer-mode --enable-debug
make
ASAN_OPTIONS=detect_leaks=1 test/arestest --gtest_filter='-*.Live*'
for file in $(ls test/fuzzinput); do echo "$file"; test/aresfuzz "test/fuzzinput/$file"; done
```

To build locally with ubsan, same instructions as asan but switch out BUILD_TYPE, CFLAGS, CXXFLAGS, and LDFLAGS:
```
export BUILD_TYPE=ubsan
export CFLAGS=-fsanitize=undefined -fno-sanitize-recover
export CXXFLAGS=-fsanitize=undefined -fno-sanitize-recover
export LDFLAGS=CFLAGS=-fsanitize=undefined
```

To build locally with lsan, same instructions as asan but switch out BUILD_TYPE, CFLAGS, CXXFLAGS, and LDFLAGS:
```
export BUILD_TYPE=lsan
export CFLAGS=-fsanitize=leak
export CXXFLAGS=-fsanitize=leak
export LDFLAGS=-fsanitize=leak
```
126 changes: 126 additions & 0 deletions aminclude_static.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@

# aminclude_static.am generated automatically by Autoconf
# from AX_AM_MACROS_STATIC on Sun Jan 2 13:41:56 EST 2022


# Code coverage
#
# Optional:
# - CODE_COVERAGE_DIRECTORY: Top-level directory for code coverage reporting.
# Multiple directories may be specified, separated by whitespace.
# (Default: $(top_builddir))
# - CODE_COVERAGE_OUTPUT_FILE: Filename and path for the .info file generated
# by lcov for code coverage. (Default:
# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info)
# - CODE_COVERAGE_OUTPUT_DIRECTORY: Directory for generated code coverage
# reports to be created. (Default:
# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage)
# - CODE_COVERAGE_BRANCH_COVERAGE: Set to 1 to enforce branch coverage,
# set to 0 to disable it and leave empty to stay with the default.
# (Default: empty)
# - CODE_COVERAGE_LCOV_SHOPTS_DEFAULT: Extra options shared between both lcov
# instances. (Default: based on )
# - CODE_COVERAGE_LCOV_SHOPTS: Extra options to shared between both lcov
# instances. (Default: )
# - CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH: --gcov-tool pathtogcov
# - CODE_COVERAGE_LCOV_OPTIONS_DEFAULT: Extra options to pass to the
# collecting lcov instance. (Default: )
# - CODE_COVERAGE_LCOV_OPTIONS: Extra options to pass to the collecting lcov
# instance. (Default: )
# - CODE_COVERAGE_LCOV_RMOPTS_DEFAULT: Extra options to pass to the filtering
# lcov instance. (Default: empty)
# - CODE_COVERAGE_LCOV_RMOPTS: Extra options to pass to the filtering lcov
# instance. (Default: )
# - CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT: Extra options to pass to the
# genhtml instance. (Default: based on )
# - CODE_COVERAGE_GENHTML_OPTIONS: Extra options to pass to the genhtml
# instance. (Default: )
# - CODE_COVERAGE_IGNORE_PATTERN: Extra glob pattern of files to ignore
#
# The generated report will be titled using the $(PACKAGE_NAME) and
# $(PACKAGE_VERSION). In order to add the current git hash to the title,
# use the git-version-gen script, available online.
# Optional variables
# run only on top dir
if CODE_COVERAGE_ENABLED
ifeq ($(abs_builddir), $(abs_top_builddir))
CODE_COVERAGE_DIRECTORY ?= $(top_builddir)
CODE_COVERAGE_OUTPUT_FILE ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info
CODE_COVERAGE_OUTPUT_DIRECTORY ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage

CODE_COVERAGE_BRANCH_COVERAGE ?=
CODE_COVERAGE_LCOV_SHOPTS_DEFAULT ?= $(if $(CODE_COVERAGE_BRANCH_COVERAGE),--rc lcov_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE))
CODE_COVERAGE_LCOV_SHOPTS ?= $(CODE_COVERAGE_LCOV_SHOPTS_DEFAULT)
CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH ?= --gcov-tool "$(GCOV)"
CODE_COVERAGE_LCOV_OPTIONS_DEFAULT ?= $(CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH)
CODE_COVERAGE_LCOV_OPTIONS ?= $(CODE_COVERAGE_LCOV_OPTIONS_DEFAULT)
CODE_COVERAGE_LCOV_RMOPTS_DEFAULT ?=
CODE_COVERAGE_LCOV_RMOPTS ?= $(CODE_COVERAGE_LCOV_RMOPTS_DEFAULT)
CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT ?=$(if $(CODE_COVERAGE_BRANCH_COVERAGE),--rc genhtml_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE))
CODE_COVERAGE_GENHTML_OPTIONS ?= $(CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT)
CODE_COVERAGE_IGNORE_PATTERN ?=

GITIGNOREFILES := $(GITIGNOREFILES) $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY)
code_coverage_v_lcov_cap = $(code_coverage_v_lcov_cap_$(V))
code_coverage_v_lcov_cap_ = $(code_coverage_v_lcov_cap_$(AM_DEFAULT_VERBOSITY))
code_coverage_v_lcov_cap_0 = @echo " LCOV --capture" $(CODE_COVERAGE_OUTPUT_FILE);
code_coverage_v_lcov_ign = $(code_coverage_v_lcov_ign_$(V))
code_coverage_v_lcov_ign_ = $(code_coverage_v_lcov_ign_$(AM_DEFAULT_VERBOSITY))
code_coverage_v_lcov_ign_0 = @echo " LCOV --remove /tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN);
code_coverage_v_genhtml = $(code_coverage_v_genhtml_$(V))
code_coverage_v_genhtml_ = $(code_coverage_v_genhtml_$(AM_DEFAULT_VERBOSITY))
code_coverage_v_genhtml_0 = @echo " GEN " "$(CODE_COVERAGE_OUTPUT_DIRECTORY)";
code_coverage_quiet = $(code_coverage_quiet_$(V))
code_coverage_quiet_ = $(code_coverage_quiet_$(AM_DEFAULT_VERBOSITY))
code_coverage_quiet_0 = --quiet

# sanitizes the test-name: replaces with underscores: dashes and dots
code_coverage_sanitize = $(subst -,_,$(subst .,_,$(1)))

# Use recursive makes in order to ignore errors during check
check-code-coverage:
-$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -k check
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) code-coverage-capture

# Capture code coverage data
code-coverage-capture: code-coverage-capture-hook
$(code_coverage_v_lcov_cap)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(call code_coverage_sanitize,$(PACKAGE_NAME)-$(PACKAGE_VERSION))" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_OPTIONS)
$(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_RMOPTS)
-@rm -f "$(CODE_COVERAGE_OUTPUT_FILE).tmp"
$(code_coverage_v_genhtml)LANG=C $(GENHTML) $(code_coverage_quiet) $(addprefix --prefix ,$(CODE_COVERAGE_DIRECTORY)) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS)
@echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html"

code-coverage-clean:
-$(LCOV) --directory $(top_builddir) -z
-rm -rf "$(CODE_COVERAGE_OUTPUT_FILE)" "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "$(CODE_COVERAGE_OUTPUT_DIRECTORY)"
-find . \( -name "*.gcda" -o -name "*.gcno" -o -name "*.gcov" \) -delete

code-coverage-dist-clean:

AM_DISTCHECK_CONFIGURE_FLAGS := $(AM_DISTCHECK_CONFIGURE_FLAGS) --disable-code-coverage
else # ifneq ($(abs_builddir), $(abs_top_builddir))
check-code-coverage:

code-coverage-capture: code-coverage-capture-hook

code-coverage-clean:

code-coverage-dist-clean:
endif # ifeq ($(abs_builddir), $(abs_top_builddir))
else #! CODE_COVERAGE_ENABLED
# Use recursive makes in order to ignore errors during check
check-code-coverage:
@echo "Need to reconfigure with --enable-code-coverage"
# Capture code coverage data
code-coverage-capture: code-coverage-capture-hook
@echo "Need to reconfigure with --enable-code-coverage"

code-coverage-clean:

code-coverage-dist-clean:

endif #CODE_COVERAGE_ENABLED
# Hook rule executed before code-coverage-capture, overridable by the user
code-coverage-capture-hook:

.PHONY: check-code-coverage code-coverage-capture code-coverage-dist-clean code-coverage-clean code-coverage-capture-hook
Loading