Revision 8026f19c
Added by Ermal LUÇI about 12 years ago
etc/rc.newwanipv6 | ||
---|---|---|
67 | 67 |
$interface_real = $argument; |
68 | 68 |
$interface = convert_real_interface_to_friendly_interface_name($interface_real); |
69 | 69 |
$curwanipv6 = get_interface_ipv6($interface, true); |
70 |
$interface_realv6 = get_real_interface($interface, "inet6"); |
|
71 | 70 |
} |
72 | 71 |
|
73 | 72 |
if (empty($interface)) { |
... | ... | |
77 | 76 |
} |
78 | 77 |
|
79 | 78 |
//Do not process while booting |
80 |
if($g['booting'] && $config['interfaces'][$interface]['ipaddrv6'] != "dhcp6") |
|
79 |
if ($g['booting'] && $config['interfaces'][$interface]['ipaddrv6'] != "dhcp6")
|
|
81 | 80 |
exit; |
82 | 81 |
|
83 |
if(empty($curwanipv6) || !is_ipaddrv6($curwanipv6)) { |
|
82 |
if (empty($curwanipv6) || !is_ipaddrv6($curwanipv6)) {
|
|
84 | 83 |
log_error("rc.newwanipv6: Failed to update {$interface} IPv6, restarting..."); |
85 | 84 |
// send_event("interface reconfigure {$interface}"); |
86 | 85 |
exit; |
... | ... | |
90 | 89 |
$name_servers = explode(" ", $_ENV['new_domain_name_servers']); |
91 | 90 |
$valid_ns = array(); |
92 | 91 |
foreach($name_servers as $ns) { |
93 |
if(is_ipaddrv6(trim($ns))) |
|
92 |
if (is_ipaddrv6(trim($ns)))
|
|
94 | 93 |
$valid_ns[] = trim($ns); |
95 | 94 |
} |
96 | 95 |
|
97 |
if(count($valid_ns > 0)) |
|
96 |
if (count($valid_ns > 0))
|
|
98 | 97 |
file_put_contents("{$g['varetc_path']}/nameserver_v6{$interface}", implode("\n", $valid_ns)); |
99 | 98 |
} |
100 |
if(!empty($_ENV['new_domain_name'])) |
|
99 |
if (!empty($_ENV['new_domain_name']))
|
|
101 | 100 |
file_put_contents("{$g['varetc_path']}/searchdomain_v6{$interface}", $_ENV['new_domain_name']); |
102 | 101 |
|
103 | 102 |
/* write current WAN IPv6 to file */ |
104 | 103 |
file_put_contents("{$g['vardb_path']}/{$interface}_ipv6", $curwanipv6); |
105 | 104 |
|
106 |
log_error("rc.newwanipv6: on (IP address: {$curwanipv6}) (interface: {$interface}) (real interface: {$interface_realv6}).");
|
|
105 |
log_error("rc.newwanipv6: on (IP address: {$curwanipv6}) (interface: {$interface}) (real interface: {$interface_real})."); |
|
107 | 106 |
|
108 | 107 |
$oldipv6 = ""; |
109 | 108 |
if (file_exists("{$g['vardb_path']}/{$interface}_cacheipv6")) |
... | ... | |
135 | 134 |
vpn_ipsec_force_reload($interface); |
136 | 135 |
|
137 | 136 |
/* start OpenVPN server & clients */ |
138 |
openvpn_resync_all($interface); |
|
137 |
if (substr($interface_real, 0, 4) != "ovpn") |
|
138 |
openvpn_resync_all($interface); |
|
139 | 139 |
} |
140 | 140 |
exit; |
141 |
} else if (does_interface_exist($interface_realv6))
|
|
142 |
mwexec("/sbin/ifconfig {$interface_realv6} inet6 {$oldipv6} delete");
|
|
141 |
} else if (does_interface_exist($interface_real)) |
|
142 |
mwexec("/sbin/ifconfig {$interface_real} inet6 {$oldipv6} delete"); |
|
143 | 143 |
} |
144 | 144 |
|
145 | 145 |
file_put_contents("{$g['vardb_path']}/{$interface}_cacheipv6", $curwanipv6); |
Also available in: Unified diff
Remove useless variable and also correct some style