diff options
author | Phil Davis <phil.davis@inf.org> | 2016-12-22 17:42:14 +0545 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2016-12-22 17:10:07 -0200 |
commit | df84832c80e674434264dc636d306c6c23a286dd (patch) | |
tree | 27c8a980c228ea0aeea1905deba50b9f56137a60 /src/usr/local/www/vpn_openvpn_client.php | |
parent | e29231589adda988422b221d39f8ea85fc24d426 (diff) | |
download | pfsense-df84832c80e674434264dc636d306c6c23a286dd.zip pfsense-df84832c80e674434264dc636d306c6c23a286dd.tar.gz |
Fix #7031 Allow interfaces that use DHCP for OpenVPN
even though the interface (or gateway group) has not yet actually
received an IP address.
This is useful when setting up a new system that is currently offline.
(cherry picked from commit 0f2cf2a1c47192e8394cbcec6ee291b7e753ac4b)
Diffstat (limited to 'src/usr/local/www/vpn_openvpn_client.php')
-rw-r--r-- | src/usr/local/www/vpn_openvpn_client.php | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/usr/local/www/vpn_openvpn_client.php b/src/usr/local/www/vpn_openvpn_client.php index f6b1181..3614337 100644 --- a/src/usr/local/www/vpn_openvpn_client.php +++ b/src/usr/local/www/vpn_openvpn_client.php @@ -219,9 +219,17 @@ if ($_POST) { } elseif (is_ipaddrv6($iv_ip) && (stristr($pconfig['protocol'], "6") === false)) { $input_errors[] = gettext("Protocol and IP address families do not match. An IPv4 protocol and an IPv6 IP address cannot be selected."); } elseif ((stristr($pconfig['protocol'], "6") === false) && !get_interface_ip($iv_iface) && ($pconfig['interface'] != "any")) { - $input_errors[] = gettext("An IPv4 protocol was selected, but the selected interface has no IPv4 address."); + // If an underlying interface to be used by this client uses DHCP, then it may not have received an IP address yet. + // So in that case we do not report a problem. + if (!interface_has_dhcp($iv_iface, 4)) { + $input_errors[] = gettext("An IPv4 protocol was selected, but the selected interface has no IPv4 address."); + } } elseif ((stristr($pconfig['protocol'], "6") !== false) && !get_interface_ipv6($iv_iface) && ($pconfig['interface'] != "any")) { - $input_errors[] = gettext("An IPv6 protocol was selected, but the selected interface has no IPv6 address."); + // If an underlying interface to be used by this client uses DHCP6, then it may not have received an IP address yet. + // So in that case we do not report a problem. + if (!interface_has_dhcp($iv_iface, 6)) { + $input_errors[] = gettext("An IPv6 protocol was selected, but the selected interface has no IPv6 address."); + } } if ($pconfig['mode'] != "p2p_shared_key") { |