interfaces: on forceful IPv6 reload do not lose the event handling #6637

User log reveals that this does happen on bootup.  Actual flow:

    kernel - >>>> Invoking start script 'beep'
    opnsense 6735 /usr/local/etc/rc.newwanipv6: dhcpd_radvd_configure(auto) found no suitable IPv6 address on igb1_vlan10
    dhcp6c 25775 dhcp6c_script: REQUEST on pppoe0 executing
    dhcp6c 29279 dhcp6c_script: REQUEST on pppoe0 renewal
    opnsense 30070 /usr/local/etc/rc.newwanipv6: Lost a forceful reload on WAN[wan]) due to previous lock

Since the IPv6 has reloaded the addresses are back to tentative state.
This commit may create a chain of forceful reloads, but that's nothing
that the system didn't try to attempt previously.
This commit is contained in:
Franco Fichtner 2023-07-25 10:05:45 +02:00
parent 09fc810f66
commit a23b0784c3

View File

@ -63,11 +63,11 @@ $interface_descr = convert_friendly_interface_to_friendly_descr($interface);
/* make sure only one script runs at a time beyond this point */
$fp = fopen('/tmp/newwanipv6_' . $argument, 'a+');
if (!$fp || !flock($fp, LOCK_EX | LOCK_NB)) {
if ($force == 'yes') {
log_msg("Lost a forceful reload on {$interface_descr}[{$interface}]) due to previous lock", LOG_WARNING);
/* let go if not a forceful reload, otherwise block and wait */
if ($force != 'yes' || (!$fp && !flock($fp, LOCK_EX))) {
fclose($fp);
return;
}
fclose($fp);
return;
}
/* wait for DAD to complete to avoid discarding tentative address */