Skip to content

resolved domain routing tweaks and /etc/resolv.conf handling improvements - #7588

Merged
yuwata merged 6 commits into
systemd:masterfrom
poettering:resolve-route-tweak
Dec 13, 2017
Merged

yuwata merged 6 commits into
systemd:masterfrom
poettering:resolve-route-tweak

Conversation

@poettering

Copy link
Copy Markdown
Member

Mostly inspired by #7544, though not delivering what the reporter probably is looking for.

The user might replace a foreign /etc/resolv.conf with a symlink to one
of ours between the time we did stat() and open the file. Hence, let's
check the fstat() data right after opening the file, a second time.
Let's make sure we use the mtime of the current fstat() data, rather
than the mtime of the old stat(), fixing a theoretical race.
Let's also check for the static resolv.conf, so that we filter all three
of our own files out.
…les we provide

Let's use the same wording and same contents in all three versions.
This makes sure that a classic DNS scope that has no DNS servers
assigned is never considered for routing requests to even if it has
matching search/routing domains associated.

This is inspired by systemd#7544, where lookup requests are refused since a
scope with no DNS server is configured. This change does not deliver
what the reporter intended, but is generally useful in general, as it
makes us mor robust to misconfiguration.

@keszybz keszybz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had one comment, but you replaced that part of the code in a later patch anyway, so it's moot. LGTM, but I'll leave it open for other people to have a look.

Comment thread src/resolve/resolved-resolv-conf.c Outdated
if (stat(PRIVATE_UPLINK_RESOLV_CONF, &own1) >= 0 &&
st->st_dev == own1.st_dev &&
st->st_ino == own1.st_ino)
return true;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason to use two struct stats?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

3 participants