summaryrefslogtreecommitdiffstats
path: root/src/etc/inc/interfaces.inc
diff options
context:
space:
mode:
Diffstat (limited to 'src/etc/inc/interfaces.inc')
-rw-r--r--src/etc/inc/interfaces.inc21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc
index 40e5c27..e746e83 100644
--- a/src/etc/inc/interfaces.inc
+++ b/src/etc/inc/interfaces.inc
@@ -38,6 +38,27 @@ function interfaces_bring_up($interface) {
}
/*
+ * Validate comma-separated list of IPv4 addresses
+ */
+function validate_ipv4_list($value) {
+ $value = trim($value);
+
+ if (empty($value)) {
+ return false;
+ }
+
+ $list = explode(',', $value);
+
+ foreach ($list as $ip) {
+ if (!is_ipaddrv4($ip)) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+/*
* Return the interface array
*/
function get_interface_arr($flush = false) {
OpenPOWER on IntegriCloud