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