Created attachment 1899583 [details]
patch to get DNS and Saveconfig combination running in wg-quick
Description of problem:
DNS= lines disappear from the configuration if SaveConfig=true
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1.wg-quick up wg0 with DNS= and SaveConfig=true in wg0.conf
2.wg-quick down wg0
DNS= lost in config file
DNS= as before
The save_config routine in wg-quick uses "resolvconf -l " to get a list of nameservers for this interface. This is not supported in Fedora 36. The second try is listing a file which also does not exist in Fedora.
Adding a third try calling "resolvectl dns <interfacevar> " and adapting the output to be equal to "resolvconf -l" with cut and awk fixes the problem. Probably there are cleaner ways to adapt the script to the different distributions.
Have thought about pushing these changes upstream to see if we can fix things at that level vs maintaining a patch on our end? Jason is pretty good about taking patches for these kinds of things.
I applied and verified the functionality. It fixes the problem. This topic is discussed here, for background:
I'd check if the rpm dependencies cover the tools used in patch, resolvectl, cut, awk.
Thanks. Of course fine to send the patch to upstream. The good thing of the patch is that it is one line and works, the bad thing is that it modifies the output of a command to mimic another command. May be there are better ways to get the info, like a welldefined DBus API.
And it is not guaranteed that systemd-resolved is up in Fedora, so probably it is not easy to program it in a robust way for all environments in all configurations.