resolver: sysresolve, names resolved by the system routines

The command keeps the C library's resolution which a configuration
without nserver had before the system's name servers became the
default: no hosts file imported. nserver lines, if any, are still
there for dnspr to forward to. Of sysresolve and fakeresolve the last
given applies.

Tests: sysdns, with sysresolve dnspr has no hosts file names and a
name is resolved through the system routines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Vladimir DubrovinandClaude Opus 5.5 committed 2026-10-20 19:02:37 +03:00
1 parent d5e78a0900
commit 994526dbc4
6 files changed
+67 -8

No files matched your search

+24 -1
View File
@@ -1,6 +1,6 @@
"""The system's name servers and hosts file as the default resolver: with
no nserver in a configuration, names in the hosts file are answered from
it, through the name cache; with nserver lines, the file is not used."""
it; with nserver lines, or sysresolve (the system routines), it is not."""
import os
import re
@@ -81,3 +81,26 @@ def run(t):
wait(t, other, "localhost")
t.ne(["127.0.0.1"], t.dns_query(other, "localhost") or [],
"with nserver, the hosts file is not used")
# sysresolve: the system routines resolve names, and nothing is imported
# for dnspr to answer from
sysport, proxy, srv = t.free_port(), t.free_port(), t.free_port()
t.start("sysdns_sysresolve", f"""
log
flush
sysresolve
auth iponly
allow *
dnspr -p{sysport}
proxy -p{proxy}
flush
auth iponly
allow *
http echo * /echo**
httpsrv -p{srv}
""", ports=[proxy, srv])
wait(t, sysport, "localhost")
t.ne(["127.0.0.1"], t.dns_query(sysport, "localhost") or [],
"with sysresolve, dnspr has no hosts file names")
t.eq(200, t.http(f"http://localhost:{srv}/echo", proxy=f"127.0.0.1:{proxy}").status,
"and names resolve through the system routines")