Skip to content

Commit 3869385

Browse files
committed
rc: defer newwanip not exectued during boot
PR: https://forum.opnsense.org/index.php?topic=6891.0
1 parent cd5e233 commit 3869385

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

plist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@
140140
/usr/local/etc/rc.syshook.d/05-beep.stop
141141
/usr/local/etc/rc.syshook.d/05-update.early
142142
/usr/local/etc/rc.syshook.d/10-configd.early
143+
/usr/local/etc/rc.syshook.d/10-newwanip.start
143144
/usr/local/etc/rc.syshook.d/15-php.early
144145
/usr/local/etc/rc.syshook.d/20-backup.early
145146
/usr/local/etc/rc.syshook.d/20-freebsd.start

src/etc/rc.newwanip

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ require_once("interfaces.inc");
4141
$argument = isset($argv[1]) ? trim($argv[1]) : '';
4242

4343
if (file_exists('/var/run/booting')) {
44-
log_error("IP renewal ignored during boot on '{$argument}'");
44+
log_error("IP renewal deferred during boot on '{$argument}'");
45+
file_put_contents('/tmp/newwanip_' . uniqid(), $argument);
4546
return;
4647
}
4748

src/etc/rc.newwanipv6

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ require_once("interfaces.inc");
4141
$argument = isset($argv[1]) ? trim($argv[1]) : '';
4242

4343
if (file_exists('/var/run/booting')) {
44-
log_error("IP renewal ignored during boot on '{$argument}'");
44+
log_error("IP renewal deferred during boot on '{$argument}'");
45+
file_put_contents('/tmp/newwanipv6_' . uniqid(), $argument);
4546
return;
4647
}
4748

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
3+
for IPV4 in $(find /tmp -type f -name "newwanip_*"); do
4+
/usr/local/opnsense/service/configd_ctl.py interface newip $(cat "${IPV4}")
5+
rm "${IPV4}"
6+
done
7+
8+
for IPV6 in $(find /tmp -type f -name "newwanipv6_*"); do
9+
/usr/local/opnsense/service/configd_ctl.py interface newipv6 $(cat "${IPV6}")
10+
rm "${IPV6}"
11+
done

0 commit comments

Comments
 (0)