forked from Openwrt/openwrt
27edf28b11
Reduce calls and pipes and read from urandom once directly with hexdump for the necessary 5 bytes of random data to build the 48 bit ULA Prefix. Fewer calls and forks; finish quicker; less memory used. Tested on: 23.05.3 Signed-off-by: Paul Donald <newtwen+github@gmail.com>
10 lines
228 B
Plaintext
10 lines
228 B
Plaintext
[ "$(uci -q get network.globals.ula_prefix)" != "auto" ] && exit 0
|
|
|
|
uci -q batch <<-EOF >/dev/null
|
|
set network.globals.ula_prefix="$(hexdump -vn 5 -e '"fd" 1/1 "%02x:" 2/2 "%x:"' /dev/urandom):/48"
|
|
commit network
|
|
EOF
|
|
|
|
exit 0
|
|
|