+ # at least 7 octets -> could be type 1 or type 2
+ $pat:$pat:$pat:$pat:$pat:$pat:*)
+ local len_id=":$(echo "$mac" | sed -e 's/[^:]//g')"
+ local len_hi=$(printf "%02x" $((${#len_id} / 0xFF)) )
+ local len_lo=$(printf "%02x" $((${#len_id} % 0xFF)) )
+
+ # low endian
+ if [ "$(printf \\1 | hexdump -n1 -ve '8/2 "%04x"')" = "0001" ]; then
+ printf \\x$len_lo\\x$len_hi
+
+ # big endian
+ else
+ printf \\x$len_hi\\x$len_lo
+ fi
+
+ printf $(echo "$mac" | sed -e 's/^/\\x/; s/:/\\x/g')
+ logger -t dhcp6c "Using user provided DUID $mac"
+ ;;