[PATCH] base-files: reduce IPv6 ULA prefix generation to a single call

Paul D newtwen at gmail.com
Tue Apr 2 15:50:50 PDT 2024


On 2024-04-02 23:00, Elliott Mitchell wrote:
> Second, appears the ${parameter:offset:length} may not be POSIX.  I
> dislike this, but do not object since OpenWRT's shell is built with this
> functionality enabled.


UUOC! Ha. Yes, there are a few non POSIXy things in openwrt ash. A number of other scripts already take advantage of them so it's OK, if it avoids several external calls to e.g. cut or td.

How about POSIX native array IFS split?


IFS=' ' set -- $(hexdump -vn 5 -e '5/1 "%02x "' /dev/urandom)

uci -q batch <<-EOF >/dev/null
	set network.globals.ula_prefix=fd$1:$2$3:$4$5::/48
	commit network
EOF



More information about the openwrt-devel mailing list