Giter VIP home page Giter VIP logo

Comments (1)

SivaKesava1 avatar SivaKesava1 commented on August 23, 2024

That is not true. It would respond with Tag R2 which is NXDOMAIN and not NOERROR. You can try it out yourself, but here is the test code:

      public void TestZoneValidity()
        {
            var function = Function<Zone, bool>(ZoneExtensions.IsValidZoneForRRLookup);

            var soa = new ResourceRecord
            {
                RName = new DomainName { Value = new List<byte> { 0, 2 } },
                RType = RecordType.SOA,
                RData = new DomainName { Value = new List<byte> { } },
            };

            var ns = new ResourceRecord
            {
                RName = new DomainName { Value = new List<byte> { 0, 2 } },
                RType = RecordType.NS,
                RData = new DomainName { Value = new List<byte> { 6, 7, 8 } },
            };

            var wildcard = new ResourceRecord
            {
                RName = new DomainName { Value = new List<byte> { 0, 2, 1 } },
                RType = RecordType.A,
                RData = new DomainName { Value = new List<byte> { } },
            };

            var wildcard1 = new ResourceRecord
            {
                RName = new DomainName { Value = new List<byte> { 0, 2, 1, 4 } },
                RType = RecordType.A,
                RData = new DomainName { Value = new List<byte> { } },
            };

            var zn = new Zone { Records = new List<ResourceRecord> { soa, ns, wildcard, wildcard1 } };
            Assert.IsTrue(function.Evaluate(zn));

            var relevant = Function<Query, Zone, IList<ResourceRecord>>(ServerModel.GetRelevantRRs);
            var result = relevant.Evaluate(new Query { QName = new DomainName { Value = new List<byte> { 0, 2, 1, 5 } }, QType = RecordType.A }, zn);
            Assert.IsTrue(result.Count() == 1);
            Assert.IsTrue(wildcard.Equals(result.First()));

            var serverfunction = Function<Query, Zone, Option<Response>>(ServerModel.ServerLookup);
            var response = serverfunction.Evaluate(new Query { QName = new DomainName { Value = new List<byte> { 0, 2, 1, 5 } }, QType = RecordType.A }, zn);
            Assert.IsTrue(response.HasValue);
            var v = response.Value;
            Assert.IsTrue(v.ResTag == Tag.R2);
        }

The zone corresponds:

a.x. IN SOA
a.x. IN NS g.h.i
*.a.x IN A
b.*.a.x IN A

The mapping is a.x is 0, 2 in reverse, so a corresponds to 2. Check this for details of our encoding.

The query that I gave was 0, 2, 1, 5 which translates to reverse(x.a.*.c) which is c.*.a.x.
As you can see our server lookup function returns the response with a tag R2 which corresponds to the NXDOMAIN tag and is in accordance with the RFC. Tag details are here and here.

I really appreciate you trying out our tool and thinking of these subtle cases, but I would also advise you to also try them using test cases as I pasted above. You can add the above function to any of the test files in the test folder and you can use these steps to run the tool and tests.

Details: The reason our server lookup doesn't consider this as wildcard match is because in our functionthat checks if a domain d1 is a wildcard match to another domain d2 we have: 𝑑1 ∈∗ 𝑑2 = (|𝑑2 | ≤ |𝑑1 |) ∧ (𝑑1 ≃(|𝑑2 |−1) 𝑑2) ∧ 𝑑1 [ |𝑑2 | ] ≠ ∗ = 𝑑2 [ |𝑑2 | ], which says that d1 which in our case is the query domain name c.*.a.x should not have a * at the index of the length of the d2 which is *.a.x, but it has * so this will not be a wildcard match.

from ferret.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.