dump_cache strange format for PTR

Stephane Bortzmeyer bortzmeyer at nic.fr
Sat Sep 17 09:56:33 UTC 2016


On Fri, Sep 16, 2016 at 06:59:52PM +0200,
 W.C.A. Wijngaards via Unbound-users <unbound-users at unbound.net> wrote 
 a message of 93 lines which said:

> Your script is picking up the wrong parts as RRs.  The other lines
> are part of the message cache dump.

OK, I never noticed there are two sections. Any way to dump only one?

> Look for these marker lines through the cachedump (perhaps with
> csplit(1)?)

My initial goal was to find a specific pattern in the RR cache. This
seems to work, thanks for the help:

findincache() {
    if [ -z "$1" ]; then
	echo "Usage: findincache PATTERN"
	return 1
    fi
    pat="$1"
    TMP=$(mktemp -d)
    cur="$(pwd)"
    cd "$TMP"
    sudo unbound-control dump_cache | csplit - /END_RRSET_CACHE/ > /dev/null
    egrep "$pat" xx00
    cd "$cur"
    rm -rf $TMP
}

% findincache nlnetlabs |head -n 2
nlnetlabs.nl. 10149	IN    NS ns.nlnetlabs.nl.
nlnetlabs.nl. 10149	IN    NS sec2.authdns.ripe.net.

% findincache 'renater\.fr\.\s+[0-9]+\s+IN\s+AAAA'
ns1.renater.fr.	15	IN	AAAA	2001:660:3001:4002::2
ns2.renater.fr.	15	IN	AAAA	2001:660:3001:4002::9



More information about the Unbound-users mailing list