summaryrefslogtreecommitdiffstats
path: root/etc/inc/gwlb.inc
diff options
context:
space:
mode:
authorSeth Mos <seth.mos@dds.nl>2010-10-22 16:01:30 +0200
committerSeth Mos <seth.mos@dds.nl>2010-10-22 16:01:30 +0200
commit5a5413bb5227e084703515007cc28fd746183c9b (patch)
treedb6401de66deac4db3948dfacc60b2cc063b01c0 /etc/inc/gwlb.inc
parent47593ac6ff761622a43e16cacb421acecede209d (diff)
downloadpfsense-5a5413bb5227e084703515007cc28fd746183c9b.zip
pfsense-5a5413bb5227e084703515007cc28fd746183c9b.tar.gz
Add the default ipv4 route and the default ipv6 route, check both routing tables before adding or changing.
set the ipv6 IP address via a mwexec() until the pfsense module is adapted. FIXME. Add filter rules for ipv6 to let traffic out of the firewall. FilterIflist not cooperating yet.
Diffstat (limited to 'etc/inc/gwlb.inc')
-rw-r--r--etc/inc/gwlb.inc71
1 files changed, 50 insertions, 21 deletions
diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc
index 540a0a7..d8bd05a 100644
--- a/etc/inc/gwlb.inc
+++ b/etc/inc/gwlb.inc
@@ -501,35 +501,64 @@ function lookup_gateway_interface_by_name($name) {
}
function get_interface_gateway($interface, &$dynamic = false) {
- global $config, $g;
+ global $config, $g;
- $gw = NULL;
+ $gw = NULL;
- $gwcfg = $config['interfaces'][$interface];
- if (!empty($gwcfg['gateway']) && is_array($config['gateways']['gateway_item'])) {
- foreach($config['gateways']['gateway_item'] as $gateway) {
- if ($gateway['name'] == $gwcfg['gateway']) {
- $gw = $gateway['gateway'];
+ $gwcfg = $config['interfaces'][$interface];
+ if (!empty($gwcfg['gateway']) && is_array($config['gateways']['gateway_item'])) {
+ foreach($config['gateways']['gateway_item'] as $gateway) {
+ if(($gateway['name'] == $gwcfg['gateway']) && (is_ipaddrv4($gateway['gateway']))) {
+ $gw = $gateway['gateway'];
break;
}
- }
+ }
}
- // for dynamic interfaces we handle them through the $interface_router file.
- if (!is_ipaddr($gw) && !is_ipaddr($gwcfg['ipaddr'])) {
- $realif = get_real_interface($interface);
- if (file_exists("{$g['tmp_path']}/{$realif}_router")) {
- $gw = trim(file_get_contents("{$g['tmp_path']}/{$realif}_router"), " \n");
- $dynamic = true;
- }
- if (file_exists("{$g['tmp_path']}/{$realif}_defaultgw"))
- $dynamic = "default";
+ // for dynamic interfaces we handle them through the $interface_router file.
+ if (!is_ipaddr($gw) && !is_ipaddr($gwcfg['ipaddr'])) {
+ $realif = get_real_interface($interface);
+ if (file_exists("{$g['tmp_path']}/{$realif}_router")) {
+ $gw = trim(file_get_contents("{$g['tmp_path']}/{$realif}_router"), " \n");
+ $dynamic = true;
+ }
+ if (file_exists("{$g['tmp_path']}/{$realif}_defaultgw"))
+ $dynamic = "default";
-
- }
+ }
+
+ /* return gateway */
+ return ($gw);
+}
+
+function get_interface_gateway_v6($interface, &$dynamic = false) {
+ global $config, $g;
- /* return gateway */
- return ($gw);
+ $gw = NULL;
+
+ $gwcfg = $config['interfaces'][$interface];
+ if (!empty($gwcfg['gateway']) && is_array($config['gateways']['gateway_item'])) {
+ foreach($config['gateways']['gateway_item'] as $gateway) {
+ if(($gateway['name'] == $gwcfg['gateway']) && (is_ipaddrv6($gateway['gateway']))) {
+ $gw = $gateway['gateway'];
+ break;
+ }
+ }
+ }
+
+ // for dynamic interfaces we handle them through the $interface_router file.
+ if (!is_ipaddrv6($gw) && !is_ipaddr($gwcfg['ipaddrv6'])) {
+ $realif = get_real_interface($interface);
+ if (file_exists("{$g['tmp_path']}/{$realif}_routerv6")) {
+ $gw = trim(file_get_contents("{$g['tmp_path']}/{$realif}_routerv6"), " \n");
+ $dynamic = true;
+ }
+ if (file_exists("{$g['tmp_path']}/{$realif}_defaultgwv6"))
+ $dynamic = "default";
+
+ }
+ /* return gateway */
+ return ($gw);
}
?>
OpenPOWER on IntegriCloud