diff options
author | Seth Mos <seth.mos@xs4all.nl> | 2008-06-02 18:10:10 +0000 |
---|---|---|
committer | Seth Mos <seth.mos@xs4all.nl> | 2008-06-02 18:10:10 +0000 |
commit | 47124fa2dae53898a2448f350d44ac3c8d18e2fb (patch) | |
tree | 18331bfc9daf41943d22d1eedcadd3c44609cf90 /etc/inc/filter.inc | |
parent | 21d8d7857cd154f43e2f99d31a703be6b1675dd7 (diff) | |
download | pfsense-47124fa2dae53898a2448f350d44ac3c8d18e2fb.zip pfsense-47124fa2dae53898a2448f350d44ac3c8d18e2fb.tar.gz |
Replace silly vpns list logic
Add subnet checking for robustness
Diffstat (limited to 'etc/inc/filter.inc')
-rw-r--r-- | etc/inc/filter.inc | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 9133329..c2018aa 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -441,18 +441,18 @@ function filter_generate_aliases() { return $aliases; } +/* returns space seperated list of vpn subnets */ function get_vpns_list() { global $config; /* build list of vpns */ $vpns = ""; - $isfirst = true; + $vpns_arr = array(); /* ipsec */ if ($config['ipsec']['tunnel']) { foreach ($config['ipsec']['tunnel'] as $tunnel) { - if ($isfirst == false) - $vpns .= " "; - $vpns .= $tunnel['remote-subnet']; - $isfirst = false; + if(is_subnet($tunnel['remote-subnet'])) { + $vpns_arr[] = $tunnel['remote-subnet']; + } } } /* openvpn */ @@ -460,20 +460,20 @@ function get_vpns_list() { $conf =& $config['installedpackages']["openvpn$type"]['config']; if (!is_array($conf)) continue; foreach ($conf as $tunnel) { - if ($isfirst == false) - $vpns .= " "; - $vpns .= $tunnel['remote_network']; - $isfirst = false; + if(is_subnet($tunnel['remote-subnet'])) { + $vpns_arr[] = $tunnel['remote_network']; + } } } /* pppoe */ if ($config['pppoe']['remoteip']) { - if ($isfirst == false) - $vpns .= " "; - $vpns .= $config['pppoe']['remoteip'] ."/". $config['pppoe']['pppoe_subnet']; - $isfirst = false; + if(is_subnet($tunnel['remote-subnet'])) { + $vpns_arr[] = $config['pppoe']['remoteip'] ."/". $config['pppoe']['pppoe_subnet']; + } + } + if(!empty($vpns_arr)) { + $vpns = implode(" ", $vpns_arr); } - $vpns .= " "; return $vpns; } @@ -3449,4 +3449,4 @@ function return_vpn_subnet($adr) { } -?>
\ No newline at end of file +?> |