RMerl/asuswrt-merlin — pull request #785 by pinwing (2014-11-13 21:18:18+00:00)
Title: Do not change IPv6 interface in fail-over mode with failback enabled

When dual wan is set to fail-over with failback and IPv6 is set to be negotiated over PPP (for PPPoE), ipv6_ifdev may be set to eth when WAN(0) loses connection and WAN(1) is configured to non-PPP.

When WAN(0) is up and running again, IPv6 will not be restored to PPP, causing "+ipv6" to be missing from the options.wan0 file. This results in the loss of IPv6 connectivity which can only be restored by rebooting the router without committing anything to nvram or by changing the IPv6 interface in the web UI and reconnecting over WAN(0).

Several places in the code assumes that the IPv6 is always on wan unit 0 (like the start_wan6 function in the same file), so it does not seem to make sense to change ipv6_ifdev depending on whether WAN(0) is up or not. But perhaps Asus will change this in the future, so I did not change the check to "unit == WAN_UNIT_FIRST".

Instead I have added an additional check that only allows changing ipv6_ifdev when unit equals 0 (since ppp seems to be the default in the firmware and if the user forgets to change it IPv6 will not work) or when dual wan is off, set to load balance or set to only failover without failback (to restore IPv6 connectivity when WAN(0) is up and running again and failback is enabled).