aboutsummaryrefslogtreecommitdiff
path: root/layout/rootfs/etc/udhcpc
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-05-22 21:56:04 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-05-22 21:56:04 +0000
commit82d0f92ab8b84466ae20ab919c1f9c3577b5cecb (patch)
tree776015ae6c6a386125b2d39e13b62f91b99548f8 /layout/rootfs/etc/udhcpc
downloadlh-bootstrap-82d0f92ab8b84466ae20ab919c1f9c3577b5cecb.tar.xz
Initial commit
Diffstat (limited to 'layout/rootfs/etc/udhcpc')
-rwxr-xr-xlayout/rootfs/etc/udhcpc/bound25
-rwxr-xr-xlayout/rootfs/etc/udhcpc/deconfig7
-rwxr-xr-xlayout/rootfs/etc/udhcpc/leasefail7
-rwxr-xr-xlayout/rootfs/etc/udhcpc/nak7
-rwxr-xr-xlayout/rootfs/etc/udhcpc/renew12
-rwxr-xr-xlayout/rootfs/etc/udhcpc/udhcpc-script4
6 files changed, 62 insertions, 0 deletions
diff --git a/layout/rootfs/etc/udhcpc/bound b/layout/rootfs/etc/udhcpc/bound
new file mode 100755
index 0000000..8b87214
--- /dev/null
+++ b/layout/rootfs/etc/udhcpc/bound
@@ -0,0 +1,25 @@
+#!/command/execlineb -P
+
+multisubstitute
+{
+ import -ui interface
+ import -ui ip
+ import -ui subnet
+ import -ui mask
+ import -ui router
+ import -ui dns
+ import -uD localdomain domain
+ import -ui lease
+}
+
+foreground
+{
+ redirfd -w 1 /run/service/udhcpc-${interface}/env/IPARG
+ s6-echo -- "-r "${ip}" "
+}
+unexport ?
+if { s6-echo "udhcpc-script: bound: ${ip}/${mask} on ${interface}, gateway ${router}, lease time ${lease}" }
+if { ip addr add ${ip}/${subnet} dev ${interface} }
+foreground { redirfd -w 2 /dev/null ip route del default }
+if { route add default gw ${router} }
+fdmove 1 3 s6-echo
diff --git a/layout/rootfs/etc/udhcpc/deconfig b/layout/rootfs/etc/udhcpc/deconfig
new file mode 100755
index 0000000..b66ae9e
--- /dev/null
+++ b/layout/rootfs/etc/udhcpc/deconfig
@@ -0,0 +1,7 @@
+#!/command/execlineb -P
+multisubstitute
+{
+ import -uD "<no server id>" serverid
+ import -uD "<no error message>" message
+}
+s6-echo "udhcpc-script: deconfig: server ${serverid} said: ${message}"
diff --git a/layout/rootfs/etc/udhcpc/leasefail b/layout/rootfs/etc/udhcpc/leasefail
new file mode 100755
index 0000000..579dbac
--- /dev/null
+++ b/layout/rootfs/etc/udhcpc/leasefail
@@ -0,0 +1,7 @@
+#!/command/execlineb -P
+multisubstitute
+{
+ import -uD "<no server id>" serverid
+ import -uD "<no error message>" message
+}
+s6-echo "udhcpc-script: leasefail: server ${serverid} said: ${message}"
diff --git a/layout/rootfs/etc/udhcpc/nak b/layout/rootfs/etc/udhcpc/nak
new file mode 100755
index 0000000..3ed0bb6
--- /dev/null
+++ b/layout/rootfs/etc/udhcpc/nak
@@ -0,0 +1,7 @@
+#!/command/execlineb -P
+multisubstitute
+{
+ import -uD "<no server id>" serverid
+ import -uD "<no error message>" message
+}
+s6-echo "udhcpc-script: nak: server ${serverid} said: ${message}"
diff --git a/layout/rootfs/etc/udhcpc/renew b/layout/rootfs/etc/udhcpc/renew
new file mode 100755
index 0000000..1bd5236
--- /dev/null
+++ b/layout/rootfs/etc/udhcpc/renew
@@ -0,0 +1,12 @@
+#!/command/execlineb -P
+
+multisubstitute
+{
+ import -ui interface
+ import -ui ip
+ import -uD "<unknown mask>" mask
+ import -uD "<unknown DNS>" dns
+ import -ui router
+ import -ui lease
+}
+s6-echo "udhcpc-script: renew: ${ip}/${mask} on ${interface}, gateway ${router}, lease time ${lease}"
diff --git a/layout/rootfs/etc/udhcpc/udhcpc-script b/layout/rootfs/etc/udhcpc/udhcpc-script
new file mode 100755
index 0000000..9db2042
--- /dev/null
+++ b/layout/rootfs/etc/udhcpc/udhcpc-script
@@ -0,0 +1,4 @@
+#!/command/execlineb -S1
+ifelse { s6-test $# -ge 1 } { /etc/udhcpc/$1 }
+if { fdmove -c 1 2 s6-echo "udhcpc-script: too few arguments" }
+exit 1