diff options
author | Steve Beaver <sbeaver@netgate.com> | 2016-12-15 12:19:01 -0500 |
---|---|---|
committer | Steve Beaver <sbeaver@netgate.com> | 2016-12-15 12:23:48 -0500 |
commit | 77a8a7d6af748f633f35d9c9e65a2aa6df7d72ef (patch) | |
tree | 338f88b7e40a6afe2148ecbc8c9422a2fbb7fe6e /src/usr/local/www/system_gateways_edit.php | |
parent | 0917101a0c0c4d611eeb41c2d3ee49062d52a2e9 (diff) | |
download | pfsense-77a8a7d6af748f633f35d9c9e65a2aa6df7d72ef.zip pfsense-77a8a7d6af748f633f35d9c9e65a2aa6df7d72ef.tar.gz |
Added a function validateipaddr() use as:
// Validate a network address
// $addr: the address to validate
// $type: IPV4|IPV6|IPV4V6
// $label: the label used by the GUI to display this value. Required to compose an error message
// $err_msg: pointer to the callers error message array so that error messages can be added to it here
// $alias: are aliases permitted for this address?
function validateipaddr(&$addr, $type, $label, &$err_msg, $alias=false)
This is indented to provide a single method of validating IP addresses of all types and composing a suitable error message
Diffstat (limited to 'src/usr/local/www/system_gateways_edit.php')
-rw-r--r-- | src/usr/local/www/system_gateways_edit.php | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/usr/local/www/system_gateways_edit.php b/src/usr/local/www/system_gateways_edit.php index cbd1e84..33e8047 100644 --- a/src/usr/local/www/system_gateways_edit.php +++ b/src/usr/local/www/system_gateways_edit.php @@ -221,8 +221,8 @@ if ($_POST) { } } } - if (($_POST['monitor'] != "") && !is_ipaddr($_POST['monitor']) && $_POST['monitor'] != "dynamic") { - $input_errors[] = gettext("A valid monitor IP address must be specified."); + if (($_POST['monitor'] != "") && ($_POST['monitor'] != "dynamic")) { + validateipaddr($_POST['monitor'], IPV4V6, "Monitor IP", $input_errors, false); } if (isset($_POST['data_payload']) && is_numeric($_POST['data_payload']) && $_POST['data_payload'] < 0) { $input_errors[] = gettext("A valid data payload must be specified."); |