Home | History | Annotate | Line # | Download | only in fwdfirst
      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 dns.name
     13  1.1  christos import dns.rdataclass
     14  1.1  christos import dns.rdatatype
     15  1.1  christos import pytest
     16  1.1  christos 
     17  1.1  christos from isctest.instance import NamedInstance
     18  1.1  christos 
     19  1.1  christos import isctest
     20  1.1  christos 
     21  1.1  christos 
     22  1.1  christos def _a_records(response, qname: str) -> set[str]:
     23  1.1  christos     rrset = response.get_rrset(
     24  1.1  christos         response.answer,
     25  1.1  christos         dns.name.from_text(qname),
     26  1.1  christos         dns.rdataclass.IN,
     27  1.1  christos         dns.rdatatype.A,
     28  1.1  christos     )
     29  1.1  christos     if rrset is None:
     30  1.1  christos         return set()
     31  1.1  christos     return {rdata.address for rdata in rrset}
     32  1.1  christos 
     33  1.1  christos 
     34  1.1  christos @pytest.mark.parametrize("resolver_name", ["ns4", "ns5"])
     35  1.1  christos def test_forward_first_referral_ns_above_forward_zone_not_cached(
     36  1.1  christos     servers: dict[str, NamedInstance],
     37  1.1  christos     resolver_name: str,
     38  1.1  christos ) -> None:
     39  1.1  christos     resolver = servers[resolver_name]
     40  1.1  christos     resolver.rndc("flush")
     41  1.1  christos 
     42  1.1  christos     trigger = isctest.query.create("trigger.fwd.hack.", "A", dnssec=False)
     43  1.1  christos     isctest.query.tcp(trigger, resolver.ip)
     44  1.1  christos 
     45  1.1  christos     sibling = isctest.query.create("victim.sibling.hack.", "A", dnssec=False)
     46  1.1  christos     response = isctest.query.tcp(sibling, resolver.ip)
     47  1.1  christos     isctest.check.noerror(response)
     48  1.1  christos 
     49  1.1  christos     assert _a_records(response, "victim.sibling.hack.") == {"203.0.113.42"}
     50