From a23b0784c34cc0bf6be41b534b58b8ef5bb44a56 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Tue, 25 Jul 2023 10:05:45 +0200 Subject: [PATCH] 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. --- src/etc/rc.newwanipv6 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/etc/rc.newwanipv6 b/src/etc/rc.newwanipv6 index 7c3831a10..403b6b300 100755 --- a/src/etc/rc.newwanipv6 +++ b/src/etc/rc.newwanipv6 @@ -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 */