Exemple #1
0
    def startResponders(cls):
        global ecsReactorRunning
        global ecsReactorv6Running
        print("Launching responders..")

        address = cls._PREFIX + '.21'
        port = 53

        if not ecsReactorRunning:
            reactor.listenUDP(port, UDPECSResponder(), interface=address)
            ecsReactorRunning = True

        if not ecsReactorv6Running and have_ipv6():
            reactor.listenUDP(53000, UDPECSResponder(), interface='::1')
            ecsReactorv6Running = True

        if not reactor.running:
            cls._UDPResponder = threading.Thread(name='UDP Responder', target=reactor.run, args=(False,))
            cls._UDPResponder.setDaemon(True)
            cls._UDPResponder.start()
Exemple #2
0
    def testRequireNoECS(self):
        expected = dns.rrset.from_text(nameECS, ttlECS, dns.rdataclass.IN,
                                       'TXT', '192.168.0.1/32')

        ecso = clientsubnetoption.ClientSubnetOption('0.0.0.0', 0)
        query = dns.message.make_query(nameECS,
                                       'TXT',
                                       'IN',
                                       use_edns=True,
                                       options=[ecso],
                                       payload=512)
        self.sendECSQuery(query, expected, ttlECS)


@unittest.skipIf(not have_ipv6(), "No IPv6")
class testIncomingECSByNameV6(ECSTest):
    _confdir = 'ECSIncomingByNameV6'

    _config_template = """edns-subnet-whitelist=ecs-echo.example.
use-incoming-edns-subnet=yes
ecs-ipv6-bits=128
ecs-ipv4-cache-bits=32
ecs-ipv6-cache-bits=128
query-local-address=::1
forward-zones=ecs-echo.example=[::1]:53000
    """

    def testSendECS(self):
        expected = dns.rrset.from_text(nameECS, ttlECS, dns.rdataclass.IN,
                                       'TXT', '2001:db8::1/128')