summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErmal Luçi <eri@pfsense.org>2009-02-14 06:25:14 +0000
committerErmal Luçi <eri@pfsense.org>2009-02-14 06:25:14 +0000
commit118dc8e57ce2731db31134b2a238da7d2951d478 (patch)
treea576e91c6a7832d380974fe06e0a4eebfc4c1de7
parentf476ef157174cfbd0cae07bf6059571d05349258 (diff)
parent28d221995282061e3cecab8d0a9cd8333717aeba (diff)
downloadpfsense-118dc8e57ce2731db31134b2a238da7d2951d478.zip
pfsense-118dc8e57ce2731db31134b2a238da7d2951d478.tar.gz
Merge branch 'master' of git@rcs.pfsense.org:pfsense/mainline
-rw-r--r--etc/inc/filter.inc2
-rw-r--r--etc/inc/interfaces.inc15
-rw-r--r--etc/inc/system.inc119
-rwxr-xr-xusr/local/www/pkg_edit.php9
4 files changed, 40 insertions, 105 deletions
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc
index a9fb43f..23f0f13 100644
--- a/etc/inc/filter.inc
+++ b/etc/inc/filter.inc
@@ -1318,7 +1318,7 @@ function generate_user_filter_rule($rule)
$gateway = $rule['gateway'];
if(!is_ipaddr($rule['gateway'])) {
$gwip = $GatewaysList[$rule['gateway']]['gateway'];
- $int = $GatewaysList[$rule['gateway']]['interface'];
+ $int = get_real_interface($GatewaysList[$gateway]['interface']);
} else {
$gwip = $rule['gateway'];
$int = guess_interface_from_ip($rule['gateway']);
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc
index e131df0..652d527 100644
--- a/etc/inc/interfaces.inc
+++ b/etc/inc/interfaces.inc
@@ -1265,20 +1265,11 @@ function interface_configure($interface = "wan") {
$realif = get_real_interface($interface);
- if (!$g['booting']) {
+ if (!$g['booting']) {
/* remove all IPv4 addresses */
while (mwexec("/sbin/ifconfig " . escapeshellarg($realif) . " -alias", true) == 0);
- interface_bring_down($interface);
-
- /* remove all IPv6 addresses */
- $str = <<<EOD
- while i="`/sbin/ifconfig $realif | /usr/bin/grep inet6 | /usr/bin/grep -m 1 -v '%'`"; do
- ifconfig $realif \$i delete
- done
-EOD;
- mwexec("($str)");
- mwexec("/sbin/ifconfig " . escapeshellarg($wancfg['if']) . " down");
- }
+ interface_bring_down($interface);
+ }
/* wireless configuration? */
if (is_array($wancfg['wireless']))
diff --git a/etc/inc/system.inc b/etc/inc/system.inc
index 597748d..d4d2415 100644
--- a/etc/inc/system.inc
+++ b/etc/inc/system.inc
@@ -218,14 +218,9 @@ function system_routing_configure() {
return 1;
}
while (!feof($fd)) {
- $oldrt = fgets($fd);
- if ($oldrt && stristr($route_str, trim($oldrt))) {
- if (Net_IPv6::checkIPv6(trim($oldrt))) {
- mwexec("/sbin/route delete -inet6 " . escapeshellarg(trim($oldrt)));
- } else {
- mwexec("/sbin/route delete " . escapeshellarg(trim($oldrt)));
- }
- }
+ $oldrt = trim(fgets($fd));
+ if (($oldrt) && (stristr($route_str, $oldrt)))
+ mwexec("/sbin/route delete " . escapeshellarg($oldrt));
}
fclose($fd);
unlink("{$g['vardb_path']}/routes.db");
@@ -234,21 +229,19 @@ function system_routing_configure() {
/* if list */
$iflist = get_configured_interface_list();
- $dont_remove_route = false;
- foreach ($iflist as $ifent => $ifname) {
- /* do not process interfaces that will end up with gateways */
- if (interface_has_gateway($ifent))
- $dont_remove_route = true;
- }
+ $dont_remove_route = false;
+ foreach ($iflist as $ifent => $ifname) {
+ /* do not process interfaces that will end up with gateways */
+ if (interface_has_gateway($ifent))
+ $dont_remove_route = true;
+ }
- if($config['interfaces']['wan']['ipaddr'] == "carpdev-dhcp") {
+ if($config['interfaces']['wan']['ipaddr'] == "carpdev-dhcp")
$dont_remove_route = true;
- }
if($dont_remove_route == false) {
- /* remove default routes */
- mwexec("/sbin/route delete default");
- mwexec("/sbin/route delete -inet6 default");
+ /* remove default route */
+ mwexec("/sbin/route delete default", true);
}
$dont_add_route = false;
@@ -263,41 +256,14 @@ function system_routing_configure() {
if($dont_add_route == false) {
if(is_array($config['gateways']['gateway_item'])) {
- $gatewayip = '';
- $interfacegw = '';
-
- $gatewayip_ipv6 = '';
- $interfacegw_ipv6 = '';
-
foreach($config['gateways']['gateway_item'] as $gateway) {
if(isset($gateway['defaultgw'])) {
- if ($gateway['type'] == 'IPv4') {
- $gatewayip = $gateway['gateway'];
- $interfacegw = $gateway['interface'];
- } else if ($gateway['type'] == 'IPv6') {
- $gatewayip_ipv6 = $gateway['gateway'];
- $interfacegw_ipv6 = $gateway['interface'];
- }
- }
- }
-
- if($interfacegw != "bgpd") {
- /*
- if (Net_IPv6::checkIPv6($gatewayip)) {
- mwexec("/sbin/route add -inet6 default " . escapeshellarg($gatewayip));
- } else {
- mwexec("/sbin/route add default " . escapeshellarg($gatewayip));
- }
- */
-
- if ($gatewayip != '') {
- mwexec("/sbin/route add default " . escapeshellarg($gatewayip), true);
- }
-
- if ($gatewayip_ipv6 != '') {
- mwexec("/sbin/route add -inet6 default " . escapeshellarg($gatewayip_ipv6), true);
+ $gatewayip = $gateway['gateway'];
+ $interfacegw = $gateway['interface'];
}
}
+ if(($interfacegw <> "bgpd") && (is_ipaddr($gatewayip)))
+ mwexec("/sbin/route add default " . escapeshellarg($gatewayip), true);
} else {
/* FIXME */
/* adding gateway for 1.2-style configs without the new
@@ -309,11 +275,6 @@ function system_routing_configure() {
$gatewayip = $config['interfaces']['wan']['gateway'];
mwexec("/sbin/route add default " . escapeshellarg($gatewayip), true);
}
-
- if (Net_IPv6::checkIPv6($config['interfaces']['wan']['gateway_ipv6'])) {
- $gatewayip = $config['interfaces']['wan']['gateway_ipv6'];
- mwexec("/sbin/route add -inet6 default " . escapeshellarg($gatewayip), true);
- }
}
}
@@ -334,42 +295,19 @@ function system_routing_configure() {
}
}
}
-
- if ($rtent['ip_version'] == 'IPv4') {
- if(is_ipaddr($rtent['gateway']) && $gatewayip == "") {
- $gatewayip = $rtent['gateway'];
- $interfacegw = $rtent['interface'];
- }
-
- if(isset($rtent['interfacegateway'])) {
- mwexec("/sbin/route add " . escapeshellarg($rtent['network']) .
- " -iface " . escapeshellarg(convert_friendly_interface_to_real_interface_name($interfacegw)));
- } else {
- mwexec("/sbin/route add " . escapeshellarg($rtent['network']) .
- " " . escapeshellarg($gatewayip));
- }
-
- /* record route so it can be easily removed later (if necessary) */
- fwrite($fd, $rtent['network'] . "\n");
- } else if ($rtent['ip_version'] == 'IPv6') {
- ///
- if(Net_IPv6::checkIPv6($rtent['gateway']) && $gatewayip == "") {
- $gatewayip = $rtent['gateway'];
- $interfacegw = $rtent['interface'];
- }
-
- if(isset($rtent['interfacegateway'])) {
- mwexec("/sbin/route add -inet6 " . escapeshellarg($rtent['network']) .
- " -iface " . escapeshellarg(convert_friendly_interface_to_real_interface_name($interfacegw)));
- } else {
- mwexec("/sbin/route add -inet6 " . escapeshellarg($rtent['network']) .
- " " . escapeshellarg($gatewayip));
- }
-
- /* record route so it can be easily removed later (if necessary) */
- fwrite($fd, $rtent['network'] . "\n");
+ if((is_ipaddr($rtent['gateway'])) && ($gatewayip == "")) {
+ $gatewayip = $rtent['gateway'];
+ $interfacegw = $rtent['interface'];
+ }
+ if(isset($rtent['interfacegateway'])) {
+ mwexec("/sbin/route add " . escapeshellarg($rtent['network']) .
+ " -iface " . escapeshellarg(convert_friendly_interface_to_real_interface_name($interfacegw)));
+ } else {
+ mwexec("/sbin/route add " . escapeshellarg($rtent['network']) .
+ " " . escapeshellarg($gatewayip));
}
-
+ /* record route so it can be easily removed later (if necessary) */
+ fwrite($fd, $rtent['network'] . "\n");
}
fclose($fd);
}
@@ -377,6 +315,7 @@ function system_routing_configure() {
return 0;
}
+
function system_routing_enable() {
global $config, $g;
$retval = false;
diff --git a/usr/local/www/pkg_edit.php b/usr/local/www/pkg_edit.php
index 5a1a3bf..24f0b4e 100755
--- a/usr/local/www/pkg_edit.php
+++ b/usr/local/www/pkg_edit.php
@@ -39,7 +39,7 @@ require_once("guiconfig.inc");
require_once("pkg-utils.inc");
/* dummy stubs needed by some code that was MFC'd */
-function pfSenseHeader($location) { header("Location: $location"); }
+function pfSenseHeader($location) { header("Location: " . $location); }
function gentitle_pkg($pgname) {
global $pfSense_config;
@@ -75,7 +75,12 @@ $pgtitle = $title;
$id = $_GET['id'];
if (isset($_POST['id']))
$id = htmlspecialchars($_POST['id']);
-
+
+// Not posting? Then user is editing a record. There must be a valid id
+// when editing a record.
+if(!$id && !$_POST)
+ $id = "0";
+
if($pkg['custom_php_global_functions'] <> "")
eval($pkg['custom_php_global_functions']);
OpenPOWER on IntegriCloud