summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorsmos <seth.mos@dds.nl>2012-02-01 13:36:55 +0100
committersmos <seth.mos@dds.nl>2012-02-01 13:36:55 +0100
commitdd576193b2fd0cd7917c6e5e3266150faf6eed35 (patch)
tree30f7e34aa004a7709741b270bd38b2f176631a7a /etc
parentf87ccbed8357f0f6648d8704760b5b5732e73b0c (diff)
downloadpfsense-dd576193b2fd0cd7917c6e5e3266150faf6eed35.zip
pfsense-dd576193b2fd0cd7917c6e5e3266150faf6eed35.tar.gz
Add code that expresses the default gateway calculated from the broker address.
The stf adapter was correctly setup from the WAN IPv4 address apparently Adds to ticket #2117
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/interfaces.inc37
1 files changed, 35 insertions, 2 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc
index c7b080d..bc80a6e 100644
--- a/etc/inc/interfaces.inc
+++ b/etc/inc/interfaces.inc
@@ -2997,8 +2997,6 @@ function interface_6rd_configure($interface = "wan"){
mwexec("/sbin/ifconfig stf0 create");
mwexec("/sbin/ifconfig stf0 inet6 {$rd6wanprefix}/{$rd6prefixlen}");
- /* FIXME, do we want to automagically inject a route here? */
-
/* Example 6RD setup steps
# ifconfig fxp0 inet6 2001:db8:c000:0202::1/64
# ifconfig fxp1 inet 192.0.2.2/24
@@ -3007,10 +3005,45 @@ function interface_6rd_configure($interface = "wan"){
# route add -inet6 default 2001:db8:c000:0201::1
*/
+ /* default gateway would be */
+ $ip4arr = explode(".", $wancfg['gateway-6rd']);
+ $rd6gwarr = array();
+ $length = $rd6prefixlen;
+ foreach($rd6arr as $element) {
+ if(($length < 0) && (empty($ip4arr))) {
+ $rd6gwarr[] = 0;
+ continue;
+ }
+ /* more then 16 bits left, just add element */
+ if($length >= 16)
+ $rd6gwarr[] = $element;
+ /* less then 16 bits, add ip4 octet */
+ if(($length <= 16) && ($length >= 8) && (count($ip4arr) > 0)) {
+ $rd6gwarr[] = dechex(hexdec($element) + $ip4arr[0]);
+ array_shift($ip4arr);
+ }
+ if(($length < 0) && (count($ip4arr) > 0)) {
+ $rd6el = array();
+ $rd6el[] = dechex($ip4arr[0]);
+ $rd6el[] = dechex($ip4arr[1]);
+
+ $rd6gwarr[] = $rd6el[0] . $rd6el[1];
+ array_shift($ip4arr);
+ array_shift($ip4arr);
+ }
+ $length = $length - 16;
+ }
+ /* gateway is ::1 */
+ $rd6gwarr[7] = 1;
+ $rd6wangw = implode(":", $rd6gwarr);
+
+ // echo "route add -inet6 default {$rd6wangw}";
+
return 0;
}
+
function interface_dhcpv6_configure($interface = "wan") {
global $config, $g;
$iflist = get_configured_interface_with_descr(false, true);
OpenPOWER on IntegriCloud