diff --git a/etc/inc/captiveportal.inc b/etc/inc/captiveportal.inc index 885040b7f9..ce2a8340ea 100644 --- a/etc/inc/captiveportal.inc +++ b/etc/inc/captiveportal.inc @@ -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); } } } diff --git a/etc/inc/config.lib.inc b/etc/inc/config.lib.inc index 435949fb82..707dee8928 100644 --- a/etc/inc/config.lib.inc +++ b/etc/inc/config.lib.inc @@ -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'])) diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index ee9317e215..0bbcf5864b 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -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 .= << $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]; diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index 9ff2c40167..7ade954a13 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -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 .= << 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; } diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index 614183ba8c..466101be66 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -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; } diff --git a/etc/inc/rrd.inc b/etc/inc/rrd.inc index fa2920e268..7f9b13cd71 100644 --- a/etc/inc/rrd.inc +++ b/etc/inc/rrd.inc @@ -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. diff --git a/etc/inc/services.inc b/etc/inc/services.inc index 013351bee8..94f69cd849 100644 --- a/etc/inc/services.inc +++ b/etc/inc/services.inc @@ -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; } diff --git a/etc/inc/system.inc b/etc/inc/system.inc index 6281a1475d..a7c3423577 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -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"); } -?> \ No newline at end of file +?> diff --git a/etc/inc/upgrade_config.inc b/etc/inc/upgrade_config.inc index cb690d6a9e..81ee8f6cd3 100644 --- a/etc/inc/upgrade_config.inc +++ b/etc/inc/upgrade_config.inc @@ -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"); diff --git a/etc/rc b/etc/rc index 57a5902cfc..c878145058 100755 --- a/etc/rc +++ b/etc/rc @@ -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 diff --git a/etc/rc.bootup b/etc/rc.bootup index e50d14dd7b..4f67a7b452 100755 --- a/etc/rc.bootup +++ b/etc/rc.bootup @@ -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(); -?> \ No newline at end of file +?> diff --git a/etc/rc.initial b/etc/rc.initial index 7485e0dec8..13fcbbae03 100755 --- a/etc/rc.initial +++ b/etc/rc.initial @@ -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 diff --git a/etc/rc.reboot b/etc/rc.reboot index af5d874045..ecc47c23ae 100755 --- a/etc/rc.reboot +++ b/etc/rc.reboot @@ -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 - diff --git a/sbin/dhclient-script b/sbin/dhclient-script index 5ef88eae15..132946d08a 100755 --- a/sbin/dhclient-script +++ b/sbin/dhclient-script @@ -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" diff --git a/usr/local/captiveportal/index.php b/usr/local/captiveportal/index.php index 5990ec11ff..32c8853d94 100755 --- a/usr/local/captiveportal/index.php +++ b/usr/local/captiveportal/index.php @@ -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; diff --git a/usr/local/www/fbegin.inc b/usr/local/www/fbegin.inc index 5f02b6921c..acdd9b8d39 100755 --- a/usr/local/www/fbegin.inc +++ b/usr/local/www/fbegin.inc @@ -408,9 +408,17 @@ function add_to_menu($url, $name) {
- - + + + + + + + + + +

diff --git a/usr/local/www/firewall_rules.php b/usr/local/www/firewall_rules.php index 0edba705f5..b9888e69b2 100755 --- a/usr/local/www/firewall_rules.php +++ b/usr/local/www/firewall_rules.php @@ -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"); diff --git a/usr/local/www/firewall_rules_edit.php b/usr/local/www/firewall_rules_edit.php index 2baaef003e..342b6899a6 100755 --- a/usr/local/www/firewall_rules_edit.php +++ b/usr/local/www/firewall_rules_edit.php @@ -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"; diff --git a/usr/local/www/firewall_shaper.php b/usr/local/www/firewall_shaper.php index 6b6824ffdd..6618389087 100755 --- a/usr/local/www/firewall_shaper.php +++ b/usr/local/www/firewall_shaper.php @@ -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(); diff --git a/usr/local/www/firewall_shaper_layer7.php b/usr/local/www/firewall_shaper_layer7.php index 1fe4ead0c8..3e2dc2218f 100755 --- a/usr/local/www/firewall_shaper_layer7.php +++ b/usr/local/www/firewall_shaper_layer7.php @@ -57,6 +57,7 @@ $show_proto_form = false; //More variables $pgtitle = array("Firewall","Traffic Shaper", "Layer7"); +$statusurl = "status_queues.php"; $output_form = ""; diff --git a/usr/local/www/firewall_shaper_queues.php b/usr/local/www/firewall_shaper_queues.php index 1072d72f73..35b6f2176c 100755 --- a/usr/local/www/firewall_shaper_queues.php +++ b/usr/local/www/firewall_shaper_queues.php @@ -170,6 +170,7 @@ if ($_POST['apply']) { } $pgtitle = "Firewall: Shaper: By Queues View"; +$statusurl = "status_queues.php"; include("head.inc"); ?> diff --git a/usr/local/www/firewall_shaper_vinterface.php b/usr/local/www/firewall_shaper_vinterface.php index 45ec5cc236..b6c8c76f40 100644 --- a/usr/local/www/firewall_shaper_vinterface.php +++ b/usr/local/www/firewall_shaper_vinterface.php @@ -52,6 +52,7 @@ if($_GET['reset'] <> "") { } $pgtitle = array("Firewall","Traffic Shaper", "Limiter"); +$statusurl = "status_queues.php"; read_dummynet_config(); /* diff --git a/usr/local/www/firewall_shaper_wizards.php b/usr/local/www/firewall_shaper_wizards.php index 155724212e..acd744c881 100755 --- a/usr/local/www/firewall_shaper_wizards.php +++ b/usr/local/www/firewall_shaper_wizards.php @@ -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", diff --git a/usr/local/www/firewall_virtual_ip_edit.php b/usr/local/www/firewall_virtual_ip_edit.php index 415ced4f30..b84d8b0012 100755 --- a/usr/local/www/firewall_virtual_ip_edit.php +++ b/usr/local/www/firewall_virtual_ip_edit.php @@ -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) { diff --git a/usr/local/www/index.php b/usr/local/www/index.php index 4125b5173a..0463750dd7 100755 --- a/usr/local/www/index.php +++ b/usr/local/www/index.php @@ -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; } diff --git a/usr/local/www/installer.php b/usr/local/www/installer.php index 534ff63ca9..f988d02ef1 100644 --- a/usr/local/www/installer.php +++ b/usr/local/www/installer.php @@ -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; + include("fbegin.inc"); + + if($one_two) + echo "

{$pgtitle}

"; + + 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"); - -?> - - - - - - -

- - - - -"; + include("fend.inc"); + echo ""; + echo ""; } function template() { -echo << - - - + +
-
- - - + +
-
-
+ body_html(); + echo << + + + - -
+
+ + + - -
+ +
-
-
-
-
-
+ +
+
+
+ EOF; - + end_html(); } function quickeasyinstall_gui() { + body_html(); echo << - - - - -
-
- - - - -
- -
- Starting Installer... Please wait...

- {{ Insert progressbar here }}

- -

-
-
-
- - +
+ + + + +
+
+ + + + +
+ +
+ Starting Installer... Please wait...

+ {{ Insert progressbar here }}

+ +

+
+
+
+
+ EOF; - + end_html(); } - function installer_main() { -echo << - - - - -
-
- - - - -
- - -
-
-
- + body_html(); + $disk = installer_find_first_disk(); + if(!$disk) + echo "WARNING: Could not find any suitable disks for installation."; + echo << + + + + +
+ +
+ EOF; - + end_html(); } -?> - - - - - - - +?> \ No newline at end of file diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php index 5ec2e36e66..b9b3e658a4 100755 --- a/usr/local/www/interfaces.php +++ b/usr/local/www/interfaces.php @@ -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"*/); diff --git a/usr/local/www/interfaces_assign.php b/usr/local/www/interfaces_assign.php index 407755f88d..107aaea809 100755 --- a/usr/local/www/interfaces_assign.php +++ b/usr/local/www/interfaces_assign.php @@ -41,6 +41,8 @@ ##|-PRIV $pgtitle = array("Interfaces", "Assign network ports"); +$statusurl = "status_interfaces.php"; + require("guiconfig.inc"); require("functions.inc"); require("filter.inc"); diff --git a/usr/local/www/load_balancer_monitor.php b/usr/local/www/load_balancer_monitor.php index ebb640676d..2f0f37284a 100755 --- a/usr/local/www/load_balancer_monitor.php +++ b/usr/local/www/load_balancer_monitor.php @@ -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"); ?> diff --git a/usr/local/www/load_balancer_monitor_edit.php b/usr/local/www/load_balancer_monitor_edit.php index 320a54f95d..c3b269fb34 100755 --- a/usr/local/www/load_balancer_monitor_edit.php +++ b/usr/local/www/load_balancer_monitor_edit.php @@ -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"); diff --git a/usr/local/www/load_balancer_pool.php b/usr/local/www/load_balancer_pool.php index c320683a6d..4742ab1a52 100755 --- a/usr/local/www/load_balancer_pool.php +++ b/usr/local/www/load_balancer_pool.php @@ -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"); ?> diff --git a/usr/local/www/load_balancer_pool_edit.php b/usr/local/www/load_balancer_pool_edit.php index a81faa3c57..5936d3533c 100755 --- a/usr/local/www/load_balancer_pool_edit.php +++ b/usr/local/www/load_balancer_pool_edit.php @@ -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"); ?> diff --git a/usr/local/www/load_balancer_relay_action.php b/usr/local/www/load_balancer_relay_action.php index 8926f6538f..36b4b8f9e0 100755 --- a/usr/local/www/load_balancer_relay_action.php +++ b/usr/local/www/load_balancer_relay_action.php @@ -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"); ?> diff --git a/usr/local/www/load_balancer_relay_action_edit.php b/usr/local/www/load_balancer_relay_action_edit.php index 218c49d86e..dc47e45933 100755 --- a/usr/local/www/load_balancer_relay_action_edit.php +++ b/usr/local/www/load_balancer_relay_action_edit.php @@ -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"); ?> diff --git a/usr/local/www/load_balancer_relay_protocol.php b/usr/local/www/load_balancer_relay_protocol.php index 767e96200d..f8540419a6 100755 --- a/usr/local/www/load_balancer_relay_protocol.php +++ b/usr/local/www/load_balancer_relay_protocol.php @@ -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"); ?> diff --git a/usr/local/www/load_balancer_relay_protocol_edit.php b/usr/local/www/load_balancer_relay_protocol_edit.php index eac04c1baf..4575aebcd8 100755 --- a/usr/local/www/load_balancer_relay_protocol_edit.php +++ b/usr/local/www/load_balancer_relay_protocol_edit.php @@ -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"); diff --git a/usr/local/www/load_balancer_virtual_server.php b/usr/local/www/load_balancer_virtual_server.php index 772cbf8aed..9114dc9868 100755 --- a/usr/local/www/load_balancer_virtual_server.php +++ b/usr/local/www/load_balancer_virtual_server.php @@ -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"); ?> diff --git a/usr/local/www/load_balancer_virtual_server_edit.php b/usr/local/www/load_balancer_virtual_server_edit.php index 6eb49bd37c..dda2c71e2e 100755 --- a/usr/local/www/load_balancer_virtual_server_edit.php +++ b/usr/local/www/load_balancer_virtual_server_edit.php @@ -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"); ?> diff --git a/usr/local/www/services_captiveportal.php b/usr/local/www/services_captiveportal.php index 331708aadc..5206535a21 100755 --- a/usr/local/www/services_captiveportal.php +++ b/usr/local/www/services_captiveportal.php @@ -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); ?> diff --git a/usr/local/www/services_captiveportal_filemanager.php b/usr/local/www/services_captiveportal_filemanager.php index 2c8d8156ad..efef6b76df 100755 --- a/usr/local/www/services_captiveportal_filemanager.php +++ b/usr/local/www/services_captiveportal_filemanager.php @@ -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); ?> diff --git a/usr/local/www/services_captiveportal_ip.php b/usr/local/www/services_captiveportal_ip.php index 61e05e5eb8..29acb1ca38 100755 --- a/usr/local/www/services_captiveportal_ip.php +++ b/usr/local/www/services_captiveportal_ip.php @@ -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); ?> diff --git a/usr/local/www/services_captiveportal_ip_edit.php b/usr/local/www/services_captiveportal_ip_edit.php index 57e8476deb..419327d154 100755 --- a/usr/local/www/services_captiveportal_ip_edit.php +++ b/usr/local/www/services_captiveportal_ip_edit.php @@ -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"); diff --git a/usr/local/www/services_captiveportal_mac.php b/usr/local/www/services_captiveportal_mac.php index 3e459f48e2..8e64fd8fe9 100755 --- a/usr/local/www/services_captiveportal_mac.php +++ b/usr/local/www/services_captiveportal_mac.php @@ -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); ?> diff --git a/usr/local/www/services_captiveportal_mac_edit.php b/usr/local/www/services_captiveportal_mac_edit.php index bc397b7e6e..b55e750da3 100755 --- a/usr/local/www/services_captiveportal_mac_edit.php +++ b/usr/local/www/services_captiveportal_mac_edit.php @@ -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"); diff --git a/usr/local/www/services_captiveportal_vouchers.php b/usr/local/www/services_captiveportal_vouchers.php index de305b7e82..f6c4577dd4 100644 --- a/usr/local/www/services_captiveportal_vouchers.php +++ b/usr/local/www/services_captiveportal_vouchers.php @@ -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); ?> diff --git a/usr/local/www/services_captiveportal_vouchers_edit.php b/usr/local/www/services_captiveportal_vouchers_edit.php index ee95927c4b..cacbb612c4 100644 --- a/usr/local/www/services_captiveportal_vouchers_edit.php +++ b/usr/local/www/services_captiveportal_vouchers_edit.php @@ -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"); diff --git a/usr/local/www/services_dhcp.php b/usr/local/www/services_dhcp.php index 0bbb3bc4fe..d4259ed3c0 100755 --- a/usr/local/www/services_dhcp.php +++ b/usr/local/www/services_dhcp.php @@ -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"); ?> diff --git a/usr/local/www/services_dhcp_edit.php b/usr/local/www/services_dhcp_edit.php index 86fefe3852..e7bc745ef1 100755 --- a/usr/local/www/services_dhcp_edit.php +++ b/usr/local/www/services_dhcp_edit.php @@ -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"); ?> diff --git a/usr/local/www/system_gateway_groups.php b/usr/local/www/system_gateway_groups.php index d79627f278..43dfea760d 100755 --- a/usr/local/www/system_gateway_groups.php +++ b/usr/local/www/system_gateway_groups.php @@ -86,6 +86,8 @@ if ($_GET['act'] == "del") { } $pgtitle = array(gettext("System"),gettext("Gateway Groups")); +$statusurl = "status_gateway_groups.php"; + include("head.inc"); ?> diff --git a/usr/local/www/system_gateway_groups_edit.php b/usr/local/www/system_gateway_groups_edit.php index d5076c1cf5..1a504c5fd4 100755 --- a/usr/local/www/system_gateway_groups_edit.php +++ b/usr/local/www/system_gateway_groups_edit.php @@ -141,6 +141,8 @@ if ($_POST) { } $pgtitle = array(gettext("System"),gettext("Gateways"),gettext("Edit gateway")); +$statusurl = "status_gateway_groups.php"; + include("head.inc"); ?> diff --git a/usr/local/www/system_gateways.php b/usr/local/www/system_gateways.php index 6f38012252..82004a77ce 100755 --- a/usr/local/www/system_gateways.php +++ b/usr/local/www/system_gateways.php @@ -118,6 +118,8 @@ if ($_GET['act'] == "del") { $pgtitle = array(gettext("System"),gettext("Gateways")); +$statusurl = "status_gateways.php"; + include("head.inc"); ?> diff --git a/usr/local/www/system_gateways_edit.php b/usr/local/www/system_gateways_edit.php index 5c14f17feb..69cc405f97 100755 --- a/usr/local/www/system_gateways_edit.php +++ b/usr/local/www/system_gateways_edit.php @@ -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() { - > + " >
@@ -361,7 +363,7 @@ function show_advanced_gateway() { diff --git a/usr/local/www/themes/_corporate/images/log.png b/usr/local/www/themes/_corporate/images/log.png new file mode 100644 index 0000000000..ba0b39760b Binary files /dev/null and b/usr/local/www/themes/_corporate/images/log.png differ diff --git a/usr/local/www/themes/_corporate/images/status.png b/usr/local/www/themes/_corporate/images/status.png new file mode 100644 index 0000000000..257851812f Binary files /dev/null and b/usr/local/www/themes/_corporate/images/status.png differ diff --git a/usr/local/www/themes/code-red/images/help.png b/usr/local/www/themes/code-red/images/help.png new file mode 100644 index 0000000000..3c71cabbbf Binary files /dev/null and b/usr/local/www/themes/code-red/images/help.png differ diff --git a/usr/local/www/themes/code-red/images/log.png b/usr/local/www/themes/code-red/images/log.png new file mode 100644 index 0000000000..ba0b39760b Binary files /dev/null and b/usr/local/www/themes/code-red/images/log.png differ diff --git a/usr/local/www/themes/code-red/images/status.png b/usr/local/www/themes/code-red/images/status.png new file mode 100644 index 0000000000..257851812f Binary files /dev/null and b/usr/local/www/themes/code-red/images/status.png differ diff --git a/usr/local/www/themes/metallic/images/log.png b/usr/local/www/themes/metallic/images/log.png new file mode 100644 index 0000000000..ba0b39760b Binary files /dev/null and b/usr/local/www/themes/metallic/images/log.png differ diff --git a/usr/local/www/themes/metallic/images/status.png b/usr/local/www/themes/metallic/images/status.png new file mode 100644 index 0000000000..257851812f Binary files /dev/null and b/usr/local/www/themes/metallic/images/status.png differ diff --git a/usr/local/www/themes/nervecenter/images/log.png b/usr/local/www/themes/nervecenter/images/log.png new file mode 100644 index 0000000000..ba0b39760b Binary files /dev/null and b/usr/local/www/themes/nervecenter/images/log.png differ diff --git a/usr/local/www/themes/nervecenter/images/status.png b/usr/local/www/themes/nervecenter/images/status.png new file mode 100644 index 0000000000..257851812f Binary files /dev/null and b/usr/local/www/themes/nervecenter/images/status.png differ diff --git a/usr/local/www/themes/pfsense-dropdown/images/log.png b/usr/local/www/themes/pfsense-dropdown/images/log.png new file mode 100644 index 0000000000..ba0b39760b Binary files /dev/null and b/usr/local/www/themes/pfsense-dropdown/images/log.png differ diff --git a/usr/local/www/themes/pfsense-dropdown/images/status.png b/usr/local/www/themes/pfsense-dropdown/images/status.png new file mode 100644 index 0000000000..257851812f Binary files /dev/null and b/usr/local/www/themes/pfsense-dropdown/images/status.png differ diff --git a/usr/local/www/themes/pfsense/images/log.png b/usr/local/www/themes/pfsense/images/log.png new file mode 100644 index 0000000000..ba0b39760b Binary files /dev/null and b/usr/local/www/themes/pfsense/images/log.png differ diff --git a/usr/local/www/themes/pfsense/images/status.png b/usr/local/www/themes/pfsense/images/status.png new file mode 100644 index 0000000000..257851812f Binary files /dev/null and b/usr/local/www/themes/pfsense/images/status.png differ diff --git a/usr/local/www/themes/pfsense_ng/images/log.png b/usr/local/www/themes/pfsense_ng/images/log.png new file mode 100644 index 0000000000..ba0b39760b Binary files /dev/null and b/usr/local/www/themes/pfsense_ng/images/log.png differ diff --git a/usr/local/www/themes/pfsense_ng/images/status.png b/usr/local/www/themes/pfsense_ng/images/status.png new file mode 100644 index 0000000000..257851812f Binary files /dev/null and b/usr/local/www/themes/pfsense_ng/images/status.png differ diff --git a/usr/local/www/themes/the_wall/images/log.png b/usr/local/www/themes/the_wall/images/log.png new file mode 100644 index 0000000000..ba0b39760b Binary files /dev/null and b/usr/local/www/themes/the_wall/images/log.png differ diff --git a/usr/local/www/themes/the_wall/images/status.png b/usr/local/www/themes/the_wall/images/status.png new file mode 100644 index 0000000000..257851812f Binary files /dev/null and b/usr/local/www/themes/the_wall/images/status.png differ diff --git a/usr/local/www/vpn_ipsec.php b/usr/local/www/vpn_ipsec.php index 7d6e0dbe5b..0fdecc8f1f 100755 --- a/usr/local/www/vpn_ipsec.php +++ b/usr/local/www/vpn_ipsec.php @@ -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); ?> diff --git a/usr/local/www/vpn_ipsec_keys.php b/usr/local/www/vpn_ipsec_keys.php index 2a232f31fe..c446e0563a 100644 --- a/usr/local/www/vpn_ipsec_keys.php +++ b/usr/local/www/vpn_ipsec_keys.php @@ -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); ?> diff --git a/usr/local/www/vpn_ipsec_keys_edit.php b/usr/local/www/vpn_ipsec_keys_edit.php index 20ac6c08bf..ff1ef9afb0 100644 --- a/usr/local/www/vpn_ipsec_keys_edit.php +++ b/usr/local/www/vpn_ipsec_keys_edit.php @@ -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"); ?> diff --git a/usr/local/www/vpn_ipsec_mobile.php b/usr/local/www/vpn_ipsec_mobile.php index 4bf8d6175d..379cf15a33 100755 --- a/usr/local/www/vpn_ipsec_mobile.php +++ b/usr/local/www/vpn_ipsec_mobile.php @@ -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); ?> diff --git a/usr/local/www/vpn_ipsec_phase1.php b/usr/local/www/vpn_ipsec_phase1.php index be3414c5b2..71ea6d8d78 100644 --- a/usr/local/www/vpn_ipsec_phase1.php +++ b/usr/local/www/vpn_ipsec_phase1.php @@ -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); ?> diff --git a/usr/local/www/vpn_ipsec_phase2.php b/usr/local/www/vpn_ipsec_phase2.php index 5be729cade..e00535ef19 100644 --- a/usr/local/www/vpn_ipsec_phase2.php +++ b/usr/local/www/vpn_ipsec_phase2.php @@ -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); ?> diff --git a/usr/local/www/vpn_openvpn_client.php b/usr/local/www/vpn_openvpn_client.php index 70f5cd1873..a52a73977c 100644 --- a/usr/local/www/vpn_openvpn_client.php +++ b/usr/local/www/vpn_openvpn_client.php @@ -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); ?> diff --git a/usr/local/www/vpn_openvpn_csc.php b/usr/local/www/vpn_openvpn_csc.php index b70404ff23..5a71121521 100644 --- a/usr/local/www/vpn_openvpn_csc.php +++ b/usr/local/www/vpn_openvpn_csc.php @@ -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() { diff --git a/usr/local/www/vpn_openvpn_server.php b/usr/local/www/vpn_openvpn_server.php index f221b6bc55..b213c6fe99 100644 --- a/usr/local/www/vpn_openvpn_server.php +++ b/usr/local/www/vpn_openvpn_server.php @@ -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); ?> diff --git a/usr/local/www/wizard.php b/usr/local/www/wizard.php index 08d2716c57..8c2ae36d15 100755 --- a/usr/local/www/wizard.php +++ b/usr/local/www/wizard.php @@ -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); }
- + /> @@ -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"; ?>