aboutsummaryrefslogtreecommitdiffstats
path: root/examples/source/init-ipv6/up
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2025-05-05 06:29:50 +0000
committerLaurent Bercot <ska@appnovation.com>2025-05-05 06:29:50 +0000
commite18d6958b2470a2e68cc637945ccf3a1dae5c0a2 (patch)
tree90e065e7b7422c2f2dbd5d924dfcd14a2866de39 /examples/source/init-ipv6/up
parent09ccd3128f2296d3a0cd1602e64caf06cf22c64f (diff)
downloads6-rc-e18d6958b2470a2e68cc637945ccf3a1dae5c0a2.tar.gz
Update examples
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'examples/source/init-ipv6/up')
-rw-r--r--examples/source/init-ipv6/up35
1 files changed, 35 insertions, 0 deletions
diff --git a/examples/source/init-ipv6/up b/examples/source/init-ipv6/up
new file mode 100644
index 0000000..4e2d602
--- /dev/null
+++ b/examples/source/init-ipv6/up
@@ -0,0 +1,35 @@
+if { modprobe ipv6 }
+if { redirfd -w 1 /proc/sys/net/ipv6/conf/all/forwarding s6-echo 1 }
+if { redirfd -w 1 /proc/sys/net/ipv6/conf/default/accept_ra s6-echo 0 }
+if { s6-mkdir -p /run/udhcpc6-eth2/by_interface }
+if { s6-mkdir -p /run/udhcpc6-eth2/by_prefix }
+
+if
+{
+ s6-envdir /etc/env-network
+ forx -pE i { eth0 eth1 eth2 eth3 wlan0 wlan1 }
+ backtick -E j { pipeline { s6-echo $i } tr [[:lower:]] [[:upper:]] }
+ multisubstitute
+ {
+ importas -uD "" ip6 ${j}_IP6
+ importas -ui ip6bis ${j}_IP6_BIS
+ }
+ if { if -t { eltest -n ${ip6} } ip -6 addr add ${ip6}/64 dev $i }
+ ip -6 addr add ${ip6bis}/64 dev $i preferred_lft 0
+}
+
+if
+{
+ forbacktickx -Ep i
+ {
+ if { s6-echo "00\n01\n02\n03\n04\n05\n06\n07\n08\n09\n0a\n0b\n0c\n0d\n0e\n0f" }
+ pipeline { if { s6-echo "obase=16" } seq 16 62 }
+ pipeline { bc }
+ tr [[:upper:]] [[:lower:]]
+ }
+ if { ip link add eth2_$i link eth2 type macvlan }
+ if { ip link set dev eth2_$i up }
+ s6-instance-create -d /run/service/udhcpc6-eth2 $i
+}
+
+redirfd -w 1 /proc/sys/net/ipv6/conf/eth2/accept_ra s6-echo 2