interfaces: force renew for IPv6

This commit is contained in:
Franco Fichtner 2023-02-21 12:03:22 +01:00
parent e420cc4aa7
commit 58ffdc1684
4 changed files with 12 additions and 7 deletions

View File

@ -2800,7 +2800,11 @@ INFOREQ|REQUEST)
done
/usr/local/sbin/ifctl -i ${wanif} -6sd \${ARGS}
/usr/local/sbin/ifctl -i ${wanif} -6pd \${PDINFO:+"-a \${PDINFO}"}
/usr/local/sbin/configctl -d interface newipv6 {$wanif}
FORCE=
if [ \${REASON} = "REQUEST" ]; then
FORCE=force
fi
/usr/local/sbin/configctl -d interface newipv6 {$wanif} \${FORCE}
;;
EXIT|RELEASE)
/usr/bin/logger -t dhcp6c "dhcp6c \$REASON on {$wanif} - running newipv6"

View File

@ -38,6 +38,7 @@ require_once("system.inc");
require_once("interfaces.inc");
$argument = isset($argv[1]) ? trim($argv[1]) : '';
$force = !empty($argv[2]) ? 'yes' : 'no';
exit_on_bootup(function ($argument) {
log_msg("IP renewal deferred during boot on '{$argument}'");
@ -82,12 +83,12 @@ system_resolvconf_generate();
system_hosts_generate();
$cacheip = trim(@file_get_contents($cacheip_file));
if ($ip == $cacheip) {
if ($force == 'no' && $ip == $cacheip) {
log_msg("No IP change detected for {$interface_descr}[{$interface}]", LOG_INFO);
return;
}
log_msg("IP renwal starting (new: {$ip}, old: ${cacheip}, interface: {$interface_descr}[{$interface}], device: {$device})");
log_msg("IP renwal starting (new: {$ip}, old: ${cacheip}, interface: {$interface_descr}[{$interface}], device: {$device}, force: {$force})");
interfaces_vips_configure($interface, 6);
@ -101,7 +102,7 @@ $interfaces = array_keys(link_interface_to_track6($interface, true));
array_unshift($interfaces, $interface);
foreach ($interfaces as $interface) {
system_routing_configure(false, $interface);
system_routing_configure(false, $interface, true, 'inet6');
}
filter_configure_sync();

View File

@ -25,7 +25,7 @@ if [ "${2}" = "inet" ]; then
elif [ "${2}" = "inet6" ]; then
/usr/local/sbin/ifctl -i ${1} -6nd ${DNS1} ${DNS2}
/usr/local/sbin/ifctl -i ${1} -6rd ${ROUTER}
/usr/local/sbin/configctl -d interface newipv6 ${1}
/usr/local/sbin/configctl -d interface newipv6 ${1} force
fi
touch /tmp/${1}_uptime

View File

@ -13,9 +13,9 @@ message:New IPv4 on %s %s
[newipv6]
command:/usr/local/etc/rc.newwanipv6
parameters:%s
parameters:%s %s
type:script
message:New IPv6 on %s
message:New IPv6 on %s %s
[linkup.start]
command:/usr/local/etc/rc.linkup