Merge branch 'master' of rcs.pfsense.org:pfsense/mainline

This commit is contained in:
gnhb 2010-06-06 10:34:01 +07:00
commit ba7b2b86cc
81 changed files with 605 additions and 512 deletions

View File

@ -34,7 +34,7 @@
added rules which may have been created by other per-user code (index.php, etc).
These changes are (c) 2004 Keycom PLC.
pfSense_BUILDER_BINARIES: /sbin/ifconfig /sbin/ipfw /sbin/sysctl /sbin/kldunload
pfSense_BUILDER_BINARIES: /sbin/ipfw /sbin/sysctl /sbin/kldunload
pfSense_BUILDER_BINARIES: /usr/local/sbin/lighttpd /usr/local/bin/minicron /sbin/pfctl
pfSense_BUILDER_BINARIES: /bin/hostname /bin/cp
pfSense_MODULE: captiveportal
@ -58,7 +58,7 @@ function captiveportal_configure() {
$ifaces = get_configured_interface_list();
foreach ($ifaces as $kiface => $kiface2) {
$tmpif = get_real_interface($kiface);
mwexec("/sbin/ifconfig {$tmpif} -ipfwfilter");
pfSense_interface_flags($tmpif, -IFF_IPFW_FILTER);
}
$cpinterfaces = explode(",", $config['captiveportal']['interface']);
$firsttime = 0;
@ -77,14 +77,14 @@ function captiveportal_configure() {
if (!empty($carpif)) {
$carpsif = explode(" ", $carpif);
foreach ($carpsif as $cpcarp) {
mwexec("/sbin/ifconfig {$cpcarp} ipfwfilter");
pfSense_interface_flags($cpcarp, IFF_IPFW_FILTER);
$carpip = find_interface_ip($cpcarp);
if (is_ipaddr($carpip))
$cpips[] = $carpip;
}
}
$cpips[] = $cpipm;
mwexec("/sbin/ifconfig {$tmpif} ipfwfilter");
pfSense_interface_flags($tmpif, IFF_IPFW_FILTER);
}
}
}
@ -108,7 +108,7 @@ function captiveportal_configure() {
unlink_if_exists("{$g['vardb_path']}/captiveportal_mac.db");
unlink_if_exists("{$g['vardb_path']}/captiveportal_ip.db");
unlink_if_exists("{$g['vardb_path']}/captiveportal_radius.db");
mwexec("/sbin/ipfw -q table all flush");
mwexec("/sbin/ipfw -q table all flush", true);
/* setup new database in case someone tries to access the status -> captive portal page */
touch("{$g['vardb_path']}/captiveportal.db");
@ -391,12 +391,12 @@ EOD;
foreach ($listifs as $listrealif => $listif) {
if (!empty($listrealif)) {
if (does_interface_exist($listrealif)) {
mwexec("/sbin/ifconfig {$listrealif} -ipfwfilter");
pfSense_interface_flags($listrealif, -IFF_IPFW_FILTER);
$carpif = link_ip_to_carp_interface(find_interface_ip($listrealif));
if (!empty($carpif)) {
$carpsif = explode(" ", $carpif);
foreach ($carpsif as $cpcarp)
mwexec("/sbin/ifconfig {$cpcarp} -ipfwfilter");
pfSense_interface_flags($cpcarp, -IFF_IPFW_FILTER);
}
}
}

View File

@ -359,7 +359,7 @@ function convert_config() {
global $config, $g;
$now = date("H:i:s");
log_error("Start Configuration upgrade at $now, set execution timeout to 15 minutes");
ini_set("max_execution_time", "900");
//ini_set("max_execution_time", "900");
/* special case upgrades */
/* fix every minute crontab bogons entry */
@ -932,7 +932,7 @@ EODD;
if (strcasecmp(chop(fgets($fp)), "y") == 0) {
if($config['interfaces']['lan']['if'])
mwexec("/sbin/ifconfig delete " . $config['interfaces']['lan']['if']);
mwexec("/sbin/ifconfig " . $config['interfaces']['lan']['if'] . " delete");
}
if(isset($config['interfaces']['lan']))
unset($config['interfaces']['lan']);
@ -950,7 +950,7 @@ EODD;
unset($config['nat']);
} else {
if(isset($config['interfaces']['lan']['if']))
mwexec("/sbin/ifconfig delete " . $config['interfaces']['lan']['if']);
mwexec("/sbin/ifconfig " . $config['interfaces']['lan']['if'] . " delete");
if(isset($config['interfaces']['lan']))
unset($config['interfaces']['lan']);
if(isset($config['dhcpd']['lan']))

View File

@ -140,8 +140,9 @@ function filter_configure() {
touch($g['tmp_path'] . "/filter_dirty");
}
function delete_states_for_down_gateways() {
function filter_delete_states_for_down_gateways() {
global $config;
$a_gateways = return_gateways_status();
foreach ($a_gateways as $gateway) {
if ($gateway['status'] == "down") {
@ -369,7 +370,7 @@ function filter_configure_sync() {
echo ".";
update_filter_reload_status("Processing down interface states");
delete_states_for_down_gateways();
filter_delete_states_for_down_gateways();
update_filter_reload_status("Running plugins");
@ -2084,7 +2085,7 @@ EOD;
/* if antilockout is enabled, LAN exists and has
* an IP and subnet mask assigned
*/
$lanif = $FilterIflist["lan"]['if'];
$lanif = $FilterIflist['lan']['if'];
$ipfrules .= <<<EOD
# make sure the user cannot lock himself out of the webConfigurator or SSH
anchor "anti-lockout"

View File

@ -243,9 +243,7 @@ EOD;
/* return the status of the apinger targets as a array */
function return_gateways_status() {
global $config;
global $g;
$gateways_arr = return_gateways_array();
global $config, $g;
$apingerstatus = array();
if (file_exists("{$g['tmp_path']}/apinger.status")) {
@ -253,21 +251,6 @@ function return_gateways_status() {
}
$status = array();
$i = 2;
/* assign a dummy IP address for dynamic interfaces in case we need it */
$monitor = array();
foreach($gateways_arr as $name => $gateway) {
if($gateway['monitor'] == "dynamic") {
$gateway['monitor'] = "127.0.0.{$i}";
$i++;
}
$status[$gateway['monitor']]['monitor'] = $gateway['monitor'];
$status[$gateway['monitor']]['interface'] = $gateway['interface'];
$status[$gateway['monitor']]['gateway'] = $gateway['gateway'];
$status[$gateway['monitor']]['name'] = $gateway['name'];
$status[$gateway['monitor']]['status'] = "down";
}
foreach($apingerstatus as $line) {
$info = explode("|", $line);
$target = $info[0];

View File

@ -51,7 +51,7 @@ function interfaces_bring_up($interface) {
log_error( "Backtrace: " . debug_backtrace() );
return;
}
mwexec("/sbin/ifconfig " . escapeshellarg($interface) . " up");
pfSense_interface_flags($interface, IFF_UP);
}
/*
@ -62,7 +62,7 @@ function get_interface_arr($flush = false) {
/* If the cache doesn't exist, build it */
if (!isset($interface_arr_cache) or $flush)
$interface_arr_cache = `/sbin/ifconfig -l`;
$interface_arr_cache = explode(" ", `/sbin/ifconfig -l`);
return $interface_arr_cache;
}
@ -78,7 +78,7 @@ function does_interface_exist($interface) {
return false;
$ints = get_interface_arr();
if(stristr($ints, $interface) !== false)
if (in_array($interface, $ints))
return true;
else
return false;
@ -87,7 +87,7 @@ function does_interface_exist($interface) {
function interfaces_loopback_configure() {
if($g['booting'])
echo "Configuring loopback interface...";
mwexec("/sbin/ifconfig lo0 127.0.0.1");
pfSense_interface_setaddress("lo0", "127.0.0.1");
interfaces_bring_up("lo0");
exec("/sbin/route add 127.0.0.2 127.0.0.1");
if($g['booting'])
@ -122,7 +122,7 @@ function interface_vlan_configure(&$vlan) {
$vlanif = empty($vlan['vlanif']) ? "{$if}_vlan{$vlan['tag']}" : $vlan['vlanif'];
$tag = $vlan['tag'];
if(empty($if)) {
if (empty($if)) {
log_error("interface_vlan_confgure called with if undefined.");
return;
}
@ -130,37 +130,23 @@ function interface_vlan_configure(&$vlan) {
/* make sure the parent interface is up */
interfaces_bring_up($if);
/* Since we are going to add vlan(4) try to enable all that hardware supports. */
mwexec("/sbin/ifconfig {$if} vlanhwtag");
mwexec("/sbin/ifconfig {$if} vlanmtu");
mwexec("/sbin/ifconfig {$if} vlanhwfilter");
pfSense_interface_capabilities($if, IFCAP_VLAN_HWTAGGING|IFCAP_VLAN_MTU|IFCAP_VLAN_HWFILTER);
if (!empty($vlanif) && does_interface_exist($vlanif)) {
interface_bring_down($vlanif);
} else {
$tmpvlanif = exec("/sbin/ifconfig vlan create");
mwexec("/sbin/ifconfig {$tmpvlanif} name {$vlanif}");
mwexec("/usr/sbin/ngctl name {$tmpvlanif}: {$vlanif}");
$tmpvlanif = pfSense_interface_create("vlan");
pfSense_interface_rename($tmpvlanif, $vlanif);
pfSense_ngctl_name("{$tmpvlanif}:", $vlanif);
}
mwexec("/sbin/ifconfig {$vlanif} vlan " .
escapeshellarg($tag) . " vlandev " .
escapeshellarg($if));
pfSense_vlan_create($vlanif, $if, $tag);
interfaces_bring_up($vlanif);
/* invalidate interface cache */
get_interface_arr(true);
/* all vlans need to spoof their parent mac address, too. see
* ticket #1514: http://cvstrac.pfsense.com/tktview?tn=1514,33
*/
foreach($config['interfaces'] as $interfaces) {
if($interfaces['if'] == $if && $interfaces['spoofmac']) {
mwexec("/sbin/ifconfig " . escapeshellarg($vlanif) .
" link " . escapeshellarg($interfaces['spoofmac']));
}
}
/* XXX: ermal -- for now leave it here at the moment it does not hurt. */
interfaces_bring_up($if);
@ -333,12 +319,11 @@ function interface_bridge_configure(&$bridge) {
$checklist = get_configured_interface_list();
if ($g['booting'] || !empty($bridge['bridgeif'])) {
mwexec("/sbin/ifconfig {$bridge['bridgeif']} destroy");
mwexec("/sbin/ifconfig {$bridge['bridgeif']} create");
pfSense_interface_destroy($bridge['bridgeif']);
pfSense_interface_create($bridge['bridgeif']);
$bridgeif = $bridge['bridgeif'];
} else {
$bridgeif = exec("/sbin/ifconfig bridge create");
}
} else
$bridgeif = pfSense_interface_create("bridge");
/* Calculate smaller mtu and enforce it */
$smallermtu = 0;
@ -362,7 +347,7 @@ function interface_bridge_configure(&$bridge) {
$realif1 = get_real_interface($member);
$realif = escapeshellarg($realif1);
/* make sure the parent interface is up */
mwexec("/sbin/ifconfig {$realif} mtu {$smallermtu}");
pfSense_interface_mtu($realif, $smallermtu);
if(!$realif)
log_error("realif not defined in interfaces bridge - up");
interfaces_bring_up($realif1);
@ -486,7 +471,7 @@ function interface_bridge_add_member($bridgeif, $interface) {
$mtum = get_interface_mtu($interface);
if ($mtu != $mtum)
mwexec("/sbin/ifconfig {$interface} mtu {$mtu}");
pfSense_interface_mtu($interface, $mtu);
interfaces_bring_up($interface);
mwexec("/sbin/ifconfig {$bridgeif} addm {$interface}");
@ -524,11 +509,11 @@ function interface_lagg_configure(&$lagg) {
$checklist = get_interface_list();
if ($g['booting'] || !(empty($lagg['laggif']))) {
mwexec("/sbin/ifconfig {$lagg['laggif']} destroy");
mwexec("/sbin/ifconfig {$lagg['laggif']} create");
pfSense_interface_destroy($lagg['laggif']);
pfSense_interface_create($lagg['laggif']);
$laggif = $lagg['laggif'];
} else
$laggif = exec("/sbin/ifconfig lagg create");
$laggif = pfSense_interface_create("lagg");
/* Calculate smaller mtu and enforce it */
$smallermtu = 0;
@ -548,7 +533,7 @@ function interface_lagg_configure(&$lagg) {
if (!array_key_exists($member, $checklist))
continue;
/* make sure the parent interface is up */
mwexec("/sbin/ifconfig {$member} mtu {$smallermtu}");
pfSense_interface_mtu($member, $smallermtu);
interfaces_bring_up($member);
mwexec("/sbin/ifconfig {$laggif} laggport {$member}");
}
@ -588,22 +573,21 @@ function interface_gre_configure(&$gre) {
interfaces_bring_up($realif);
if ($g['booting'] || !(empty($gre['greif']))) {
mwexec("/sbin/ifconfig {$gre['greif']} destroy");
mwexec("/sbin/ifconfig {$gre['greif']} create");
pfSense_interface_destroy($gre['greif']);
pfSense_interface_create($gre['greif']);
$greif = $gre['greif'];
} else {
$greif = exec("/sbin/ifconfig gre create");
}
} else
$greif = pfSense_interface_create("gre");
/* Do not change the order here for more see gre(4) NOTES section. */
mwexec("/sbin/ifconfig {$greif} tunnel {$realifip} {$gre['remote-addr']}");
mwexec("/sbin/ifconfig {$greif} {$gre['tunnel-local-addr']} {$gre['tunnel-remote-addr']} netmask " . gen_subnet_mask($gre['tunnel-remote-net']));
if (isset($gre['link0']) && $gre['link0'])
mwexec("/sbin/ifconfig {$greif} link0");
pfSense_interface_flags($greif, IFF_LINK0);
if (isset($gre['link1']) && $gre['link1'])
mwexec("/sbin/ifconfig {$greif} link1");
pfSense_interface_flags($greif, IFF_LINK1);
if (isset($gre['link2']) && $gre['link2'])
mwexec("/sbin/ifconfig {$greif} link2");
pfSense_interface_flags($greif, IFF_LINK2);
if($greif)
interfaces_bring_up($greif);
@ -647,19 +631,19 @@ function interface_gif_configure(&$gif) {
log_error("could not bring realif up -- variable not defined -- interface_gif_configure()");
if ($g['booting'] || !(empty($gif['gifif']))) {
mwexec("/sbin/ifconfig {$gif['gifif']} destroy");
mwexec("/sbin/ifconfig {$gif['gifif']} create");
pfSense_interface_destroy($gif['gifif']);
pfSense_interface_create($gif['gifif']);
$gifif = $gif['gifif'];
} else
$gifif = exec("/sbin/ifconfig gif create");
$gifif = pfSense_interface_create("gif");
/* Do not change the order here for more see gif(4) NOTES section. */
mwexec("/sbin/ifconfig {$gifif} tunnel {$realifip} {$gif['remote-addr']}");
mwexec("/sbin/ifconfig {$gifif} {$gif['tunnel-local-addr']} {$gif['tunnel-remote-addr']} netmask " . gen_subnet_mask($gif['tunnel-remote-net']));
if (isset($gif['link0']) && $gif['link0'])
mwexec("/sbin/ifconfig {$gifif} link0");
pfSense_interface_flags($gifif, IFF_LINK0);
if (isset($gif['link1']) && $gif['link1'])
mwexec("/sbin/ifconfig {$gifif} link1");
pfSense_interface_flags($gifif, IFF_LINK1);
if($gifif)
interfaces_bring_up($gifif);
else
@ -690,6 +674,11 @@ function interfaces_configure() {
$delayed_list = array();
$bridge_list = array();
/* This is needed to speedup interfaces on bootup. */
$reload = false;
if ($g['booting'])
$reload = true;
foreach($iflist as $if => $ifname) {
$realif = $config['interfaces'][$if]['if'];
if(is_array($config['interfaces'][$if]['pppoe']) && isset($config['interfaces'][$if]['pppoe']['pppoe-reset-type']))
@ -707,7 +696,7 @@ function interfaces_configure() {
echo "Configuring {$ifname} interface...";
if($g['debug'])
log_error("Configuring {$ifname}");
interface_configure($if, true);
interface_configure($if, $reload);
if ($g['booting'])
echo "done.\n";
}
@ -728,7 +717,7 @@ function interfaces_configure() {
if ($g['debug'])
log_error("Configuring {$ifname}");
interface_configure($if, true);
interface_configure($if, $reload);
if ($g['booting'])
echo "done.\n";
@ -743,7 +732,7 @@ function interfaces_configure() {
if($g['debug'])
log_error("Configuring {$ifname}");
interface_configure($if, true);
interface_configure($if, $reload);
if ($g['booting'])
echo "done.\n";
@ -780,7 +769,7 @@ function interfaces_configure() {
function interface_reconfigure($interface = "wan") {
interface_bring_down($interface);
interface_configure($interface);
interface_configure($interface, true);
}
function interface_vip_bring_down(&$vip) {
@ -791,17 +780,17 @@ function interface_vip_bring_down(&$vip) {
case "ipalias":
$vipif = get_real_interface($vip['interface']);
if(does_interface_exist($vipif))
mwexec("/sbin/ifconfig {$vipif} delete {$vip['subnet']}");
pfSense_interface_deladdress($vipif, $vip['subnet']);
break;
case "carp":
$vipif = "vip" . $vip['vhid'];
if(does_interface_exist($vipif))
mwexec("/sbin/ifconfig {$vipif} destroy");
pfSense_interface_destroy($vipif);
break;
case "carpdev-dhcp":
$vipif = "vip" . $vip['vhid'];
if(does_interface_exist($vipif))
mwexec("/sbin/ifconfig {$vipif} destroy");
pfSense_interface_destroy($vipif);
break;
}
}
@ -840,7 +829,7 @@ function interface_bring_down($interface = "wan", $destroy = false) {
unlink_if_exists("{$g['varetc_path']}/dhclient_{$interface}.conf");
if(does_interface_exist("$realif")) {
mwexec("/sbin/ifconfig " . escapeshellarg($realif) . " delete", true);
mwexec("/sbin/ifconfig " . escapeshellarg($realif) . " down");
pfSense_interface_flags($realif, -IFF_UP);
mwexec("/usr/sbin/arp -d -i {$realif} -a");
}
break;
@ -852,7 +841,7 @@ function interface_bring_down($interface = "wan", $destroy = false) {
default:
if(does_interface_exist("$realif")) {
mwexec("/sbin/ifconfig " . escapeshellarg($realif) . " delete", true);
mwexec("/sbin/ifconfig " . escapeshellarg($realif) . " down");
pfSense_interface_flags($realif, -IFF_UP);
mwexec("/usr/sbin/arp -d -i {$realif} -a");
}
break;
@ -872,7 +861,7 @@ function interface_bring_down($interface = "wan", $destroy = false) {
if ($destroy == true) {
if (preg_match("/^tun|^ovpn|^gif|^gre|^lagg|^bridge|vlan/i", $realif))
mwexec("/sbin/ifconfig {$realif} destroy");
pfSense_interface_destroy($realif);
}
return;
@ -880,7 +869,10 @@ function interface_bring_down($interface = "wan", $destroy = false) {
function interface_ppp_configure($interface) {
global $config, $g;
if (!is_array($config['interfaces'][$interface]))
return;
$wancfg =& $config['interfaces'][$interface];
if (is_array($config['ppps']['ppp']) && count($config['ppps']['ppp'])) {
foreach ($config['ppps']['ppp'] as $ppp) {
@ -893,8 +885,9 @@ function interface_ppp_configure($interface) {
if ($interface == "wan")
$pppid = "0";
else
else {
$pppid = substr($interface, 3);
}
$pppif = "ppp{$pppid}";
@ -1311,11 +1304,11 @@ function interface_carp_configure(&$vip) {
/* create the carp interface and setup */
if (does_interface_exist($vipif)) {
interface_bring_down($vipif);
pfSense_interface_flags($vipif, -IFF_UP);
} else {
$carpif = exec("/sbin/ifconfig carp create");
mwexec("/sbin/ifconfig {$carpif} name {$vipif}");
mwexec("/usr/sbin/ngctl name {$carpif}: {$vipif}");
$carpif = pfSense_interface_create("carp");
pfSense_interface_rename($carpif, $vipif);
pfSense_ngctl_name("{$carpif}:", $vipif);
}
/* invalidate interface cache */
@ -1361,7 +1354,7 @@ function interface_carpdev_configure(&$vip) {
} else {
$carpdevif = exec("/sbin/ifconfig carp create");
mwexec("/sbin/ifconfig {$carpdevif} name {$vipif}");
mwexec("/usr/sbin/ngctl name {$carpdevif}: {$vipif}");
pfSense_ngctl_name("{$carpdevif}:", $vipif);
}
mwexec("/sbin/ifconfig {$vipif} carpdev {$realif} vhid {$vip['vhid']} advskew {$vip['advskew']} {$password}");
@ -1449,7 +1442,7 @@ function interface_wireless_clone($realif, $wlcfg) {
if($needs_clone == true) {
/* remove previous instance if it exists */
if(does_interface_exist($realif))
mwexec("/sbin/ifconfig {$realif} destroy");
pfSense_interface_destroy($realif);
log_error("Cloning new wireless interface {$realif}");
// Create the new wlan interface. FreeBSD returns the new interface name.
@ -1461,7 +1454,7 @@ function interface_wireless_clone($realif, $wlcfg) {
}
$newif = trim($out[0]);
// Rename the interface to {$parentnic}_wlan{$number}#: EX: ath0_wlan0
mwexec("/sbin/ifconfig {$newif} name {$realif} 2>&1", false);
pfSense_interface_rename($newif, $realif);
// FIXME: not sure what ngctl is for. Doesn't work.
// mwexec("/usr/sbin/ngctl name {$newif}: {$realif}", false);
}
@ -1896,6 +1889,18 @@ function interface_configure($interface = "wan", $reloadall = false) {
if ($wancfg['spoofmac']) {
mwexec("/sbin/ifconfig " . escapeshellarg($realif) .
" link " . escapeshellarg($wancfg['spoofmac']));
/*
* All vlans need to spoof their parent mac address, too. see
* ticket #1514: http://cvstrac.pfsense.com/tktview?tn=1514,33
*/
if (is_array($config['vlans']['vlan'])) {
foreach ($config['vlans']['vlan'] as $vlan) {
if ($vlan['if'] == $realif)
mwexec("/sbin/ifconfig " . escapeshellarg($vlan['vlanif']) .
" link " . escapeshellarg($wancfg['spoofmac']));
}
}
} else {
$mac = get_interface_mac(get_real_interface($wancfg['if']));
if($mac == "ff:ff:ff:ff:ff:ff") {
@ -1922,7 +1927,7 @@ function interface_configure($interface = "wan", $reloadall = false) {
mwexec($cmd);
}
if (!empty($wancfg['mtu']))
mwexec("/sbin/ifconfig " . escapeshellarg($realif) . " mtu {$wancfg['mtu']}");
pfSense_interface_mtu($realif, $wancfg['mtu']);
/* invalidate interface/ip/sn cache */
get_interface_arr(true);
@ -1948,10 +1953,7 @@ function interface_configure($interface = "wan", $reloadall = false) {
break;
default:
if ($wancfg['ipaddr'] <> "" && $wancfg['subnet'] <> "") {
if($wancfg['ipaddr'] && $wancfg['subnet'])
mwexec("/sbin/ifconfig " . escapeshellarg($realif) .
" " . escapeshellarg($wancfg['ipaddr'] . "/" .
$wancfg['subnet']));
pfSense_interface_setaddress($realif, "{$wancfg['ipaddr']}/{$wancfg['subnet']}");
} else if (substr($realif, 0, 3) == "gre") {
if (is_array($config['gres']['gre'])) {
foreach ($config['gres']['gre'] as $gre)
@ -2027,8 +2029,6 @@ function interface_configure($interface = "wan", $reloadall = false) {
}
}
unmute_kernel_msgs();
return 0;
}
@ -2112,7 +2112,10 @@ EOD;
function interface_pppoe_configure($interface = "wan") {
global $config, $g;
$wancfg = $config['interfaces'][$interface];
if (!is_array($config['interfaces'][$interface]))
return;
$wancfg =& $config['interfaces'][$interface];
/* generate mpd.conf */
$fd = fopen("{$g['varetc_path']}/mpd_{$interface}.conf", "w");
@ -2146,7 +2149,8 @@ EOD;
$realif = "pppoe0";
else {
// Here code assumes only that strings of form "opt#" will be passed.
$realif = "pppoe" . substr($interface, 3);
$pppoeidx = substr($interface, 3);
$realif = "pppoe{$pppoeidx}";
}
$mpdconf .= <<<EOD
@ -2270,7 +2274,10 @@ EOD;
function interface_pptp_configure($interface) {
global $config, $g;
$wancfg = $config['interfaces'][$interface];
if (!is_array($config['interfaces'][$interface]))
return;
$wancfg =& $config['interfaces'][$interface];
/* generate mpd.conf */
$fd = fopen("{$g['varetc_path']}/mpd_{$interface}.conf", "w");
@ -2304,8 +2311,9 @@ EOD;
$realif = "pptp0";
else {
// Here code assumes only that strings of form "opt#" will be passed.
$realif = "pptp" . substr($interface, 3);
}
$pptpidx = substr($interface, 3);
$realif = "pptp{$pptpidx}";
}
$mpdconf .= <<<EOD
create bundle static {$interface}
@ -2444,52 +2452,66 @@ function convert_real_interface_to_friendly_interface_name($interface = "wan") {
global $config;
if (stristr($interface, "pppoe")) {
$index = substr($interface, 5);
if (intval($index) > 0)
$index = intval(substr($interface, 5));
if ($interface == "pppoe")
return "lan";
if ($index > 0)
return "opt{$index}";
else
return "wan";
} else if (stristr($interface, "pptp")) {
$index = substr($interface, 4);
if (intval($index) > 0)
$index = intval(substr($interface, 4));
if ($interface == "pptp")
return "lan";
if ($index > 0)
return "opt{$index}";
else
return "wan";
} else if (stristr($interface, "ppp")) {
$index = intval(substr($interface, 3));
if ($interface == "ppp")
return "lan";
if ($index > 0)
return "opt{$index}";
else
return "wan";
} else if (stristr($interface, "l2tp")) {
$index = intval(substr($interface, 4));
if ($interface == "l2tp")
return "lan";
if ($index > 0)
return "opt{$index}";
else
return "wan";
} else if (stristr($interface, "vip")) {
$index = substr($interface, 3);
$counter = 0;
foreach ($config['virtualip']['vip'] as $vip) {
$index = intval(substr($interface, 3));
foreach ($config['virtualip']['vip'] as $counter => $vip) {
if ($vip['mode'] == "carpdev-dhcp" || $vip['mode'] == "carp") {
if (intval($index) == $counter)
if ($index == $counter)
return $vip['interface'];
$counter++;
}
}
} else if (stristr($interface, "carp")) {
$index = substr($interface, 4);
$counter = 0;
foreach ($config['virtualip']['vip'] as $vip) {
$index = intval(substr($interface, 4));
foreach ($config['virtualip']['vip'] as $counter => $vip) {
if ($vip['mode'] == "carpdev-dhcp" || $vip['mode'] == "carp") {
if (intval($index) == $counter)
if ($index == $counter)
return $vip['interface'];
$counter++;
}
}
}
/* if list */
$ifdescrs = get_configured_interface_list(false, true);
/* XXX: For speed reasons reference directly the interface array */
$ifdescrs = $config['interfaces'];
//$ifdescrs = get_configured_interface_list(false, true);
foreach ($ifdescrs as $if => $ifname) {
if($config['interfaces'][$if]['if'] == $interface)
return $ifname;
if ($config['interfaces'][$if]['if'] == $interface)
return $if;
/* XXX: ermal - The 3 lines below are totally bogus code. */
$int = interface_translate_type_to_real($if);
if($ifname == $interface)
return $ifname;
if($int == $interface)
if ($int == $interface)
return $ifname;
}
return NULL;
@ -2580,7 +2602,7 @@ function interface_get_wireless_clone($wlif) {
}
function get_real_interface($interface = "wan") {
global $config;
global $config;
$wanif = NULL;
@ -2605,78 +2627,60 @@ function get_real_interface($interface = "wan") {
$wanif = "ppp";
break;
default:
$iflist = get_configured_interface_with_descr(false, true);
// If a real interface was alread passed simply
// pass the real interface back. This encourages
// the usage of this function in more cases so that
// we can combine logic for more flexibility.
if(does_interface_exist($interface)) {
$wanif = $interface;
break;
}
if (empty($config['interfaces'][$interface]))
break;
foreach ($iflist as $if => $ifdesc) {
// If a real interface was alread passed simply
// pass the real interface back. This encourages
// the usage of this function in more cases so that
// we can combine logic for more flexibility.
if($config['interfaces'][$if]['if'] == $interface) {
if(does_interface_exist($interface)) {
$wanif = $interface;
break;
$cfg =& $config['interfaces'][$interface];
// Wireless cloned NIC support (FreeBSD 8+)
// interface name format: $parentnic_wlanparentnic#
// example: ath0_wlan0
if (is_interface_wireless($cfg['if'])) {
$wanif = interface_get_wireless_clone($cfg['if']);
break;
}
/*
if (empty($cfg['if'])) {
$wancfg = $cfg['if'];
break;
}
*/
switch ($cfg['ipaddr']) {
case "carpdev-dhcp":
$viparr = &$config['virtualip']['vip'];
if(is_array($viparr))
foreach ($viparr as $counter => $vip) {
if ($vip['mode'] == "carpdev-dhcp") {
if($vip['interface'] == $interface) {
$wanif = "carp{$counter}";
break;
}
}
}
}
if ($interface == $if || $interface == $ifdesc) {
$cfg = $config['interfaces'][$if];
// Wireless cloned NIC support (FreeBSD 8+)
// interface name format: $parentnic_wlanparentnic#
// example: ath0_wlan0
if(is_interface_wireless($cfg['if'])) {
$wanif = interface_get_wireless_clone($cfg['if']);
break;
}
if (empty($cfg['ipaddr'])) {
case "pppoe":
case "pptp":
case "l2tp":
case "ppp":
if ($interface == "wan")
$wanif = "{$cfg['ipaddr']}0";
else {
$idx = substr($interface, 3);
$wanif = "{$cfg['ipaddr']}{$idx}";
}
break;
default:
$wanif = $cfg['if'];
break;
}
switch ($cfg['ipaddr']) {
case "carpdev-dhcp":
$viparr = &$config['virtualip']['vip'];
$counter = 0;
if(is_array($viparr))
foreach ($viparr as $vip) {
if ($vip['mode'] == "carpdev-dhcp") {
if($vip['interface'] == $if) {
$wanif = "carp{$counter}";
break;
}
$counter++;
} else if ($vip['mode'] = "carp")
$counter++;
}
break;
case "pppoe":
if ($if == "wan")
$wanif = "pppoe0";
else
$wanif = "pppoe" . substr($if,3);
break;
case "pptp":
if ($if == "wan")
$wanif = "pptp0";
else
$wanif = "pptp" . substr($if, 3);
break;
case "ppp":
if ($if == "wan")
$wanif = "ppp0";
else
$wanif = "ppp" . substr($if, 3);
break;
default:
$wanif = $cfg['if'];
break;
}
break;
}
}
break;
}
@ -2924,10 +2928,6 @@ function get_interface_ip($interface = "wan")
return null;
}
/* Do we really come here for these interfaces ?! */
if (in_array($realif, array("pptp", "pppoe", "l2tp", "openvpn", "enc0" /* , "ppp" */)))
return "";
$curip = find_interface_ip($realif);
if ($curip && is_ipaddr($curip) && ($curip != "0.0.0.0"))
return $curip;
@ -2947,10 +2947,6 @@ function get_interface_subnet($interface = "wan")
return null;
}
/* Do we really come here for these interfaces ?! */
if (in_array($realif, array("pptp", "pppoe", "l2tp", "openvpn", "enc0" /* , "ppp" */)))
return "";
$cursn = find_interface_subnet($realif);
if (!empty($cursn))
return $cursn;
@ -2972,12 +2968,13 @@ function get_interfaces_with_gateway() {
case "carpdev-dhcp":
case "pppoe":
case "pptp":
case "l2tp":
case "ppp";
$ints[] = $ifdescr;
$ints[$ifdescr] = $ifdescr;
break;
default:
if (!empty($ifname['gateway']))
$ints[] = $ifdescr;
$ints[$ifdescr] = $ifdescr;
break;
}
}
@ -2986,10 +2983,25 @@ function get_interfaces_with_gateway() {
/* return true if interface has a gateway */
function interface_has_gateway($friendly) {
global $config;
$friendly = strtolower($friendly);
if (in_array($friendly, get_interfaces_with_gateway()))
return true;
if (!empty($config['interfaces'][$friendly])) {
$ifname =& $config['interfaces'][$friendly];
switch ($ifname['ipaddr']) {
case "dhcp":
case "carpdev-dhcp":
case "pppoe":
case "pptp":
case "l2tp":
case "ppp";
return true;
break;
default:
if (!empty($ifname['gateway']))
return true;
break;
}
}
return false;
}

View File

@ -188,13 +188,15 @@ function enable_hardware_offloading($interface) {
if($int <> "")
$interface = $int;
$int_family = preg_split("/[0-9]+/", $interface);
$options = strtolower(`/sbin/ifconfig -m {$interface} | grep capabilities`);
$options = pfSense_get_interface_addresses($interface);
if (!is_array($options))
return;
$supported_ints = array('fxp');
if (in_array($int_family, $supported_ints)) {
if(isset($config['system']['do_not_use_nic_microcode']))
continue;
if(does_interface_exist($interface))
mwexec("/sbin/ifconfig {$interface} link0");
pfSense_interface_flags($interface, IFF_LINK0);
}
/* skip vlans for checksumming and polling */
@ -202,26 +204,24 @@ function enable_hardware_offloading($interface) {
return;
if($config['system']['disablechecksumoffloading']) {
if(stristr($options, "txcsum") == true)
mwexec("/sbin/ifconfig {$interface} -txcsum 2>/dev/null");
if(stristr($options, "rxcsum") == true)
mwexec("/sbin/ifconfig {$interface} -rxcsum 2>/dev/null");
if (isset($options['encaps']['txcsum']))
pfSense_interface_capabilities($interface, -IFCAP_TXCSUM);
if (isset($options['encaps']['rxcsum']))
pfSense_interface_capabilities($interface, -IFCAP_RXCSUM);
} else {
if(stristr($options, "txcsum") == true)
mwexec("/sbin/ifconfig {$interface} txcsum 2>/dev/null");
if(stristr($options, "rxcsum") == true)
mwexec("/sbin/ifconfig {$interface} rxcsum 2>/dev/null");
if (isset($options['caps']['txcsum']))
pfSense_interface_capabilities($interface, IFCAP_TXCSUM);
if (isset($options['caps']['rxcsum']))
pfSense_interface_capabilities($interface, IFCAP_RXCSUM);
}
/* if the NIC supports polling *AND* it is enabled in the GUI */
if(interface_supports_polling($interface)) {
$polling = isset($config['system']['polling']);
if($polling) {
mwexec("/sbin/ifconfig {$interface} polling 2>/dev/null");
} else {
mwexec("/sbin/ifconfig {$interface} -polling 2>/dev/null");
}
}
$polling = isset($config['system']['polling']);
if($polling && isset($options['caps']['polling']))
pfSense_interface_capabilities($interface, IFCAP_POLLING);
else
pfSense_interface_capabilities($interface, -IFCAP_POLLING);
return;
}
@ -236,29 +236,10 @@ function enable_hardware_offloading($interface) {
*
******/
function interface_supports_polling($iface) {
$pattern = '/([a-z].*)[0-9]/';
preg_match($pattern, $iface, $iface2);
$interface=$iface2[1];
$supported_ints = array("bge",
"dc",
"em",
"fwe",
"fwip",
"fxp",
"ixgb",
"nfe",
"vge",
"re",
"rl",
"sf",
"sis",
"ste",
"stge",
"vge",
"vr",
"xl");
if(in_array($interface, $supported_ints))
$opts = pfSense_get_interface_addresses($iface);
if (is_array($opts) && isset($opts['caps']['polling']))
return true;
return false;
}

View File

@ -634,7 +634,7 @@ function enable_rrd_graphing() {
}
function kill_traffic_collector() {
mwexec("/bin/pkill -f updaterrd.sh");
mwexec("/bin/pkill -f updaterrd.sh", true);
}
/* This xml 2 array function is courtesy of the php.net comment section on xml_parse.

View File

@ -38,26 +38,6 @@
pfSense_MODULE: utils
*/
function services_parse_dhcpd_hostnames() {
global $g, $config;
// Launch if option enabled
if (isset($config['dnsmasq']['regdhcp'])) {
/* Make sure we do not error out */
@touch("{$g['dhcpd_chroot_path']}/var/db/dhcpd.leases");
if (!file_exists("{$g['varetc_path']}/hosts"))
system_hosts_generate();
if (file_exists("{$g['varrun_path']}/dhcpleases.pid"))
sigkillbypid("{$g['varrun_path']}/dhcpleases.pid", "HUP");
else
mwexec("/usr/local/sbin/dhcpleases -l {$g['dhcpd_chroot_path']}/var/db/dhcpd.leases -d {$config['system']['domain']} -p {$g['varrun_path']}/dnsmasq.pid -h {$g['varetc_path']}/hosts");
} else {
sigkillbypid("{$g['varrun_path']}/dhcpleases.pid", "TERM");
@unlink("{$g['varrun_path']}/dhcpleases.pid");
}
}
function services_dhcpd_configure() {
global $config, $g;
@ -648,9 +628,6 @@ function services_dnsmasq_configure() {
$return = 1;
}
// restart isc-dhcpd parser
services_parse_dhcpd_hostnames();
return $return;
}

View File

@ -225,6 +225,19 @@ function system_hosts_generate() {
fwrite($fd, $hosts);
fclose($fd);
/* Start the monitoring process for dynamic dhcpclients. */
if (isset($config['dnsmasq']['regdhcp'])) {
/* Make sure we do not error out */
@touch("{$g['dhcpd_chroot_path']}/var/db/dhcpd.leases");
if (file_exists("{$g['varrun_path']}/dhcpleases.pid"))
sigkillbypid("{$g['varrun_path']}/dhcpleases.pid", "HUP");
else
mwexec("/usr/local/sbin/dhcpleases -l {$g['dhcpd_chroot_path']}/var/db/dhcpd.leases -d {$syscfg['domain']} -p {$g['varrun_path']}/dnsmasq.pid -h {$g['varetc_path']}/hosts");
} else {
sigkillbypid("{$g['varrun_path']}/dhcpleases.pid", "TERM");
@unlink("{$g['varrun_path']}/dhcpleases.pid");
}
return 0;
}
@ -263,15 +276,29 @@ function system_routing_configure() {
$interfacegw = "";
/* tack on all the hard defined gateways as well */
if (is_array($config['gateways']['gateway_item'])) {
mwexec("/bin/rm {$g['tmp_path']}/*_defaultgw");
$foundgw = false;
foreach ($config['gateways']['gateway_item'] as $gateway) {
if (isset($gateway['defaultgw'])) {
if ($gateway['gateway'] == "dynamic")
$gateway['gateway'] = get_interface_gateway($gateway['interface']);
$gatewayip = $gateway['gateway'];
$interfacegw = $gateway['interface'];
if (!empty($interfacegw)) {
$defaultif = get_real_interface($gateway['interface']);
if ($defaultif)
@file_put_contents("{$g['tmp_path']}/{$defaultif}_defaultgw", $gatewayip);
}
$foundgw = true;
break;
}
}
if ($foundgw == false) {
$defaultif = get_real_interface("wan");
$interfacegw = "wan";
$gatewayip = get_interface_gateway("wan");
@touch("{$g['tmp_path']}/{$defaultif}_defaultgw");
}
}
$dont_add_route = false;
/* if OLSRD is enabled, allow WAN to house DHCP. */
@ -1418,4 +1445,4 @@ function system_get_dmesg_boot() {
return file_get_contents("{$g['varlog_path']}/dmesg.boot");
}
?>
?>

View File

@ -1539,6 +1539,11 @@ function upgrade_051_to_052() {
$csc['wins_server1'] = $csc['dhcp_wins'];
unset($csc['dhcp_wins']);
if (!empty($csc['disable']))
$csc['disable'] = true;
else
unset($csc['disable']);
$config['openvpn']['openvpn-csc'][] = $csc;
}
@ -1669,7 +1674,7 @@ function upgrade_054_to_055() {
global $g;
/* RRD files changed for quality, traffic and packets graphs */
ini_set("max_execution_time", "1800");
//ini_set("max_execution_time", "1800");
/* convert traffic RRD file */
global $parsedcfg, $listtags;
$listtags = array("ds", "v", "rra", "row");

4
etc/rc
View File

@ -171,7 +171,9 @@ if [ ! -h /tmp/tmp ]; then
fi
# Make sure our /tmp is 777 + Sticky
rm -rf /tmp/*
if [ ! "$PLATFORM" = "cdrom" ] ; then
rm -rf /tmp/*
fi
chmod 1777 /tmp
if [ ! "$PLATFORM" = "cdrom" ] ; then

View File

@ -161,7 +161,6 @@ $wan_if = get_real_interface();
* and ask the user to reassign interfaces. This will
* avoid a reboot and thats a good thing.
*/
unmute_kernel_msgs();
while(is_interface_mismatch() == true) {
echo "\nNetwork interface mismatch -- Running interface assignment option.\n";
set_networking_interfaces_ports();
@ -199,6 +198,10 @@ system_hosts_generate();
/* configure loopback interface */
interfaces_loopback_configure();
echo "Starting Secure Shell Services...";
mwexec_bg("/etc/sshd");
echo "done.\n";
/* set up interfaces */
if(!$debugging)
mute_kernel_msgs();
@ -261,10 +264,6 @@ system_routing_configure();
/* enable routing */
system_routing_enable();
echo "Starting Secure Shell Services...";
mwexec_bg("/etc/sshd");
echo "done.\n";
/* configure console menu */
system_console_configure();
@ -330,9 +329,6 @@ enable_rrd_graphing();
/* start DHCP service */
services_dhcpd_configure();
/* start DHCP logging service which populates /etc/hosts */
services_parse_dhcpd_hostnames();
/* startup OLSR if needed */
setup_wireless_olsr();
@ -379,4 +375,4 @@ led_normalize();
conf_mount_ro();
?>
?>

View File

@ -62,7 +62,7 @@ echo "10) Filter Logs"
echo "11) Restart webConfigurator"
echo "12) ${product} Developer Shell"
echo "13) Upgrade from console"
SSHD=`netstat -an | grep "*.22" | wc -l`
SSHD=`/usr/bin/sockstat -4l | grep "*.22" | wc -l`
if [ "$SSHD" -gt 0 ]; then
echo "14) Disable Secure Shell (sshd)";
else
@ -155,7 +155,7 @@ case ${opmode} in
fi
;;
"")
killall login ; exit
kill $PPID ; exit
;;
esac

View File

@ -23,11 +23,4 @@ fi
sleep 1
echo -n "Downing interfaces: "
for INTERFACE in `/sbin/ifconfig -l`; do
echo -n "$INTERFACE "
/sbin/ifconfig $INTERFACE down
done
/sbin/shutdown -r now

View File

@ -107,7 +107,7 @@ delete_old_routes() {
$LOGGER "Deleting old routes"
$ROUTE delete "$old_ip_address" $LOCALHOST >/dev/null 2>&1
# Only allow the default route to be overridden if it's on our own interface
DEFAULTROUTE_IFACE=`route get default | grep interface | awk '{print $2};'`
DEFAULTROUTE_IFACE=`/sbin/route get default | grep interface | awk '{print $2};'`
if [ -z "${DEFAULTROUTE_IFACE}" -o "{$interface}" = "${DEFAULTROUTE_IFACE}" ]; then
for router in $old_routers; do
if [ $if_defaultroute = x -o $if_defaultroute = $interface ]; then
@ -130,23 +130,22 @@ delete_old_routes() {
}
add_new_routes() {
$LOGGER "Adding new routes"
# $ROUTE add $new_ip_address $LOCALHOST >/dev/null 2>&1
$LOGGER "Adding new routes to interface: $interface"
# Only allow the default route to be overridden if it's on our own interface
DEFAULTROUTE_IFACE=`route get default | grep interface | awk '{print $2};'`
if [ -z "${DEFAULTROUTE_IFACE}" -o "{$interface}" = "${DEFAULTROUTE_IFACE}" ]; then
if [ -f "/tmp/${interface}_defaultgw" ]; then
$ROUTE delete default
for router in $new_routers; do
if [ "$new_ip_address" = "$router" ]; then
$ROUTE add default -iface $router
#>/dev/null 2>&1
echo $ROUTE add default -iface $router | $LOGGER
echo $new_routers > /tmp/${interface}_router
$ROUTE add default -iface $interface
echo $ROUTE add default -iface $interface | $LOGGER
echo $router > /tmp/${interface}_router
echo $router > /tmp/${interface}_defaultgw
else
$ROUTE add default $router
echo $ROUTE add default $router | $LOGGER
#>/dev/null 2>&1
echo $new_routers > /tmp/${interface}_router
echo $router > /tmp/${interface}_router
echo $router > /tmp/${interface}_defaultgw
fi
# 2nd and subsequent default routers error out, so explicitly
# stop processing the list after the first one.
@ -163,13 +162,6 @@ add_new_routes() {
echo $new_routers > /tmp/${interface}_router
done
fi
# last ditch effort if no route exists.
DEFAULTROUTE=`$NETSTAT -rn | $GREP default`
if [ -z "${DEFAULTROUTE}" ]; then
$ROUTE add default -iface $interface
fi
}
add_new_resolv_conf() {
@ -181,7 +173,7 @@ add_new_resolv_conf() {
if [ -n "$new_domain_name_servers" ]; then
# Remove old entries
for nameserver in `cat /var/etc/nameserver_$interface`; do
route delete $nameserver
$ROUTE delete $nameserver
done
rm -f /var/etc/nameserver_$interface
for nameserver in $new_domain_name_servers; do
@ -189,7 +181,7 @@ add_new_resolv_conf() {
# so that mulitple wans work correctly with multiple dns
# also backup the nameserver for later route removal
echo $nameserver >>/var/etc/nameserver_$interface
route add $nameserver -iface $interface
$ROUTE add $nameserver -iface $interface
done
echo $new_domain_name >/var/etc/defaultdomain.conf
fi
@ -219,9 +211,8 @@ if [ -f /etc/dhclient-enter-hooks ]; then
fi
fi
if [ -x $NETSTAT ]; then
$LOGGER "netstat"
if_defaultroute=`$NETSTAT -rn | $GREP "^default" | $AWK '{print $6}'`
if [ -x $ROUTE ]; then
if_defaultroute=`$ROUTE get default | $GREP interface | $AWK '{print $2}'`
else
$LOGGER "if_defaultroute"
if_defaultroute="x"

View File

@ -37,6 +37,8 @@ require_once("auth.inc");
require_once("functions.inc");
require_once("captiveportal.inc");
$errormsg = "Invalid credentials specified.";
header("Expires: 0");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
@ -140,14 +142,14 @@ exit;
// YES: user is good for $timecredit minutes.
captiveportal_logportalauth($voucher,$clientmac,$clientip,"Voucher login good for $timecredit min.");
} else {
portal_reply_page($redirurl, "error", $config['voucher']['msgexpired']);
portal_reply_page($redirurl, "error", $config['voucher']['msgexpired'] ? $config['voucher']['msgexpired']: $errormsg);
}
} else if (-1 == $timecredit) { // valid but expired
captiveportal_logportalauth($voucher,$clientmac,$clientip,"FAILURE","voucher expired");
portal_reply_page($redirurl, "error", $config['voucher']['msgexpired']);
portal_reply_page($redirurl, "error", $config['voucher']['msgexpired'] ? $config['voucher']['msgexpired']: $errormsg);
} else {
captiveportal_logportalauth($voucher,$clientmac,$clientip,"FAILURE");
portal_reply_page($redirurl, "error", $config['voucher']['msgnoaccess']);
portal_reply_page($redirurl, "error", $config['voucher']['msgnoaccess'] ? $config['voucher']['msgnoaccess'] : $errormsg);
}
} else if ($_POST['accept'] && $radius_enable) {
@ -162,15 +164,15 @@ exit;
if ($auth_list['auth_val'] == 1) {
captiveportal_logportalauth($_POST['auth_user'],$clientmac,$clientip,"ERROR",$auth_list['error']);
portal_reply_page($redirurl, $type, $auth_list['error']);
portal_reply_page($redirurl, $type, $auth_list['error'] ? $auth_list['error'] : $errormsg);
}
else if ($auth_list['auth_val'] == 3) {
captiveportal_logportalauth($_POST['auth_user'],$clientmac,$clientip,"FAILURE",$auth_list['reply_message']);
portal_reply_page($redirurl, $type, $auth_list['reply_message']);
portal_reply_page($redirurl, $type, $auth_list['reply_message'] ? $auth_list['reply_message'] : $errormsg);
}
} else {
captiveportal_logportalauth($_POST['auth_user'],$clientmac,$clientip,"ERROR");
portal_reply_page($redirurl, "error", "Invalid username/password specified.");
portal_reply_page($redirurl, "error", $errormsg);
}
} else if ($_POST['accept'] && $config['captiveportal']['auth_method'] == "local") {
@ -182,7 +184,7 @@ exit;
portal_allow($clientip, $clientmac,$_POST['auth_user']);
} else {
captiveportal_logportalauth($_POST['auth_user'],$clientmac,$clientip,"FAILURE");
portal_reply_page($redirurl, "error");
portal_reply_page($redirurl, "error", $errormsg);
}
} else if ($_POST['accept'] && $clientip) {
captiveportal_logportalauth("unauthenticated",$clientmac,$clientip,"ACCEPT");
@ -294,12 +296,20 @@ function portal_allow($clientip,$clientmac,$username,$password = null, $attribut
$mac = captiveportal_passthrumac_findbyname($username);
if (!empty($mac)) {
if ($_POST['replacemacpassthru']) {
foreach ($a_passthrumacs as $idx => $macent) {
foreach ($config['captiveportal']['passthrumac'] as $idx => $macent) {
if ($macent['mac'] == $mac['mac']) {
$macrules = "";
$ruleno = captiveportal_get_ipfw_passthru_ruleno($mac['mac']);
if ($ruleno) {
captiveportal_free_ipfw_ruleno($ruleno, true);
$macrules .= "delete {$ruleno}\n";
++$ruleno;
$macrules .= "delete {$ruleno}\n";
}
unset($config['captiveportal']['passthrumac'][$idx]);
$mac['mac'] = $clientmac;
$config['captiveportal']['passthrumac'][] = $mac;
$macrules = captiveportal_passthrumac_configure_entry($mac);
$macrules .= captiveportal_passthrumac_configure_entry($mac);
file_put_contents("{$g['tmp_path']}/macentry.rules.tmp", $macrules);
mwexec("/sbin/ipfw -q {$g['tmp_path']}/macentry.rules.tmp");
$writecfg = true;

View File

@ -408,9 +408,17 @@ function add_to_menu($url, $name) {
<div>
<span class="pgtitle"><?=genhtmltitle($pgtitle);?></font></span>
<?php if(! $g['disablehelpicon']): ?>
<span style="float:right; margin: 0 0 20px 20px;"><a href="<?php echo $helpurl; ?>" target="_new" title="Help for items on this page."><img src="/themes/<?php echo $g['theme']; ?>/images/help.png" border="0"></a></span>
<span style="float:right; margin: 0 0 20px 20px;">
<?php if(! empty($statusurl)): ?>
<a href="<?php echo $statusurl; ?>" target="_new" title="Status of items on this page."><img src="/themes/<?php echo $g['theme']; ?>/images/status.png" border="0"></a>
<?php endif; ?>
<?php if(! empty($logurl)): ?>
<a href="<?php echo $logurl; ?>" target="_new" title="Log entries for items on this page."><img src="/themes/<?php echo $g['theme']; ?>/images/log.png" border="0"></a>
<?php endif; ?>
<?php if(! $g['disablehelpicon']): ?>
<a href="<?php echo $helpurl; ?>" target="_new" title="Help for items on this page."><img src="/themes/<?php echo $g['theme']; ?>/images/help.png" border="0"></a>
<?php endif; ?>
</span>
</div>
<br />

View File

@ -42,6 +42,9 @@
##|-PRIV
$pgtitle = array("Firewall", "Rules");
$statusurl = "status_filter_reload.php";
$logurl = "diag_logs_filter.php";
require("guiconfig.inc");
require_once("functions.inc");
require_once("filter.inc");

View File

@ -549,6 +549,9 @@ read_layer7_config();
$l7clist =& get_l7_unique_list();
$pgtitle = array("Firewall","Rules","Edit");
$statusurl = "status_filter_reload.php";
$logurl = "diag_logs_filter.php";
$closehead = false;
$page_filename = "firewall_rules_edit.php";

View File

@ -52,6 +52,7 @@ if($_GET['reset'] <> "") {
}
$pgtitle = array("Firewall","Traffic Shaper");
$statusurl = "status_queues.php";
$shaperIFlist = get_configured_interface_with_descr();
read_altq_config();

View File

@ -57,6 +57,7 @@ $show_proto_form = false;
//More variables
$pgtitle = array("Firewall","Traffic Shaper", "Layer7");
$statusurl = "status_queues.php";
$output_form = "";

View File

@ -170,6 +170,7 @@ if ($_POST['apply']) {
}
$pgtitle = "Firewall: Shaper: By Queues View";
$statusurl = "status_queues.php";
include("head.inc");
?>

View File

@ -52,6 +52,7 @@ if($_GET['reset'] <> "") {
}
$pgtitle = array("Firewall","Traffic Shaper", "Limiter");
$statusurl = "status_queues.php";
read_dummynet_config();
/*

View File

@ -71,6 +71,7 @@ if ($_POST['apply']) {
}
$pgtitle = array("Firewall", "Traffic Shaper", "Wizards");
$statusurl = "status_queues.php";
$wizards = array("Single Lan multi Wan" => "traffic_shaper_wizard.xml",
"Single Wan multi Lan" => "traffic_shaper_wizard_multi_lan.xml",

View File

@ -155,7 +155,7 @@ if ($_POST) {
if (isset($id) && ($a_vip[$id])) {
if ($a_vip[$id]['mode'] != $_POST['mode'])
interface_bring_down($a_vip[$id]);
interface_bring_down($a_vip[$id]['interface']);
}
if (!$input_errors) {

View File

@ -165,7 +165,7 @@ EOF;
if ($fd) {
while (!feof($fd)) {
$dmesgl = fgets($fd);
if (preg_match("/^hifn.: (.*?),/", $dmesgl, $matches) or preg_match("/^safe.: (.*?),/", $dmesgl, $matches) or preg_match("/^ubsec.: (.*?),/", $dmesgl, $matches) or preg_match("/^padlock.: <(.*?)>,/", $dmesgl, $matches) or preg_match("/^glxsb.: (.*?),/", $dmesgl, $matches)) {
if (preg_match("/^hifn.: (.*?),/", $dmesgl, $matches) or preg_match("/.*(VIA Padlock)/", $dmesgl, $matches) or preg_match("/^safe.: (.*?),/", $dmesgl, $matches) or preg_match("/^ubsec.: (.*?),/", $dmesgl, $matches) or preg_match("/^padlock.: <(.*?)>,/", $dmesgl, $matches) or preg_match("/^glxsb.: (.*?),/", $dmesgl, $matches)) {
$hwcrypto = $matches[1];
break;
}

View File

@ -29,6 +29,25 @@
require("guiconfig.inc");
if($g['platform'] == "pfSense" or $g['platform'] == "nanobsd") {
Header("Location: /index.php");
exit;
}
// Main switch dispatcher
switch ($_REQUEST['state']) {
case "quickeasyinstall":
quickeasyinstall_gui();
break;
case "update_installer_status":
update_installer_status();
exit;
case "quickeasyinstall":
begin_quick_easy_install();
default:
installer_main();
}
function write_out_pc_sysinstaller_config($disk) {
$fd = fopen("/PCBSD/pc-sysinstall/examples/pfSense-install.cfg", "w");
if(!$fd) {
@ -73,6 +92,10 @@ EOF;
function start_installation() {
$fd = fopen("/tmp/installer.sh", "w");
if(!$fd) {
die("Could not open /tmp/installer.sh for writing");
exit;
}
fwrite($fd, "/PCBSD/pc-sysinstall/pc-sysinstall -c /PCBSD/pc-sysinstall/examples/pfSense-install.cfg && touch /tmp/install_complete");
fclose($fd);
exec("chmod a+rx /tmp/installer.sh");
@ -115,166 +138,139 @@ function begin_quick_easy_install() {
start_installation();
}
if($_REQUEST['state'] == "update_installer_status") {
update_installer_status();
exit;
function body_html() {
$pfSversion = str_replace("\n", "", file_get_contents("/etc/version"));
if(strstr($pfSversion, "1.2"))
$one_two = true;
$pgtitle = "pfSense: Installer";
include("head.inc");
echo <<<EOF
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<script src="/javascript/scriptaculous/prototype.js" type="text/javascript"></script>
<script type="text/javascript">
function getinstallerprogress() {
url = 'installer.php';
pars = 'state=update_installer_status';
callajax(url, pars, installcallback);
}
function callajax(url, pars, activitycallback) {
var myAjax = new Ajax.Request(
url,
{
method: 'post',
parameters: pars,
onComplete: activitycallback
});
}
function installcallback(transport) {
this.document.forms[0].installeroutput.value=transport.responseText;
setTimeout('getinstallerprogress()', 1000);
}
</script>
EOF;
include("fbegin.inc");
if($one_two)
echo "<p class=\"pgtitle\">{$pgtitle}</font></p>";
if ($savemsg) print_info_box($savemsg);
}
if($_REQUEST['step1_post']) {
}
if($_REQUEST['step2_post']) {
}
if($_REQUEST['step3_post']) {
}
if($_REQUEST['step4_post']) {
}
$pfSversion = str_replace("\n", "", file_get_contents("/etc/version"));
if(strstr($pfSversion, "1.2"))
$one_two = true;
$pgtitle = "pfSense: Installer";
include("head.inc");
?>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<script src="/javascript/scriptaculous/prototype.js" type="text/javascript"></script>
<script type="text/javascript">
function getinstallerprogress() {
url = 'installer.php';
pars = 'state=update_installer_status';
callajax(url, pars, installcallback);
}
function callajax(url, pars, activitycallback) {
var myAjax = new Ajax.Request(
url,
{
method: 'post',
parameters: pars,
onComplete: activitycallback
});
}
function installcallback(transport) {
this.document.forms[0].installeroutput.value=transport.responseText;
setTimeout('getinstallerprogress()', 1000);
}
</script>
<?php include("fbegin.inc"); ?>
<?php if($one_two): ?>
<p class="pgtitle"><?=$pgtitle?></font></p>
<?php endif; ?>
<?php if ($savemsg) print_info_box($savemsg); ?>
<?php
if($_REQUEST['state'] == "quickeasyinstall") {
quickeasyinstall_gui();
} else {
installer_main();
function end_html() {
echo "</form>";
include("fend.inc");
echo "</body>";
echo "</html>";
}
function template() {
echo <<<EOF
<div id="mainlevel">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<div id="mainarea">
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="tabcont" >
<form action="installer.php" method="post">
<div id="pfsensetemplate">
body_html();
echo <<<EOF
<div id="mainlevel">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<div id="mainarea">
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="tabcont" >
<form action="installer.php" method="post">
<div id="pfsensetemplate">
</div>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
</div>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
EOF;
end_html();
}
function quickeasyinstall_gui() {
body_html();
echo <<<EOF
<div id="mainlevel">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<div id="mainarea">
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="tabcont" >
<form action="installer.php" method="post" state="step1_post">
<div id="pfsenseinstaller">
Starting Installer... Please wait...<p/>
{{ Insert progressbar here }}<p/>
<textarea name='installeroutput' id='installeroutput' rows="20" cols="80">
</textarea>
</div>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
<script type="text/javascript">setTimeout('getinstallerprogress()', 250);</script>
<div id="mainlevel">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<div id="mainarea">
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="tabcont" >
<form action="installer.php" method="post" state="step1_post">
<div id="pfsenseinstaller">
Starting Installer... Please wait...<p/>
{{ Insert progressbar here }}<p/>
<textarea name='installeroutput' id='installeroutput' rows="20" cols="80">
</textarea>
</div>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
<script type="text/javascript">setTimeout('getinstallerprogress()', 250);</script>
EOF;
end_html();
}
function installer_main() {
echo <<<EOF
<div id="mainlevel">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<div id="mainarea">
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="tabcont" >
<form action="installer.php" method="post" state="step1_post">
<div id="pfsenseinstaller">
<a href='installer.php?state=quickeasyinstall'>Quick/Easy installation</a>
</p>
</div>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
body_html();
$disk = installer_find_first_disk();
if(!$disk)
echo "WARNING: Could not find any suitable disks for installation.";
echo <<<EOF
<div id="mainlevel">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<div id="mainarea">
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="tabcont" >
<form action="installer.php" method="post" state="step1_post">
<div id="pfsenseinstaller">
<a onclick="return confirm('Are you sure you want to install pfSense to $disk?')"> href='installer.php?state=quickeasyinstall'>Quick/Easy installation</a>
</p>
</div>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
EOF;
end_html();
}
?>
</form>
<?php include("fend.inc"); ?>
</body>
</html>
<?php
if($_REQUEST['state'] == "quickeasyinstall") {
begin_quick_easy_install();
}
?>
?>

View File

@ -44,14 +44,14 @@
##|*MATCH=interfaces.php*
##|-PRIV
require("guiconfig.inc");
require("ipsec.inc");
require("functions.inc");
require("captiveportal.inc");
require("filter.inc");
require("shaper.inc");
require("rrd.inc");
require("vpn.inc");
require_once("guiconfig.inc");
require_once("ipsec.inc");
require_once("functions.inc");
require_once("captiveportal.inc");
require_once("filter.inc");
require_once("shaper.inc");
require_once("rrd.inc");
require_once("vpn.inc");
if ($_REQUEST['if']) {
$if = $_REQUEST['if'];
@ -828,6 +828,8 @@ function check_wireless_mode() {
}
$pgtitle = array("Interfaces", $pconfig['descr']);
$statusurl = "status_interfaces.php";
$closehead = false;
include("head.inc");
$types = array("none" => "None", "static" => "Static", "dhcp" => "DHCP", "pppoe" => "PPPoE", "pptp" => "PPTP" /* , "carpdev-dhcp" => "CarpDev"*/);

View File

@ -41,6 +41,8 @@
##|-PRIV
$pgtitle = array("Interfaces", "Assign network ports");
$statusurl = "status_interfaces.php";
require("guiconfig.inc");
require("functions.inc");
require("filter.inc");

View File

@ -86,6 +86,10 @@ if ($_GET['act'] == "del") {
}
$pgtitle = array("Services", "Load Balancer","Monitor");
#$statusurl = "status_slbd_vs.php";
$statusurl = "status_slbd_pool.php";
$logurl = "diag_logs_relayd.php";
include("head.inc");
?>

View File

@ -188,6 +188,10 @@ if ($_POST) {
}
$pgtitle = array("Services", "Load Balancer","Monitor","Edit");
#$statusurl = "status_slbd_vs.php";
$statusurl = "status_slbd_pool.php";
$logurl = "diag_logs_relayd.php";
include("head.inc");
$types = array("icmp" => "ICMP", "tcp" => "TCP", "http" => "HTTP", "https" => "HTTPS", "send" => "Send/Expect");

View File

@ -95,6 +95,10 @@ for ($i = 0; isset($config['load_balancer']['lbpool'][$i]); $i++) {
}
$pgtitle = array("Services", "Load Balancer","Pool");
#$statusurl = "status_slbd_vs.php";
$statusurl = "status_slbd_pool.php";
$logurl = "diag_logs_relayd.php";
include("head.inc");
?>

View File

@ -138,6 +138,10 @@ if ($_POST) {
}
$pgtitle = array("Services", "Load Balancer","Pool","Edit");
#$statusurl = "status_slbd_vs.php";
$statusurl = "status_slbd_pool.php";
$logurl = "diag_logs_relayd.php";
include("head.inc");
?>

View File

@ -102,6 +102,10 @@ if ($_GET['act'] == "del") {
*/
$pgtitle = array("Services", "Load Balancer","Relay Action");
#$statusurl = "status_slbd_vs.php";
$statusurl = "status_slbd_pool.php";
$logurl = "diag_logs_relayd.php";
include("head.inc");
?>

View File

@ -176,6 +176,10 @@ if ($_POST) {
}
$pgtitle = array("Services", "Load Balancer","Relay Action","Edit");
#$statusurl = "status_slbd_vs.php";
$statusurl = "status_slbd_pool.php";
$logurl = "diag_logs_relayd.php";
include("head.inc");
$types = array("http" => "HTTP", "tcp" => "TCP", "dns" => "DNS");
?>

View File

@ -98,6 +98,10 @@ if ($_GET['act'] == "del") {
*/
$pgtitle = array("Services", "Load Balancer","Relay Protocol");
#$statusurl = "status_slbd_vs.php";
$statusurl = "status_slbd_pool.php";
$logurl = "diag_logs_relayd.php";
include("head.inc");
?>

View File

@ -132,6 +132,10 @@ if ($_POST) {
}
$pgtitle = array("Services", "Load Balancer","Relay Protocol","Edit");
#$statusurl = "status_slbd_vs.php";
$statusurl = "status_slbd_pool.php";
$logurl = "diag_logs_relayd.php";
include("head.inc");
$types = array("http" => "HTTP", "tcp" => "TCP", "dns" => "DNS");

View File

@ -94,6 +94,10 @@ for ($i = 0; isset($config['load_balancer']['virtual_server'][$i]); $i++) {
}
$pgtitle = array("Services","Load Balancer","Virtual Servers");
$statusurl = "status_slbd_vs.php";
#$statusurl = "status_slbd_pool.php";
$logurl = "diag_logs_relayd.php";
include("head.inc");
?>

View File

@ -129,6 +129,10 @@ if ($_POST) {
}
$pgtitle = array("Services", "Load Balancer","Virtual Server","Edit");
$statusurl = "status_slbd_vs.php";
#$statusurl = "status_slbd_pool.php";
$logurl = "diag_logs_relayd.php";
include("head.inc");
?>

View File

@ -39,6 +39,9 @@
##|-PRIV
$pgtitle = array("Services","Captive portal");
$statusurl = "status_captiveportal.php";
$logurl = "diag_logs_auth.php";
require("guiconfig.inc");
require("functions.inc");
require("filter.inc");
@ -288,7 +291,6 @@ function enable_change(enable_change) {
$tab_array[] = array("Allowed IP addresses", false, "services_captiveportal_ip.php");
$tab_array[] = array("Vouchers", false, "services_captiveportal_vouchers.php");
$tab_array[] = array("File Manager", false, "services_captiveportal_filemanager.php");
$tab_array[] = array("Auth Logs", false, "diag_logs_auth.php");
display_top_tabs($tab_array);
?> </td></tr>
<tr>

View File

@ -50,6 +50,9 @@ function cpelements_sort() {
}
$pgtitle = array("Services","Captive portal");
$statusurl = "status_captiveportal.php";
$logurl = "diag_logs_auth.php";
require("guiconfig.inc");
require("functions.inc");
@ -137,7 +140,6 @@ include("head.inc");
$tab_array[] = array("Allowed IP addresses", false, "services_captiveportal_ip.php");
$tab_array[] = array("Vouchers", false, "services_captiveportal_vouchers.php");
$tab_array[] = array("File Manager", true, "services_captiveportal_filemanager.php");
$tab_array[] = array("Auth Logs", false, "diag_logs_auth.php");
display_top_tabs($tab_array);
?> </td></tr>
<tr>

View File

@ -40,6 +40,9 @@
##|-PRIV
$pgtitle = array("Services","Captive portal");
$statusurl = "status_captiveportal.php";
$logurl = "diag_logs_auth.php";
require("guiconfig.inc");
require("functions.inc");
require("filter.inc");
@ -85,7 +88,6 @@ include("head.inc");
$tab_array[] = array("Allowed IP addresses", true, "services_captiveportal_ip.php");
$tab_array[] = array("Vouchers", false, "services_captiveportal_vouchers.php");
$tab_array[] = array("File Manager", false, "services_captiveportal_filemanager.php");
$tab_array[] = array("Auth Logs", false, "diag_logs_auth.php");
display_top_tabs($tab_array);
?>
</td></tr>

View File

@ -50,6 +50,9 @@ function allowedips_sort() {
}
$pgtitle = array("Services","Captive portal","Edit allowed IP address");
$statusurl = "status_captiveportal.php";
$logurl = "diag_logs_auth.php";
require("guiconfig.inc");
require("functions.inc");
require("filter.inc");

View File

@ -39,6 +39,9 @@
##|-PRIV
$pgtitle = array("Services","Captive portal");
$statusurl = "status_captiveportal.php";
$logurl = "diag_logs_auth.php";
require("guiconfig.inc");
require("functions.inc");
require("filter.inc");
@ -83,6 +86,7 @@ if ($_POST) {
if ($found == true) {
$ruleno = captiveportal_get_ipfw_passthru_ruleno($_POST['delmac']);
if ($ruleno) {
captiveportal_free_ipfw_ruleno($ruleno, true);
mwexec("/sbin/ipfw delete {$ruleno}; /sbin/ipfw delete " . ++$ruleno);
}
unset($a_passthrumacs[$idx]);
@ -125,7 +129,6 @@ include("head.inc");
$tab_array[] = array("Allowed IP addresses", false, "services_captiveportal_ip.php");
$tab_array[] = array("Vouchers", false, "services_captiveportal_vouchers.php");
$tab_array[] = array("File Manager", false, "services_captiveportal_filemanager.php");
$tab_array[] = array("Auth Logs", false, "diag_logs_auth.php");
display_top_tabs($tab_array);
?>
</td></tr>

View File

@ -49,6 +49,9 @@ function passthrumacs_sort() {
}
$pgtitle = array("Services","Captive portal","Edit pass-through MAC address");
$statusurl = "status_captiveportal.php";
$logurl = "diag_logs_auth.php";
require("guiconfig.inc");
require("functions.inc");
require("filter.inc");

View File

@ -37,6 +37,9 @@
##|-PRIV
$pgtitle = array("Services", "Captive portal", "Vouchers");
$statusurl = "status_captiveportal_vouchers.php";
$logurl = "diag_logs_auth.php";
require("guiconfig.inc");
require("functions.inc");
require("filter.inc");
@ -244,7 +247,6 @@ function enable_change(enable_change) {
$tab_array[] = array("Allowed IP addresses", false, "services_captiveportal_ip.php");
$tab_array[] = array("Vouchers", true, "services_captiveportal_vouchers.php");
$tab_array[] = array("File Manager", false, "services_captiveportal_filemanager.php");
$tab_array[] = array("Auth Logs", false, "diag_logs_auth.php");
display_top_tabs($tab_array);
?>
</ul>

View File

@ -36,6 +36,9 @@
##|-PRIV
$pgtitle = array("Services", "Captive portal", "Edit Voucher Rolls");
$statusurl = "status_captiveportal_vouchers.php";
$logurl = "diag_logs_auth.php";
require("guiconfig.inc");
require("functions.inc");
require("filter.inc");

View File

@ -373,6 +373,9 @@ if ($_GET['act'] == "del") {
}
$pgtitle = array("Services","DHCP server");
$statusurl = "diag_dhcp_leases.php";
$logurl = "diag_logs_dhcp.php";
include("head.inc");
?>

View File

@ -177,6 +177,9 @@ if ($_POST) {
}
$pgtitle = array("Services","DHCP","Edit static mapping");
$statusurl = "diag_dhcp_leases.php";
$logurl = "diag_logs_dhcp.php";
include("head.inc");
?>

View File

@ -86,6 +86,8 @@ if ($_GET['act'] == "del") {
}
$pgtitle = array(gettext("System"),gettext("Gateway Groups"));
$statusurl = "status_gateway_groups.php";
include("head.inc");
?>

View File

@ -141,6 +141,8 @@ if ($_POST) {
}
$pgtitle = array(gettext("System"),gettext("Gateways"),gettext("Edit gateway"));
$statusurl = "status_gateway_groups.php";
include("head.inc");
?>

View File

@ -118,6 +118,8 @@ if ($_GET['act'] == "del") {
$pgtitle = array(gettext("System"),gettext("Gateways"));
$statusurl = "status_gateways.php";
include("head.inc");
?>

View File

@ -76,7 +76,7 @@ if (isset($id) && $a_gateways[$id]) {
$pconfig['down'] = $a_gateway_item[$id]['down'];
if (isset($a_gateways[$id]['dynamic']))
$pconfig['dynamic'] = true;
if($a_gateways[$id]['monitor'] <> "") {
if(($a_gateways[$id]['monitor'] <> "") && ($a_gateways[$id]['attribute'] != "system") && ($a_gateways[$id]['gateway'] != "dynamic")) {
$pconfig['monitor'] = $a_gateways[$id]['monitor'];
} else {
$pconfig['monitor'] == "";
@ -279,6 +279,8 @@ if ($_POST) {
$pgtitle = array(gettext("System"),gettext("Gateways"),gettext("Edit gateway"));
$statusurl = "status_gateways.php";
include("head.inc");
?>
@ -346,7 +348,7 @@ function show_advanced_gateway() {
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Gateway"); ?></td>
<td width="78%" class="vtable">
<input name="gateway" type="text" class="formfld host" id="gateway" size="40" value="<?php echo $pconfig['gateway']; ?>" <?php if ($pconfig['dynamic'] == true && $pconfig['attribute'] == "system") echo "disabled"; ?>>
<input name="gateway" type="text" class="formfld host" id="gateway" size="40" value="<?php if ($pconfig['dynamic']) echo "dynamic"; else echo $pconfig['gateway']; ?>" <?php if ($pconfig['dynamic'] && $pconfig['attribute'] == "system") echo "disabled"; ?>>
<br> <span class="vexpl"><?=gettext("Gateway IP address"); ?></span></td>
</tr>
<tr>
@ -361,7 +363,7 @@ function show_advanced_gateway() {
<td width="22%" valign="top" class="vncell"><?=gettext("Monitor IP"); ?></td>
<td width="78%" class="vtable">
<?php
if(is_numeric($pconfig['attribute']) && ($pconfig['gateway'] == dynamic) && ($pconfig['monitor'] == "")) {
if(($pconfig['attribute'] == "system") && ($pconfig['gateway'] == "dynamic") && ($pconfig['monitor'] == "")) {
$monitor = "";
} else {
$monitor = htmlspecialchars($pconfig['monitor']);

View File

@ -99,6 +99,8 @@ if ($_GET['act'] == "del") {
}
$pgtitle = array(gettext("System"),gettext("Static Routes"));
$statusurl = "diag_routes.php";
include("head.inc");
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -124,6 +124,9 @@ if ($_GET['act'] == "delph2")
}
$pgtitle = array("VPN","IPsec");
$statusurl = "diag_ipsec.php";
$logurl = "diag_logs_ipsec.php";
include("head.inc");
?>
@ -145,7 +148,6 @@ include("head.inc");
$tab_array[0] = array("Tunnels", true, "vpn_ipsec.php");
$tab_array[1] = array("Mobile clients", false, "vpn_ipsec_mobile.php");
$tab_array[2] = array("Pre-shared keys", false, "vpn_ipsec_keys.php");
$tab_array[3] = array("Logs", false, "diag_logs_ipsec.php");
display_top_tabs($tab_array);
?>
</td>

View File

@ -69,6 +69,9 @@ if ($_GET['act'] == "del") {
}
$pgtitle = "VPN: IPsec: Keys";
$statusurl = "diag_ipsec.php";
$logurl = "diag_logs_ipsec.php";
include("head.inc");
?>
@ -90,7 +93,6 @@ if (is_subsystem_dirty('ipsec'))
$tab_array[0] = array("Tunnels", false, "vpn_ipsec.php");
$tab_array[1] = array("Mobile clients", false, "vpn_ipsec_mobile.php");
$tab_array[2] = array("Pre-shared keys", true, "vpn_ipsec_keys.php");
$tab_array[3] = array("Logs", false, "diag_logs_ipsec.php");
display_top_tabs($tab_array);
?>
</td></tr>

View File

@ -112,6 +112,9 @@ if ($_POST) {
}
$pgtitle = "VPN: IPsec: Edit pre-shared key";
$statusurl = "diag_ipsec.php";
$logurl = "diag_logs_ipsec.php";
include("head.inc");
?>

View File

@ -211,6 +211,9 @@ if ($_POST['submit']) {
}
$pgtitle = array("VPN","IPsec","Mobile");
$statusurl = "diag_ipsec.php";
$logurl = "diag_logs_ipsec.php";
include("head.inc");
?>
@ -308,7 +311,6 @@ function login_banner_change() {
$tab_array[0] = array("Tunnels", false, "vpn_ipsec.php");
$tab_array[1] = array("Mobile clients", true, "vpn_ipsec_mobile.php");
$tab_array[2] = array("Pre-shared keys", false, "vpn_ipsec_keys.php");
$tab_array[3] = array("Logs", false, "diag_logs_ipsec.php");
display_top_tabs($tab_array);
?>
</td>

View File

@ -333,6 +333,9 @@ if ($pconfig['mobile'])
$pgtitle = array("VPN","IPsec","Edit Phase 1", "Mobile Client");
else
$pgtitle = array("VPN","IPsec","Edit Phase 1");
$statusurl = "diag_ipsec.php";
$logurl = "diag_logs_ipsec.php";
include("head.inc");
@ -457,7 +460,6 @@ function dpdchkbox_change() {
$tab_array[0] = array("Tunnels", true, "vpn_ipsec.php");
$tab_array[1] = array("Mobile clients", false, "vpn_ipsec_mobile.php");
$tab_array[2] = array("Pre-shared keys", false, "vpn_ipsec_keys.php");
$tab_array[3] = array("Logs", false, "diag_logs_ipsec.php");
display_top_tabs($tab_array);
?>
</td>

View File

@ -199,6 +199,9 @@ if ($pconfig['mobile'])
$pgtitle = array("VPN","IPsec","Edit Phase 2", "Mobile Client");
else
$pgtitle = array("VPN","IPsec","Edit Phase 2");
$statusurl = "diag_ipsec.php";
$logurl = "diag_logs_ipsec.php";
include("head.inc");
@ -314,7 +317,6 @@ function change_protocol() {
$tab_array[0] = array("Tunnels", true, "vpn_ipsec.php");
$tab_array[1] = array("Mobile clients", false, "vpn_ipsec_mobile.php");
$tab_array[2] = array("Pre-shared keys", false, "vpn_ipsec_keys.php");
$tab_array[3] = array("Logs", false, "diag_logs_ipsec.php");
display_top_tabs($tab_array);
?>
</td>

View File

@ -38,6 +38,8 @@ require("guiconfig.inc");
require_once("openvpn.inc");
$pgtitle = array("OpenVPN", "Client");
$statusurl = "status_openvpn.php";
$logurl = "diag_logs_openvpn.php";
if (!is_array($config['openvpn']['openvpn-client']))
$config['openvpn']['openvpn-client'] = array();
@ -344,7 +346,6 @@ function autotls_change() {
$tab_array[] = array(gettext("Client"), true, "vpn_openvpn_client.php");
$tab_array[] = array(gettext("Client Specific Overrides"), false, "vpn_openvpn_csc.php");
$tab_array[] = array(gettext("Wizards"), false, "wizard.php?xml=openvpn_wizard.xml");
$tab_array[] = array(gettext("Logs"), false, "diag_logs_openvpn.php");
add_package_tabs("OpenVPN", $tab_array);
display_top_tabs($tab_array);
?>

View File

@ -38,6 +38,8 @@ require("guiconfig.inc");
require_once("openvpn.inc");
$pgtitle = array("OpenVPN", "Client Specific Override");
$statusurl = "status_openvpn.php";
$logurl = "diag_logs_openvpn.php";
if (!is_array($config['openvpn']['openvpn-csc']))
$config['openvpn']['openvpn-csc'] = array();
@ -69,7 +71,7 @@ if($_GET['act']=="edit"){
if (isset($id) && $a_csc[$id]) {
$pconfig['custom_options'] = $a_csc[$id]['custom_options'];
$pconfig['disable'] = $a_csc[$id]['disable'];
$pconfig['disable'] = isset($a_csc[$id]['disable']);
$pconfig['common_name'] = $a_csc[$id]['common_name'];
$pconfig['block'] = $a_csc[$id]['block'];
$pconfig['description'] = $a_csc[$id]['description'];
@ -168,7 +170,8 @@ if ($_POST) {
$csc = array();
$csc['custom_options'] = $pconfig['custom_options'];
$csc['disable'] = $pconfig['disable'];
if ($_POST['disable'] == "yes")
$csc['disable'] = true;
$csc['common_name'] = $pconfig['common_name'];
$csc['block'] = $pconfig['block'];
$csc['description'] = $pconfig['description'];
@ -291,7 +294,6 @@ function netbios_change() {
$tab_array[] = array(gettext("Client"), false, "vpn_openvpn_client.php");
$tab_array[] = array(gettext("Client Specific Overrides"), true, "vpn_openvpn_csc.php");
$tab_array[] = array(gettext("Wizards"), false, "wizard.php?xml=openvpn_wizard.xml");
$tab_array[] = array(gettext("Logs"), false, "diag_logs_openvpn.php");
add_package_tabs("OpenVPN", $tab_array);
display_top_tabs($tab_array);
?>
@ -314,7 +316,7 @@ function netbios_change() {
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<?php set_checked($pconfig['disable'],$chk); ?>
<?php set_checked(isset($pconfig['disable']),$chk); ?>
<input name="disable" type="checkbox" value="yes" <?=$chk;?>/>
</td>
<td>
@ -676,7 +678,7 @@ function netbios_change() {
$i = 0;
foreach($a_csc as $csc):
$disabled = "NO";
if ($csc['disable'])
if (isset($csc['disable']))
$disabled = "YES";
?>
<tr>

View File

@ -38,6 +38,8 @@ require("guiconfig.inc");
require_once("openvpn.inc");
$pgtitle = array("OpenVPN", "Server");
$statusurl = "status_openvpn.php";
$logurl = "diag_logs_openvpn.php";
if (!is_array($config['openvpn']['openvpn-server']))
$config['openvpn']['openvpn-server'] = array();
@ -514,7 +516,6 @@ function netbios_change() {
$tab_array[] = array(gettext("Client"), false, "vpn_openvpn_client.php");
$tab_array[] = array(gettext("Client Specific Overrides"), false, "vpn_openvpn_csc.php");
$tab_array[] = array(gettext("Wizards"), false, "wizard.php?xml=openvpn_wizard.xml");
$tab_array[] = array(gettext("Logs"), false, "diag_logs_openvpn.php");
add_package_tabs("OpenVPN", $tab_array);
display_top_tabs($tab_array);
?>

View File

@ -201,7 +201,7 @@ function enablechange() {
$enablefields = explode(',', $field['enablefields']);
foreach($enablefields as $enablefield) {
$enablefield = strtolower($enablefield);
print "\t\t" . 'document.iform.' . $enablefield . '.disabled = 1;' . "\n";
print "\t\t" . 'document.iform.' . $enablefield . '.disabled = 0;' . "\n";
}
}
if(isset($field['checkenablefields'])) {
@ -216,7 +216,7 @@ function enablechange() {
$enablefields = explode(',', $field['enablefields']);
foreach($enablefields as $enablefield) {
$enablefield = strtolower($enablefield);
print "\t\t" . 'document.iform.' . $enablefield . '.disabled = 0;' . "\n";
print "\t\t" . 'document.iform.' . $enablefield . '.disabled = 1;' . "\n";
}
}
if(isset($field['checkenablefields'])) {
@ -248,7 +248,7 @@ function disablechange() {
$checkenablefields = explode(',', $field['checkdisablefields']);
foreach($checkenablefields as $checkenablefield) {
$checkenablefield = strtolower($checkenablefield);
print "\t\t" . 'document.iform.' . $checkenablefield . '.checked = 0;' . "\n";
print "\t\t" . 'document.iform.' . $checkenablefield . '.checked = 1;' . "\n";
}
}
print "\t" . '} else {' . "\n";
@ -263,7 +263,7 @@ function disablechange() {
$checkenablefields = explode(',', $field['checkdisablefields']);
foreach($checkenablefields as $checkenablefield) {
$checkenablefield = strtolower($checkenablefield);
print "\t\t" . 'document.iform.' . $checkenablefield . '.checked = 1;' . "\n";
print "\t\t" . 'document.iform.' . $checkenablefield . '.checked = 0;' . "\n";
}
}
print "\t" . '}' . "\n";
@ -365,7 +365,10 @@ function showchange() {
$arraynum = "[" . $field['arraynum'] . "]";
foreach ($field_split as $f)
$field_conv .= "['" . $f . "']";
$toeval = "if (isset(\$config" . $field_conv . $arraynum . ")) { \$value = \$config" . $field_conv . $arraynum . "; if (empty(\$value)) \$value = true; }";
if($field['type'] == "checkbox")
$toeval = "if (isset(\$config" . $field_conv . $arraynum . ")) { \$value = \$config" . $field_conv . $arraynum . "; if (empty(\$value)) \$value = true; }";
else
$toeval = "if (isset(\$config" . $field_conv . $arraynum . ")) \$value = \$config" . $field_conv . $arraynum . ";";
eval($toeval);
}