Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix all ns mode #305

Closed
wants to merge 3 commits into from
Closed

Conversation

vishalmohanty
Copy link
Contributor

This diff does the following.

  • Updates the all-nameservers mode to lookup only via IPv4 nameserver addresses.
  • Adds a TODO to add lookup via IPv6 NS once that is figured out.

Test:

» echo "google.com" | ./zdns A --retries=10 --all-nameservers  | python -m json.tool
{
    "data": {
        "results": [
            {
                "nameserver": "ns4.google.com",
                "result": {
                    "answers": [
                        {
                            "answer": "142.251.32.46",
                            "class": "IN",
                            "name": "google.com",
                            "ttl": 300,
                            "type": "A"
                        }
                    ],
                    "protocol": "udp",
                    "resolver": "216.239.38.10:53"
                },
                "status": "NOERROR"
            },
            {
                "nameserver": "ns3.google.com",
                "result": {
                    "answers": [
                        {
                            "answer": "142.251.32.46",
                            "class": "IN",
                            "name": "google.com",
                            "ttl": 300,
                            "type": "A"
                        }
                    ],
                    "protocol": "udp",
                    "resolver": "216.239.36.10:53"
                },
                "status": "NOERROR"
            },
            {
                "nameserver": "ns1.google.com",
                "result": {
                    "answers": [
                        {
                            "answer": "142.251.32.46",
                            "class": "IN",
                            "name": "google.com",
                            "ttl": 300,
                            "type": "A"
                        }
                    ],
                    "protocol": "udp",
                    "resolver": "216.239.32.10:53"
                },
                "status": "NOERROR"
            },
            {
                "nameserver": "ns2.google.com",
                "result": {
                    "answers": [
                        {
                            "answer": "142.251.32.46",
                            "class": "IN",
                            "name": "google.com",
                            "ttl": 300,
                            "type": "A"
                        }
                    ],
                    "protocol": "udp",
                    "resolver": "216.239.34.10:53"
                },
                "status": "NOERROR"
            }
        ]
    },
    "name": "google.com",
    "status": "NOERROR",
    "timestamp": "2022-04-28T11:38:48-07:00"
}

@vishalmohanty vishalmohanty requested a review from a team as a code owner April 28, 2022 18:43
@LizIzhikevich
Copy link
Contributor

do you know why when running your example, but with the iterative flag, some results still are missing the protocol/resolver?

echo "google.com" | sudo ./zdns A --retries=10 --all-nameservers --iterative | jq

{
  "data": {
    "results": [
      {
        "nameserver": "ns2.google.com",
        "result": {
          "answers": [
            {
              "answer": "142.251.46.238",
              "class": "IN",
              "name": "google.com",
              "ttl": 300,
              "type": "A"
            }
          ],
          "protocol": "udp",
          "resolver": "216.239.36.10:53"
        },
        "status": "NOERROR"
      },
      {
        "nameserver": "ns1.google.com",
        "result": {
          "answers": [
            {
              "answer": "142.251.46.238",
              "class": "IN",
              "name": "google.com",
              "ttl": 300,
              "type": "A"
            }
          ],
          "protocol": "",
          "resolver": ""
        },
        "status": "NOERROR"
      },
      {
        "nameserver": "ns3.google.com",
        "result": {
          "answers": [
            {
              "answer": "142.251.46.238",
              "class": "IN",
              "name": "google.com",
              "ttl": 300,
              "type": "A"
            }
          ],
          "protocol": "",
          "resolver": ""
        },
        "status": "NOERROR"
      },
      {
        "nameserver": "ns4.google.com",
        "result": {
          "answers": [
            {
              "answer": "142.251.46.238",
              "class": "IN",
              "name": "google.com",
              "ttl": 300,
              "type": "A"
            }
          ],
          "protocol": "",
          "resolver": ""
        },
        "status": "NOERROR"
      }
    ]
  },
  "name": "google.com",
  "status": "NOERROR",
  "timestamp": "2022-04-28T19:33:24Z"
}

@vishalmohanty
Copy link
Contributor Author

@LizIzhikevich that is because in the --iterative mode, the response is getting cached and hence the requests after the first all get back the cached response (with missing resolver). I need some help in running the --iterative mode without using the cache. --cache-size=0 still returns cached response.

@LizIzhikevich
Copy link
Contributor

ok. im happy to approve this PR on my end---since it does solve the root problem--- but sounds like you might need to open a new issue that addresses cache=0 not working haha.

@zakird
Copy link
Member

zakird commented Apr 28, 2022

I want to take a pass on this before we merge. I'm not sure this is the right place for the code.

@phillip-stephens
Copy link
Contributor

I'm going to close this PR but we'll be addressing --all-nameservers soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants