LXD dnsmasq version handling code chokes at 2.84rc2 string, preventing containers DHCP from working

Hi everyone,

My containers on my Fedora33 host have started to fail getting IP addresses whereas it used to work before. Upon investigation, I have found the following in the lxd log:

Mar 19 09:22:47 vrubiolo-laptop lxd[3429151]: t=2021-03-19T09:22:47+0100 lvl=eror msg="Failed to bring up network" err="Invalid version format: \"2.84rc2\"" name=lxdbr0

That rc-based version string matches the dnsmasq installed on my system:

$ dnsmasq --version                                                                                         
Dnsmasq version 2.84rc2  Copyright (c) 2000-2021 Simon Kelley                                                                                                                                                                                 
Compile time options: IPv6 GNU-getopt DBus no-UBus no-i18n IDN2 DHCP DHCPv6 no-Lua TFTP no-conntrack ipset auth cryptohash DNSSEC loop-detect inotify dumpfile                                                                                
                                                                                                                       
This software comes with ABSOLUTELY NO WARRANTY.                                                                       
Dnsmasq is free software, and you are welcome to redistribute it                                                       
under the terms of the GNU General Public License, version 2 or 3.

It looks like lxd fails at parsing that version number in https://github.com/lxc/lxd/blob/master/shared/version/version.go#L19.

Incidentally, it looks like this comes from the manufacturing side of dnsmasq for which the git describe based commands picked up two tags, one for 2.84 and one for 2.84rc2, as seen in the VERSION file of the 2.84 tarball:

$ pwd
/home/vrubiolo/rpmbuild/BUILD/dnsmasq-2.84
$ cat VERSION 
 (HEAD -> master, tag: v2.84rc2, tag: v2.84, origin/master, origin/HEAD)
[05:47 PM] vrubiolo@vrubiolo-laptop ~/rpmbuild/BUILD/dnsmasq-2.84

My workaround is to downgrade the package to 2.82 via dnf downgrade and my containers are working fine again:

$ dnsmasq --version
Dnsmasq version 2.82  Copyright (c) 2000-2020 Simon Kelley
[...]

I think the parsing code for lxd should be updated to pick up/handle these extra characters, would you agree? If so, let me know if I should open a bug report.

Thanks for the feedback,

Vincent

Yes please open a bug report over at https://github.com/lxc/lxd/issues, thanks! :slight_smile:

@monstermunchkin can you fix the version parsing code to handle that?

Thanks for the prompt reply. I have filed a bug accordingly.

Ok, thanks to @monstermunchkin for pointing out that the issue had in fact been already fixed in 4.7.

After updating, I confirm the issue is fixed on my side too. Updating title accordingly.

Edit: looks like title edit is now locked. If a mod could a the ‘[SOLVED]’ prefix to the thread title, that’d be good. Thanks!