From 940aa1351377177ed6c4af44b0c43d7c5ba580b6 Mon Sep 17 00:00:00 2001 From: Chris Buechler Date: Sun, 8 Feb 2009 21:11:57 -0500 Subject: [PATCH 1/2] add support for IP-less interfaces (primarily for assigning tun interfaces for filtering purposes). --- etc/inc/interfaces.inc | 3 +++ usr/local/www/interfaces_opt.php | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index 0bcfd16285..a70919d348 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -275,6 +275,9 @@ function interfaces_optional_configure_if($opti) { /* if user has selected DHCP type then act accordingly */ if($optcfg['ipaddr'] == "dhcp") { interfaces_opt_dhcp_configure("opt{$opti}"); + } elseif ($optcfg['ipaddr'] == "none") { + /* hidden trick for IP-less interfaces */ + mwexec("/sbin/ifconfig " . escapeshellarg($optcfg['if']) . " up"); } else { mwexec("/sbin/ifconfig " . escapeshellarg($optcfg['if']) . " " . escapeshellarg($optcfg['ipaddr'] . "/" . $optcfg['subnet'])); diff --git a/usr/local/www/interfaces_opt.php b/usr/local/www/interfaces_opt.php index e177659b8f..53284ec733 100755 --- a/usr/local/www/interfaces_opt.php +++ b/usr/local/www/interfaces_opt.php @@ -155,7 +155,8 @@ if ($_POST) { $reqdfieldsn = explode(",", "Description,IP address,Subnet bit count"); do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); if (($_POST['ipaddr'] && !is_ipaddr($_POST['ipaddr']))) { - $input_errors[] = "A valid IP address must be specified."; + if($_POST['ipaddr'] <> "none") + $input_errors[] = "A valid IP address must be specified."; } if (($_POST['subnet'] && !is_numeric($_POST['subnet']))) { $input_errors[] = "A valid subnet bit count must be specified."; From 36715dce28bfcf3328abaf82bc7d695a8877630c Mon Sep 17 00:00:00 2001 From: Chris Buechler Date: Sun, 8 Feb 2009 21:30:28 -0500 Subject: [PATCH 2/2] Allow assignment of tun interfaces --- etc/inc/util.inc | 1 - 1 file changed, 1 deletion(-) diff --git a/etc/inc/util.inc b/etc/inc/util.inc index 1fbc0bf2ce..d1f318f860 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -278,7 +278,6 @@ function get_interface_list($mode = "active", $keyby = "physical", $vfaces = "") 'pflog', 'pfsync', 'enc', - 'tun', 'carp' ); }