1 # Copyright (C) Internet Systems Consortium, Inc. ("ISC") 2 # 3 # SPDX-License-Identifier: MPL-2.0 4 # 5 # This Source Code Form is subject to the terms of the Mozilla Public 6 # License, v. 2.0. If a copy of the MPL was not distributed with this 7 # file, you can obtain one at https://mozilla.org/MPL/2.0/. 8 # 9 # See the COPYRIGHT file distributed with this work for additional 10 # information regarding copyright ownership. 11 12 import time 13 14 import isctest 15 16 17 def test_expiredglue(ns4): 18 msg1 = isctest.query.create("a.example.tld.", "A") 19 res1 = isctest.query.udp(msg1, ns4.ip) 20 isctest.check.noerror(res1) 21 isctest.check.rr_count_eq(res1.answer, 1) 22 23 msg2 = isctest.query.create("a.dnshoster.tld.", "A") 24 res2 = isctest.query.udp(msg2, ns4.ip) 25 isctest.check.rr_count_eq(res2.answer, 1) 26 27 msg3 = isctest.query.create("ns.dnshoster.tld.", "A") 28 res3 = isctest.query.udp(msg3, ns4.ip) 29 isctest.check.rr_count_eq(res3.answer, 1) 30 31 time.sleep(3) 32 33 # Even if the glue is expired but the delegation is not, named 34 # is able to "recover" by looking up the hints again and does 35 # not bails out with a fetch loop detection. 36 res1_2 = isctest.query.udp(msg1, ns4.ip) 37 isctest.check.same_data(res1_2, res1) 38 39 time.sleep(3) 40 res2_2 = isctest.query.udp(msg2, ns4.ip) 41 isctest.check.same_data(res2_2, res2) 42 43 time.sleep(3) 44 res3_2 = isctest.query.udp(msg3, ns4.ip) 45 isctest.check.same_data(res3_2, res3) 46 47 48 def test_loopdetected(ns4): 49 msg = isctest.query.create("a.missing.tld.", "A") 50 with ns4.watch_log_from_here() as watcher: 51 res = isctest.query.udp(msg, ns4.ip) 52 53 # However, this is a valid fetch loop, and named detects it. 54 watcher.wait_for_line("loop detected resolving 'ns.missing.tld/A'") 55 isctest.check.servfail(res) 56