|
|
@ -23,22 +23,22 @@ xappend() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
hex_to_hostid() { |
|
|
|
hex_to_hostid() { |
|
|
|
local var="$1" |
|
|
|
local var="$1" |
|
|
|
local hex="${2#0x}" # strip optional "0x" prefix |
|
|
|
local hex="${2#0x}" # strip optional "0x" prefix |
|
|
|
|
|
|
|
|
|
|
|
if [ -n "${hex//[0-9a-fA-F]/}" ]; then |
|
|
|
if [ -n "${hex//[0-9a-fA-F]/}" ]; then |
|
|
|
# is invalid hex literal |
|
|
|
# is invalid hex literal |
|
|
|
return 1 |
|
|
|
return 1 |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
# convert into host id |
|
|
|
# convert into host id |
|
|
|
export "$var=$( |
|
|
|
export "$var=$( |
|
|
|
printf "%0x:%0x" \ |
|
|
|
printf "%0x:%0x" \ |
|
|
|
$(((0x$hex >> 16) % 65536)) \ |
|
|
|
$(((0x$hex >> 16) % 65536)) \ |
|
|
|
$(( 0x$hex % 65536)) |
|
|
|
$(( 0x$hex % 65536)) |
|
|
|
)" |
|
|
|
)" |
|
|
|
|
|
|
|
|
|
|
|
return 0 |
|
|
|
return 0 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
dhcp_calc() { |
|
|
|
dhcp_calc() { |
|
|
|