diff --git a/src/etc/rc.newwanip b/src/etc/rc.newwanip index ef2ab0f86..acffa370a 100755 --- a/src/etc/rc.newwanip +++ b/src/etc/rc.newwanip @@ -42,7 +42,7 @@ $argument = isset($argv[1]) ? trim($argv[1]) : ''; if (file_exists('/var/run/booting')) { log_error("IP renewal deferred during boot on '{$argument}'"); - file_put_contents('/tmp/newwanip_' . uniqid(), $argument); + file_put_contents('/tmp/newwanip_' . $argument, $argument); return; } diff --git a/src/etc/rc.newwanipv6 b/src/etc/rc.newwanipv6 index 602e4c050..dff78c83b 100755 --- a/src/etc/rc.newwanipv6 +++ b/src/etc/rc.newwanipv6 @@ -42,7 +42,7 @@ $argument = isset($argv[1]) ? trim($argv[1]) : ''; if (file_exists('/var/run/booting')) { log_error("IP renewal deferred during boot on '{$argument}'"); - file_put_contents('/tmp/newwanipv6_' . uniqid(), $argument); + file_put_contents('/tmp/newwanipv6_' . $argument, $argument); return; } diff --git a/src/etc/rc.syshook.d/10-newwanip.start b/src/etc/rc.syshook.d/10-newwanip.start index c83b0fd47..ecd64b7e5 100755 --- a/src/etc/rc.syshook.d/10-newwanip.start +++ b/src/etc/rc.syshook.d/10-newwanip.start @@ -1,13 +1,17 @@ #!/bin/sh for IPV4 in $(find /tmp -type f -name "newwanip_*"); do - echo -n "Reconfiguring IPv4: " - /usr/local/opnsense/service/configd_ctl.py interface newip $(cat "${IPV4}") + INTERFACE=$(cat "${IPV4}") rm "${IPV4}" + + echo -n "Reconfiguring IPv4 on ${INTERFACE}: " + /usr/local/opnsense/service/configd_ctl.py interface newip ${INTERFACE} done for IPV6 in $(find /tmp -type f -name "newwanipv6_*"); do - echo -n "Reconfiguring IPv6: " - /usr/local/opnsense/service/configd_ctl.py interface newipv6 $(cat "${IPV6}") + INTERFACE=$(cat "${IPV6}") rm "${IPV6}" + + echo -n "Reconfiguring IPv6 on ${INTERFACE}: " + /usr/local/opnsense/service/configd_ctl.py interface newipv6 ${INTERFACE} done