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

dump_cache truncates large records #981

Closed
ialexiad opened this issue Dec 14, 2023 · 0 comments · Fixed by #988
Closed

dump_cache truncates large records #981

ialexiad opened this issue Dec 14, 2023 · 0 comments · Fixed by #988

Comments

@ialexiad
Copy link

Describe the bug
When dumping the unbound cache, some large records are truncated and there is no newline between those and the next rrset entry, resulting in a corrupt dump file, that cannot be loaded back to unbound.

To reproduce
Steps to reproduce the behavior:

  1. Make a DNS request for a large entry, e.g. the TXT record for _p.3.1o586rh._u.taylorandfrancis.com._spf.smart.ondmarc.com. The answer currently is something like:
_p.3.1o586rh._u.taylorandfrancis.com._spf.smart.ondmarc.com.	86400	IN	TXT	"v=spf1 ip4:41.74.192.0/21 ip4:87.238.80.0/21 ip4:108.177.8.0/21 ip4:148.105.8.0/21 ip4:172.253.56.0/21 ip4:199.122.120.0/21 ip4:13.110.216.0/22 ip4:52.82.172.0/22 ip4:130.211.0.0/22 ip4:199.127.232.0/22 ip4:199.255.192.0/22 ip4:41.74.200.0/23 ip4:41.74." "204.0/23 ip4:64.132.88.0/23 ip4:69.63.150.0/23 ip4:159.92.154.0/23 ip4:159.92.158.0/23 ip4:170.10.128.0/23 ip4:35.190.247.0/24 ip4:41.74.206.0/24 ip4:51.163.158.0/24 ip4:62.140.7.0/24 ip4:63.128.21.0/24 ip4:64.132.92.0/24 ip4:70.33.179.0/24 ip4:91.220.4" "2.0/24 ip4:103.13.69.0/24 ip4:103.96.21.0/24 ip4:103.96.23.0/24 ip4:124.47.150.0/24 ip4:124.47.189.0/24 ip4:146.101.78.0/24 ip4:147.28.36.0/24 ip4:159.92.157.0/24 ip4:170.10.133.0/24 ip4:176.32.105.0/24 ip4:176.32.127.0/24 ip4:180.189.28.0/24 ip4:185.58" ".85.0/24 ip4:185.58.86.0/24 ip4:192.69.130.0/24 ip4:194.104.109.0/24 ip4:194.104.111.0/24 ip4:195.130.217.0/24 ip4:203.81.17.0/24 ip4:205.139.110.0/24 ip4:207.67.38.0/24 ip4:207.82.80.0/24 ip4:207.250.68.0/24 ip4:212.11.79.0/24 ip4:216.145.217.0/24 ip4:" "216.145.221.0/24 ip4:216.205.24.0/24 include:_p.4.1o586rh._u.taylorandfrancis.com._spf.smart.ondmarc.com ~all"
  1. Dump the unbound cache to a file and look for the rrset for _p.3.1o586rh._u.taylorandfrancis.com._spf.smart.ondmarc.com. . The entry will be truncated with the next ;rrset appended to it, like:
;rrset 84568 1 0 8 2
_p.3.1o586rh._u.taylorandfrancis.com._spf.smart.ondmarc.com.    84568   IN      TXT     "v=spf1 ip4:41.74.192.0/21 ip4:87.238.80.0/21 ip4:108.177.8.0/21 ip4:148.105.8.0/21 ip4:172.253.56.0/21 ip4:199.122.120.0/21 ip4:13.110.216.0/22 ip4:52.82.172.0/22 ip4:130.211.0.0/22 ip4:199.127.232.0/22 ip4:199.255.192.0/22 ip4:41.74.200.0/23 ip4:41.74." "204.0/23 ip4:64.132.88.0/23 ip4:69.63.150.0/23 ip4:159.92.154.0/23 ip4:159.92.158.0/23 ip4:170.10.128.0/23 ip4:35.190.247.0/24 ip4:41.74.206.0/24 ip4:51.163.158.0/24 ip4:62.140.7.0/24 ip4:63.128.21.0/24 ip4:64.132.92.0/24 ip4:70.33.179.0/24 ip4:91.220.4" "2.0/24 ip4:103.13.69.0/24 ip4:103.96.21.0/24 ip4:103.96.23.0/24 ip4:124.47.150.0/24 ip4:124.47.189.0/24 ip4:146.101.78.0/24 ip4:147.28.36.0/24 ip4:159.92.157.0/24 ip4:170.10.133.0/24 ip4:176.32.105.0/24 ip4:176.32.127.0/24 ip4:180.189.28.0/24 ip4:185.58" ".85.0/24 ip4:185.58.86.0/24 ip4:192.69.130.0/24 ip4:194.104.109.0/24 ip4:194.104.111.0/24 ip4:195.130.217.0/24 ip4:203.81.17.0/24 ip4:205.139.110.0/24 ip4:207.67.38.0/24 ip4:207.82;rrset 84568 3 0 1 0
dion.ns.cloudflare.com. 84568   IN      AAAA    2606:4700:58::adf5:3b9c
dion.ns.cloudflare.com. 84568   IN      AAAA    2803:f800:50::6ca2:c19c
dion.ns.cloudflare.com. 84568   IN      AAAA    2a06:98c1:50::ac40:219c
  1. Attempting to load this cache file back into unbound, results in the following error messages:
unbound[22:0] warning: error expected ';rrset' but got dion.ns.cloudflare.com.     84568      IN      AAAA    2606:4700:58::adf5:3b9c
unbound-control[46:0] fatal error: could not recv: Connection reset by peer

System:

  • Unbound version: 1.19
  • OS: alpine linux 3.19 docker container
  • unbound -V output:
Version 1.19.0

Configure line: --build=x86_64-alpine-linux-musl --host=x86_64-alpine-linux-musl --prefix=/usr --sysconfdir=/etc --mandir=/usr/share/man --localstatedir=/var --with-username=unbound --with-run-dir= --with-pidfile= --with-rootkey-file=/usr/share/dnssec-root/trusted-key.key --with-libevent --with-pthreads --disable-static --disable-rpath --enable-dnstap --with-ssl --without-pythonmodule --with-pyunbound
Linked libs: libevent 2.1.12-stable (it uses epoll), OpenSSL 3.1.4 24 Oct 2023
Linked modules: dns64 respip validator iterator
dyunwei pushed a commit to dyunwei/unbound that referenced this issue Jan 9, 2024
dyunwei pushed a commit to dyunwei/unbound that referenced this issue Jan 9, 2024
@wcawijngaards wcawijngaards linked a pull request Jan 9, 2024 that will close this issue
wcawijngaards added a commit that referenced this issue Jan 9, 2024
Fix #981: dump_cache truncates large records.
wcawijngaards added a commit that referenced this issue Jan 9, 2024
- Merge #988: Fix #981: dump_cache truncates large records.
jedisct1 added a commit to jedisct1/unbound that referenced this issue Jan 14, 2024
* nlnet/master:
  Changelog note for NLnetLabs#988. - Merge NLnetLabs#988: Fix NLnetLabs#981: dump_cache truncates large records.
  Fix NLnetLabs#981: dump_cache truncates large records.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant