diff options
author | smos <seth.mos@dds.nl> | 2013-01-05 16:12:22 +0100 |
---|---|---|
committer | smos <seth.mos@dds.nl> | 2013-01-05 16:12:22 +0100 |
commit | 4c45712f915ce24aa93c3c437add1956f3916d54 (patch) | |
tree | 25831e19cf8abe7c56a3593f373d523da8697fa6 /etc/rc.newwanipv6 | |
parent | d53a9a5100c83988cd7479e9228c27f2ab09760e (diff) | |
download | pfsense-4c45712f915ce24aa93c3c437add1956f3916d54.zip pfsense-4c45712f915ce24aa93c3c437add1956f3916d54.tar.gz |
Update the rc.newwanipv6 with patches from the forum at
http://forum.pfsense.org/index.php/topic,56880.msg305769.html#msg305769
Still need to verify why this does not always come up directly on boot
Diffstat (limited to 'etc/rc.newwanipv6')
-rwxr-xr-x | etc/rc.newwanipv6 | 58 |
1 files changed, 23 insertions, 35 deletions
diff --git a/etc/rc.newwanipv6 b/etc/rc.newwanipv6 index e09b4c7..73ad28f 100755 --- a/etc/rc.newwanipv6 +++ b/etc/rc.newwanipv6 @@ -1,7 +1,7 @@ #!/usr/local/bin/php -f <?php /* - rc.newwanip + rc.newwanipv6 Copyright (C) 2006 Scott Ullrich (sullrich@gmail.com) part of pfSense (http://www.pfsense.com) @@ -49,44 +49,31 @@ if($g['booting']) exit; -// echo print_r($_ENV, true); -/*Array -( - [REASON] => NBI - [new_domain_name_servers] => 2001:470:20::2 - [new_domain_name] => domain.nl. -) -*/ - function restart_packages() { - global $oldip, $curwanipv6, $g; + global $oldipv6, $curwanipv6, $g; /* restart packages */ system_ntp_configure(false); mwexec_bg("/usr/local/sbin/ntpdate_sync_once.sh", true); - log_error("{$g['product_name']} package system has detected an ip change $oldip -> $curwanip ... Restarting packages."); - mwexec_bg("/etc/rc.start_packages"); -} - -log_error("rc.newwanipv6: Informational is starting."); - -/* FIXME: how can we find out about the correct interface name? */ -/* switch to ISC dhcp6 client? */ -$curwanipv6 = get_interface_ipv6(); -$interface = "wan"; -$interface_real = get_real_interface(); - -$name_servers = explode(" ", $_ENV['new_domain_name_servers']); -$valid_ns = array(); -foreach($name_servers as $ns) { - if(is_ipaddrv6(trim($ns))) - $valid_ns[] = trim($ns); + log_error("{$g['product_name']} package system has detected an ip change $oldipv6 -> $curwanipv6 ... Restarting packages."); + send_event("service reload packages"); } -if(count($valid_ns > 0)) - file_put_contents("{$g['varetc_path']}/nameserver_v6{$interface}", implode("\n", $valid_ns)); -if(!empty($_ENV['new_domain_name'])) { - file_put_contents("{$g['varetc_path']}/searchdomain_v6{$interface}", $_ENV['new_domain_name']); +/* Interface IP address has changed */ +$argument = str_replace("\n", "", $argv[1]); + +log_error("rc.newwanipv6: Informational is starting {$argument}."); + +if(empty($argument)) { + $curwanipv6 = get_interface_ipv6(); + $interface = "wan"; + $interface_real = get_real_interface(); +} else { + $interface_real = $argument; + $interface = convert_real_interface_to_friendly_interface_name($interface_real); + $curwanipv6 = find_interface_ipv6($interface_real, true); + if($curwanipv6 == "") + $curwanipv6 = get_interface_ipv6($interface); } log_error("rc.newwanipv6: on (IP address: {$curwanipv6}) (interface: {$interface}) (real interface: {$interface_real})."); @@ -117,6 +104,10 @@ system_resolvconf_generate(true); /* write current WAN IPv6 to file */ file_put_contents("{$g['vardb_path']}/{$interface}_ipv6", $curwanipv6); +/* pickup ipv6 router advertisements */ +pickup_ipv6_router_advertisement($interface_real); +sleep(3); + /* check native IPv6 interface tracking */ switch($config['interfaces'][$interface]['ipaddrv6']) { case "dhcp6": @@ -158,9 +149,6 @@ services_dnsupdate_process($interface); /* signal dyndns update */ services_dyndns_configure($interface); -/* wait for the dhcp6c process to configure the LAN interface */ -sleep(5); - /* reconfigure IPsec tunnels */ vpn_ipsec_force_reload(); |