-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
resolved: add ability for external programs to hook into name resolution (for machined+networkd to synthesize records) #39293
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
Open
poettering
wants to merge
13
commits into
systemd:main
Choose a base branch
from
poettering:resolved-hook
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4bd03d1
to
8c7035c
Compare
Could you please add an integration test for this at TEST-75-RESOLVED? Thanks |
We want to reuse these generic DNS concepts in resolved hook implementations, hence move them to shared code. (This also enables us to immediately remove som SVCB record handling duplicate definitions.) No real code changes, just some moving around of things.
The DNS RR class is a weird thing, and IRL always set to IN (i.e. 0x1). Let's hence make it something that can be specified optionally, and imply IN if not specified. This makes it a bit nicer to put together suitable json resource record keys from the command line.
This introduces /run/systemd/resolve.hook/ as a new directory that local (privileged) programs can bind a Varlink socket into. If they do they'll get a method call for each attempted resolved lookup, which they can then either process themselves (and generate new records for, or return errors to block stuff) or let pass so that the regular resolution is done. Usecase for this is primarily two things: 1. in machined we can add local resolution of machine names to their IP addresses, similar in fashion to nss-mymachines, but working also if the non-NSS interfaces to name resolution are used, i.e. the local DNS responder. In fact, I think we should eventually remove nss-mymachines from our tree, as soon as this code in resolved is setlled. 2. in networkd we can add local resolution of names specified in DHCP leases we hand out. But beyond that there should be many other uses, for example people could write "dns firewalls" with this if they like where they dynamically block certain names from resolution. Fixes: systemd#8518
This basically implements nss-myhostname, but natively in systemd-resolved, so that the logic becomes available also for clients using the local DNS stub for resolution or the D-Bus or Varlink APIs.
Let's synthesize DNS RRs for leases handed out by our DHCP server. This way local VMs can have resolvable hostnames locally. This does not implement reverse look ups for now. We can add this later in similar fashion.
This function doesn't "connect" to Varlink (i.e. it isn't a client) but it binds a Varlink socket (i.e. it is server), hence let's remove the verb "connect" from its name. let's copy how machined/resolved name the counterpart for this function: manager_varlink_init()
Let's expose local VMs/containers under ._dhcp by default. Let's also expose WIFI AP clients under .home.arpa (i.e. the RFC8375 domain for home networks).
8c7035c
to
f91d85e
Compare
This was referenced Oct 15, 2025
poettering
added a commit
that referenced
this pull request
Oct 16, 2025
Split out of #39293, but make a ton of sense on their own.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
build-system
ci-fails/needs-rework 🔥
Please rework this, the CI noticed an issue with the PR
documentation
import
machine
meson
network
new-feature
resolve
tests
units
util-lib
varlink
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.