1
0
mirror of https://git.openwrt.org/feed/packages.git synced 2024-06-14 11:23:57 +02:00
openwrt-packages/utils/cache-domains/files/test.sh
Gerard Ryan 104bfa71a9 cache-domains: Fixed config files being outside of jail
This fix dnsmasq failing to startup once configured since the
cache-domains config files are not included in the jail that dnsmasq
runs inside.

Signed-off-by: Gerard Ryan <G.M0N3Y.2503@gmail.com>
2023-09-05 19:23:07 +10:00

52 lines
1.3 KiB
Bash

#! /bin/sh
set -o errexit
test_url() {
echo "INFO: Testing '${2}' has ${1} addresses" >&2
case "${1}" in
IPv4)
nslookup -type=a "${2}"
;;
IPv6)
nslookup -type=aaaa "${2}"
;;
*)
echo "ERROR: Unknown IP version: ${1}" >&2
exit 1
;;
esac
}
cache_domains() {
echo "INFO: cache-domains ${1}" >&2
cache-domains "${1}"
sleep 5
}
cache_domains cleanup
test_url IPv4 lancache.steamcontent.com | grep -q 'canonical name ='
test_url IPv6 lancache.steamcontent.com | grep -q 'canonical name ='
test_url IPv4 dist.blizzard.com | grep -q 'canonical name ='
test_url IPv6 dist.blizzard.com | grep -q 'canonical name ='
cache_domains configure
test_url IPv4 lancache.steamcontent.com | grep -q '10.10.3.10'
test_url IPv4 lancache.steamcontent.com | grep -q '10.10.3.11'
test_url IPv6 lancache.steamcontent.com > /dev/null # None configured
test_url IPv4 dist.blizzard.com | grep -q '10.10.3.13'
test_url IPv6 dist.blizzard.com > /dev/null # None configured
cache_domains cleanup
test_url IPv4 lancache.steamcontent.com | grep -q 'canonical name ='
test_url IPv6 lancache.steamcontent.com | grep -q 'canonical name ='
test_url IPv4 dist.blizzard.com | grep -q 'canonical name ='
test_url IPv6 dist.blizzard.com | grep -q 'canonical name ='