FS#66308 - [netctl] dual stack - only ipv6 dns in resolv.conf

Attached to Project: Arch Linux
Opened by C. Dominik Bódi (osginyast) - Sunday, 19 April 2020, 11:55 GMT
Last edited by Jouke Witteveen (jouke) - Monday, 27 April 2020, 13:55 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Jouke Witteveen (jouke)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:
I have a ethernet-dhcp config like this:
Description='Ethernet'
Interface=enp116s0
Connection=ethernet
IP=dhcp
IP6=dhcp

Starting the interface, I would expect both IPv4 and IPv6 dns server to be added to /etc/resolv.conf. However, only the IP6 dns server is found in /run/systemd/resolve/resolv.conf
I am using systemd-resolved, but I am getting the same thing when using openresolv.

Ideally, netctl would set up DNS so that both IPv4 and IPv6 dns servers are usable.

When setting IP6 to stateless, only IPv4 DNS server shows up in resolv.conf

Additional info:
* netctl version 1.21-2

Steps to reproduce:
1. Set up a dual-stack ethernet config file with both IP=dhcp and IP6=dhcp
2. netctl start <interface>
3. Check resolv.conf (depending on what dns resolver you are using) - Only IPv6 dns server shows up in resolv.conf
4. change IP6=stateless
5. netctl restart <interface>
6. Check resolv.conf (depending on what dns resolver you are using) - Only IPv4 dns server shows up in resolv.conf

Regards,
This task depends upon

Closed by  Jouke Witteveen (jouke)
Monday, 27 April 2020, 13:55 GMT
Reason for closing:  Upstream
Additional comments about closing:  Will be fixed in dhcpcd 9.0.3.
Possibly, a bug in systemd-resolvconf remains.
Comment by Jouke Witteveen (jouke) - Sunday, 19 April 2020, 18:48 GMT
This may have to do with the fact that netctl starts a separate instance of the DHCP client per IP version. It could be something like a race between both clients. What happens if you switch to `dhclient` as a DHCP client (DHCPClient= and DHCP6Client=)?
Comment by C. Dominik Bódi (osginyast) - Sunday, 19 April 2020, 22:47 GMT
Using dhclient makes things even worse.
As I use systemd-resolved, /etc/resolv.conf is a symlink to /run/systemd/resolve/stub-resolv.conf
When I use dhclient, that symlink gets replaced by a non-symlink file.
From there it gets even stranger. In the newcly created /etc/resolv.conf, no dns servers are listed except the mdns one provided by avahi.
To sum it up, I cannot use dhclient, it just breaks everything.

Regards,
Comment by Roy Marples (rsmarples) - Wednesday, 22 April 2020, 13:46 GMT
I can only help with openresolv (for obvious reasons).

So, dhcpcd calls dhcpcd-run-hooks with:

interace=enp116s0
protocol=dhcp

It then makes this:
ifname="$interface${protocol+.}$protocol"

And the resolvconf hook ends up calling this:
printf %s "$conf" | "$resolvconf" -a "$ifname"

For IPv6 the protocol will either be ra or dhcp6.

This happens regardless of how dhcpcd is run - protocol per interface, just per interface or as a single daemon.
So it should just work. You can verify this by running
$ resolvconf -i
re0.dhcp re0.dhcp6 re0.ra

So I have three files from one interace.
$ resolvconf -l
will show them

What output do you get from resolvconf -i and resolvconf --version?
Comment by C. Dominik Bódi (osginyast) - Thursday, 23 April 2020, 21:01 GMT

resolvconf --version
openresolv 3.10.0
Copyright (c) 2007-2020 Roy Marples

with both DHCPClient and DHCPClient6 options set to "dhcpcd"

resolvconf -i
enp116s0.dhcp

with defaults (IPv4=dhcpcd, IPv6=dhclient according to manpage)
resolvconf -i
enp116s0.dhcp

with both clients set to dhclient
empty output

I've uninstalled rebooted and reinstalled dhcpcd to clean up /var/lib/dhcpcd
that didn't help.
Strangely enough, the race goes the other way now, I am getting only ipv4.
Looking at the logs, I can see the netctl launches the dhcpcd -6 command, but never gets any response. The IPv4 looks normal.
Comment by Roy Marples (rsmarples) - Thursday, 23 April 2020, 23:09 GMT
I think I have worked out the problem. please try the patch at the below url
https://roy.marples.name/cgit/dhcpcd.git/commit/?id=f10b3ded87b73e0d2e1018781ca874aea166eac0
Comment by C. Dominik Bódi (osginyast) - Sunday, 26 April 2020, 07:58 GMT
The patch makes dhcp6 work again. However (with systemd-resolconf, not openresolv), now only the IPv6 nameserver gets added to /run/systemd/resolve/resolv.conf

Regards,
Comment by Jouke Witteveen (jouke) - Sunday, 26 April 2020, 08:54 GMT
Could that simply be a compatibility bug in systemd-resolvconf? Or does openresolv have some special-casing for dhcpcd?

I don't think there is much left to do here. At least the situation with openresolv and DHCP6Client=dhcpcd works :-).
Comment by Roy Marples (rsmarples) - Sunday, 26 April 2020, 09:55 GMT
The only special casing for openresolv is this:

[ -n "$ifmetric" ] && export IF_METRIC="$ifmetric"

So that dhcpcd can tell openresolv which interface to prefer over another.
But as that's an environment var, it shouldn't affect anything.
Comment by C. Dominik Bódi (osginyast) - Sunday, 26 April 2020, 12:05 GMT
I can confirm that with the patched dhcpcd and openresolv, both ipv4 and ipv6 dns servers end up in /etc/resolv.conf
I guess it is systemd-resolvconf that does something "wrong" then?

Regards,

Loading...