Bug #2827
closedchanging "IPv6 Configuration Type" dropdown results in error if you have an old config.xml with unmigrated <dhcpd6> block
100%
Description
I have upgraded my 2.1 from snapshot to snapshot for quite a long time and I now have accumulated 2 IPv6 dhcpd blocks in my config.xml. The old one is <dhcpd6> and has been there since at least https://github.com/bsdperimeter/pfsense/commit/e029943a103a2c702e79096921ecfa0ae21ac489
I'm not sure when it changed from <dhcpd6> to <dhcpdv6> but my config.xml doesn't seem to have been upgraded, I apparently just added a new <dhcpdv6> and continued on. I have just noticed that if I try to change from the current static IPv6 ip address to anything else (or just change the IPv6 address type) on the LAN interface i get this error:
The following input errors were detected:
The DHCP6 Server is active on this interface and it can be used only with a static IPv6 configuration. Please disable the DHCPv6 Server service on this interface first, then change the interface configuration.
The reason for this is because of the old <dhcpd6> block which has an <enable/> and gets re-added if I delete it manually.
If I change line 435 in /usr/local/www/interfaces.php from:
if (isset($config['dhcpd6']) && isset($config['dhcpd6'][$if]['enable']) && (! preg_match("/^staticv6/", $_POST['type6'])))
to:
if (isset($config['dhcpdv6']) && isset($config['dhcpdv6'][$if]['enable']) && (! preg_match("/^staticv6/", $_POST['type6'])))
It solves this problem, although the <dhcpd6> block is still in config.xml . It just doesn't get checked anymore.
if you grep through the code for dhcpd6 and dhcpdv6 you will see tons of dhcpdv6 but dhcpd6 is in only the one file, apart from references to dhcpd6.leases so I guess it's not really used anymore.
oops I just did another check and dhcpd6 is also used in /etc/rc.initial.setlanip so it's probably a bit more complicated than changing interfaces.php
PS. I previously added this all to the end of closed issue [[http://redmine.pfsense.org/issues/2065]] which is not the same problem, so I realized that I should open a new one... Sorry about that.
Files