[Networkmanager] dns-mgr occasionally writes resolv.conf in the wrong order

Bjørn Mork bjorn at mork.no
Wed Jun 28 14:18:22 UTC 2023


Bjørn Mork <bjorn at mork.no> writes:

> Ouch. OK, will attempt to do that.  But it's often weeks between each
> time this issue hits me, so tha trace could be huge.

Issue opened.  But playing with this now under different versions I
believe I see what goes wrong.  I'm not able to see how it should be
fixed, though.

This is running 1.42.6 from the Debian unstable 1.42.6-2 package,
starting out with no interfaces connected.


1) Connecting wifi interface - this is obviously "best":

Jun 28 16:04:59 miraculix NetworkManager[3751403]: <debug> [1687961099.0539] dns-mgr: (device_l3cd_changed): DNS configuration changed
Jun 28 16:04:59 miraculix NetworkManager[3751403]: <debug> [1687961099.0540] dns-mgr: (device_l3cd_changed): committing DNS changes (0)
Jun 28 16:04:59 miraculix NetworkManager[3751403]: <debug> [1687961099.0540] dns-mgr: update-dns: updating resolv.conf
Jun 28 16:04:59 miraculix NetworkManager[3751403]: <trace> [1687961099.0541] dns-mgr: config:      100 best    v4 30    : 109.247.114.4 92.220.228.70
Jun 28 16:04:59 miraculix NetworkManager[3751403]: <trace> [1687961099.0542] dns-mgr: config:      100 best    v6 30    : 2a01:798:0:8012::4 2a01:798:0:9002::70
Jun 28 16:04:59 miraculix NetworkManager[3751403]: <trace> [1687961099.0545] dns-mgr: plugin: add domain 'mork.no' (i=30, p=100)
Jun 28 16:04:59 miraculix NetworkManager[3751403]: <trace> [1687961099.0546] dns-mgr: plugin: add domain <auto-default> (i=30, p=100)
Jun 28 16:04:59 miraculix NetworkManager[3751403]: <trace> [1687961099.0546] dns-mgr: plugin: settings: ifindex=30, priority=100, default-route=1, search=mork.no, reverse=10.168.192.in-addr.arpa
Jun 28 16:04:59 miraculix NetworkManager[3751403]: <trace> [1687961099.0547] dns-mgr: plugin: add domain 'mork.no' (i=30, p=100)
Jun 28 16:04:59 miraculix NetworkManager[3751403]: <trace> [1687961099.0547] dns-mgr: plugin: add domain <auto-default> (i=30, p=100)
Jun 28 16:04:59 miraculix NetworkManager[3751403]: <trace> [1687961099.0548] dns-mgr: plugin: settings: ifindex=30, priority=100, default-route=1, search=mork.no, reverse=a.0.b.4.4.6.9.0.9.9.7.0.1.0.a.2.ip6.arpa,0.0.0.0.0.0.0.0.0.0.0.0.0.8.e.f.ip6.arpa


2) Connecting LTE (aka type="gsm") interface - default, but wifi is
still best.  So far, so good:


Jun 28 16:10:16 miraculix NetworkManager[3751403]: <debug> [1687961416.8938] dns-mgr: (device_l3cd_changed): DNS configuration changed
Jun 28 16:10:16 miraculix NetworkManager[3751403]: <debug> [1687961416.8938] dns-mgr: (device_l3cd_changed): committing DNS changes (0)
Jun 28 16:10:16 miraculix NetworkManager[3751403]: <debug> [1687961416.8939] dns-mgr: update-dns: updating resolv.conf
Jun 28 16:10:16 miraculix NetworkManager[3751403]: <trace> [1687961416.8940] dns-mgr: config:      100 best    v4 30    : 109.247.114.4 92.220.228.70
Jun 28 16:10:16 miraculix NetworkManager[3751403]: <trace> [1687961416.8941] dns-mgr: config:      100 best    v6 30    : 2a01:798:0:8012::4 2a01:798:0:9002::70
Jun 28 16:10:16 miraculix NetworkManager[3751403]: <trace> [1687961416.8941] dns-mgr: config:      100 default v4 29    : 193.213.112.4 130.67.15.198
Jun 28 16:10:16 miraculix NetworkManager[3751403]: <trace> [1687961416.8942] dns-mgr: config:      100 default v6 29    : 2001:4600:4:fff::52 2001:4600:4:1fff::52
Jun 28 16:10:16 miraculix NetworkManager[3751403]: <trace> [1687961416.8943] dns-mgr: plugin: add domain 'mork.no' (i=30, p=100)
Jun 28 16:10:16 miraculix NetworkManager[3751403]: <trace> [1687961416.8943] dns-mgr: plugin: add domain <auto-default> (i=30, p=100)
Jun 28 16:10:16 miraculix NetworkManager[3751403]: <trace> [1687961416.8944] dns-mgr: plugin: settings: ifindex=30, priority=100, default-route=1, search=mork.no, reverse=10.168.192.in-addr.arpa
Jun 28 16:10:16 miraculix NetworkManager[3751403]: <trace> [1687961416.8945] dns-mgr: plugin: add domain 'mork.no' (i=30, p=100)
Jun 28 16:10:16 miraculix NetworkManager[3751403]: <trace> [1687961416.8945] dns-mgr: plugin: add domain <auto-default> (i=30, p=100)
Jun 28 16:10:16 miraculix NetworkManager[3751403]: <trace> [1687961416.8946] dns-mgr: plugin: settings: ifindex=30, priority=100, default-route=1, search=mork.no, reverse=a.0.b.4.4.6.9.0.9.9.7.0.1.0.a.2.ip6.arpa,0.0.0.0.0.0.0.0.0.0.0.0.0.8.e.f.ip6.arpa
Jun 28 16:10:16 miraculix NetworkManager[3751403]: <trace> [1687961416.8947] dns-mgr: plugin: add domain <auto-default> (i=29, p=100)
Jun 28 16:10:16 miraculix NetworkManager[3751403]: <trace> [1687961416.8948] dns-mgr: plugin: settings: ifindex=29, priority=100, default-route=1, search=, reverse=200.198.56.10.in-addr.arpa,201.198.56.10.in-addr.arpa,202.198.56.10.in-addr.arpa,203.198.56.10.in-addr.arpa
Jun 28 16:10:16 miraculix NetworkManager[3751403]: <trace> [1687961416.8949] dns-mgr: plugin: add domain <auto-default> (i=29, p=100)
Jun 28 16:10:16 miraculix NetworkManager[3751403]: <trace> [1687961416.8950] dns-mgr: plugin: settings: ifindex=29, priority=100, default-route=1, search=, reverse=6.3.b.6.2.c.6.0.1.2.1.2.2.0.a.2.ip6.arpa


3) Disconnecting wifi - LTE interface is now the only one and therefore
now "best".  Still good:



Jun 28 16:12:16 miraculix NetworkManager[3751403]: <debug> [1687961536.4348] dns-mgr: (update_routing_and_dns): DNS configuration changed
Jun 28 16:12:16 miraculix NetworkManager[3751403]: <debug> [1687961536.4348] dns-mgr: (update_routing_and_dns): committing DNS changes (0)
Jun 28 16:12:16 miraculix NetworkManager[3751403]: <debug> [1687961536.4348] dns-mgr: update-dns: updating resolv.conf
Jun 28 16:12:16 miraculix NetworkManager[3751403]: <trace> [1687961536.4348] dns-mgr: config:      100 best    v4 29    : 193.213.112.4 130.67.15.198
Jun 28 16:12:16 miraculix NetworkManager[3751403]: <trace> [1687961536.4348] dns-mgr: config:      100 best    v6 29    : 2001:4600:4:fff::52 2001:4600:4:1fff::52
Jun 28 16:12:16 miraculix NetworkManager[3751403]: <trace> [1687961536.4348] dns-mgr: plugin: add domain <auto-default> (i=29, p=100)
Jun 28 16:12:16 miraculix NetworkManager[3751403]: <trace> [1687961536.4349] dns-mgr: plugin: settings: ifindex=29, priority=100, default-route=1, search=, reverse=200.198.56.10.in-addr.arpa,201.198.56.10.in-addr.arpa,202.198.56.10.in-addr.arpa,203.198.56.10.in-addr.arpa
Jun 28 16:12:16 miraculix NetworkManager[3751403]: <trace> [1687961536.4349] dns-mgr: plugin: add domain <auto-default> (i=29, p=100)
Jun 28 16:12:16 miraculix NetworkManager[3751403]: <trace> [1687961536.4349] dns-mgr: plugin: settings: ifindex=29, priority=100, default-route=1, search=, reverse=6.3.b.6.2.c.6.0.1.2.1.2.2.0.a.2.ip6.arpa



4) Connecting wifi again.  This is where it fail. wifi is added as
"best", but without the LTE ("gsm") interface being demoted.  We now
have two "best" interfaces, and the resolv.conf order is arbitrary and
wrong:


Jun 28 16:13:05 miraculix NetworkManager[3751403]: <debug> [1687961585.3519] dns-mgr: (device_l3cd_changed): DNS configuration changed
Jun 28 16:13:05 miraculix NetworkManager[3751403]: <debug> [1687961585.3520] dns-mgr: (device_l3cd_changed): committing DNS changes (0)
Jun 28 16:13:05 miraculix NetworkManager[3751403]: <debug> [1687961585.3521] dns-mgr: update-dns: updating resolv.conf
Jun 28 16:13:05 miraculix NetworkManager[3751403]: <trace> [1687961585.3521] dns-mgr: config:      100 best    v4 29    : 193.213.112.4 130.67.15.198
Jun 28 16:13:05 miraculix NetworkManager[3751403]: <trace> [1687961585.3522] dns-mgr: config:      100 best    v6 29    : 2001:4600:4:fff::52 2001:4600:4:1fff::52
Jun 28 16:13:05 miraculix NetworkManager[3751403]: <trace> [1687961585.3523] dns-mgr: config:      100 best    v4 30    : 109.247.114.4 92.220.228.70
Jun 28 16:13:05 miraculix NetworkManager[3751403]: <trace> [1687961585.3524] dns-mgr: config:      100 best    v6 30    : 2a01:798:0:8012::4 2a01:798:0:9002::70
Jun 28 16:13:05 miraculix NetworkManager[3751403]: <trace> [1687961585.3525] dns-mgr: plugin: add domain <auto-default> (i=29, p=100)
Jun 28 16:13:05 miraculix NetworkManager[3751403]: <trace> [1687961585.3526] dns-mgr: plugin: settings: ifindex=29, priority=100, default-route=1, search=, reverse=200.198.56.10.in-addr.arpa,201.198.56.10.in-addr.arpa,202.198.56.10.in-addr.arpa,203.198.56.10.in-addr.arpa
Jun 28 16:13:05 miraculix NetworkManager[3751403]: <trace> [1687961585.3526] dns-mgr: plugin: add domain <auto-default> (i=29, p=100)
Jun 28 16:13:05 miraculix NetworkManager[3751403]: <trace> [1687961585.3527] dns-mgr: plugin: settings: ifindex=29, priority=100, default-route=1, search=, reverse=6.3.b.6.2.c.6.0.1.2.1.2.2.0.a.2.ip6.arpa
Jun 28 16:13:05 miraculix NetworkManager[3751403]: <trace> [1687961585.3528] dns-mgr: plugin: add domain 'mork.no' (i=30, p=100)
Jun 28 16:13:05 miraculix NetworkManager[3751403]: <trace> [1687961585.3529] dns-mgr: plugin: add domain <auto-default> (i=30, p=100)
Jun 28 16:13:05 miraculix NetworkManager[3751403]: <trace> [1687961585.3529] dns-mgr: plugin: settings: ifindex=30, priority=100, default-route=1, search=mork.no, reverse=10.168.192.in-addr.arpa
Jun 28 16:13:05 miraculix NetworkManager[3751403]: <trace> [1687961585.3530] dns-mgr: plugin: add domain 'mork.no' (i=30, p=100)
Jun 28 16:13:05 miraculix NetworkManager[3751403]: <trace> [1687961585.3530] dns-mgr: plugin: add domain <auto-default> (i=30, p=100)
Jun 28 16:13:05 miraculix NetworkManager[3751403]: <trace> [1687961585.3531] dns-mgr: plugin: settings: ifindex=30, priority=100, default-route=1, search=mork.no, reverse=a.0.b.4.4.6.9.0.9.9.7.0.1.0.a.2.ip6.arpa,0.0.0.0.0.0.0.0.0.0.0.0.0.8.e.f.ip6.arpa



So the problem is that we don't reset the state of the previous "best"
interface when adding an even better one.

Hoping this is a simple fix for anyone familiar with the code?




Bjørn


More information about the Networkmanager mailing list