Update pre-filled netmask and gateway on static address family change
When the user goes back and switches the address between IPv4 and IPv6, the pre-filled netmask and gateway are unchanged and have the old address family. So check if the current netmask or gateway is valid for the address family and replace it with the default value for the address family otherwise.
(The two commits may be squashed)