libevent / libevent/libevent

Unexpected DNS resolve procedure if dual stack enviroment and multiple subdomain exists

Open
#1,702 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

prio:accepting-patches subsystem:dns
Dominant language
C
Stars
12k
Forks
3.5k
Avg merge
12h 55m
Merged PRs (30d)
6

Description

Dear libevent expert,

We have faced one issue when use libevent to resolve DNS in K8s enviroment.
As you know, K8s will generate multiple subdomain in /etc/resolv.conf as below:

$ cat /etc/resolv.conf
search a.b.c b.c c

Imagine we want to resolve "google" host, and only "google.a.b.c" IPV6 has been configured in K8S dns server. The resolve procedure is as below:

libevent-dns_current

As above diagram depicted, even if the IPV6 address of "google.a.b.c" has been resolved, libevent still wait for IPV4 address of "google.a.b.c", "google.b.c", "google.c", finally "google" from root DNS server. It's unexpected and errorous: if root DNS server gives us some IP of "google", we will get IPV6/IPV4 of 2 different host: "google.a.b.c" and "google".

The correct procedure should as below (seems Linux getaddrinfo() works in this manner)
libevent-dns_expect

Please check if this a known issue and any plan to fix this?

Thanks in advance!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the DNS lookup with the Kubernetes-style search list a.b.c b.c c and the dual-stack responses described in the issue. Compare libevent's current procedure with the expected getaddrinfo()-like behavior, and consider the work done when IPv4 and IPv6 results come from the same search-domain candidate rather than being combined across candidates.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.