summaryrefslogtreecommitdiffstats
path: root/etc/inc/config.inc
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2005-11-06 20:03:46 +0000
committerScott Ullrich <sullrich@pfsense.org>2005-11-06 20:03:46 +0000
commitc1ec2c2f80dab2103f497391d0339248239918d5 (patch)
treed810f5a407be57d24fc35ae76c5d013fa41d33a6 /etc/inc/config.inc
parent44318b562757b5a0207eeee612b14456ca29c340 (diff)
downloadpfsense-c1ec2c2f80dab2103f497391d0339248239918d5.zip
pfsense-c1ec2c2f80dab2103f497391d0339248239918d5.tar.gz
MFC 7401
Add support for per interface ftp helper. Suggested-by: Dan Swartzendruber <dswartz_AT_druber.com> In-Discussion-with: Bill M, Dan S
Diffstat (limited to 'etc/inc/config.inc')
-rw-r--r--etc/inc/config.inc49
1 files changed, 33 insertions, 16 deletions
diff --git a/etc/inc/config.inc b/etc/inc/config.inc
index 4845ec9..288ce1a 100644
--- a/etc/inc/config.inc
+++ b/etc/inc/config.inc
@@ -1190,23 +1190,40 @@ function system_start_ftp_helpers() {
require_once("interfaces.inc");
global $config, $g;
- /* if the ftp proxy is disabled then kill pftpx instance and return
- * note that the helpers for port forwards are launched in a different
- * sequence so we are filtering them out here by not including -g 8021 first.
- */
- if($config['system']['disableftpproxy'] <> "") {
- $helpers = exec("ps aux | grep \"/usr/local/sbin/pftpx -g 8021\" | grep -v grep | cut -d\" \" -f6");
- mwexec("/usr/bin/kill {$helpers}");
- return;
+ /* build an array of interfaces to work with */
+ $iflist = array("lan" => "LAN", "wan" => "WAN");
+ for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++)
+ $iflist['opt' . $i] = $config['interfaces']['opt' . $i]['descr'];
+
+ /* loop through all interfaces and handle pftpx */
+ $interface_counter = 0;
+ foreach ($iflist as $ifent => $ifname) {
+ /* if the ftp proxy is disabled for this interface then kill pftpx
+ * instance and continue. note that the helpers for port forwards are
+ * launched in a different sequence so we are filtering them out
+ * here by not including -c {$port} -g 8021 first.
+ */
+ $port = 8021 + $interface_counter;
+ if(isset($config['interfaces'][$ifname]['disableftpproxy'])) {
+ /* item is disabled. lets ++ the interface counter and
+ * keep processing interfaces. kill pftpx if already
+ * running for this instance.
+ */
+ $helpers = exec("ps aux | grep \"/usr/local/sbin/pftpx -g 8021\" | grep -v grep | cut -d\" \" -f6");
+ mwexec("/usr/bin/kill {$helpers}");
+ $interface_counter++;
+ continue;
+ }
+ /* grab the current interface IP address */
+ $ip = find_interface_ip(convert_friendly_interface_to_real_interface_name($ifname));
+ /* if pftpx is already running then do not launch it again */
+ $helpers = exec("ps aux | grep \"/usr/local/sbin/pftpx -c {$port} -g 8021\" | grep -v grep | grep {$ip}");
+ if(!$helpers)
+ mwexec("/usr/local/sbin/pftpx -c {$port} -g 8021 {$ip}");
+
+ $interface_counter++;
}
-
- /* grab the current WAN IP address */
- $wanip = get_current_wan_address();
-
- /* if pftpx is already running then do not launch it again */
- $helpers = exec("ps aux | grep \"/usr/local/sbin/pftpx -g 8021\" | grep -v grep");
- if(!$helpers)
- mwexec("/usr/local/sbin/pftpx -g 8021");
+
}
function cleanup_backupcache($revisions = 30) {
OpenPOWER on IntegriCloud