]> gitweb.fluxo.info Git - kvm-manager.git/commitdiff
sort -n doesn't properly sort hex values - resulting in duplicate
authorJamie McClelland <jm@mayfirst.org>
Tue, 10 May 2011 21:18:31 +0000 (17:18 -0400)
committerDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Tue, 10 May 2011 22:07:54 +0000 (18:07 -0400)
mac address if the last mac address created ends in 0a (we get 09 as
the last sorted address, hence 0a gets created again).

kvm-creator

index 9e2ad41c4152033c3a55f1e24cfab9077c9e03d3..2428000704fa9d19956f17af50801f83fbf3a483 100755 (executable)
@@ -26,7 +26,7 @@ UDEV_RULES_FILE="/etc/udev/rules.d/92-kvm_creator-%s.rules"
 ls /etc/sv/kvm/* &> /dev/null
 if [ "$?" -eq 0 ]; then
   TAP="${5:-tap$(( $( cat /etc/sv/kvm/*/env/TAP | sed 's/^tap//' | sort -n  | tail -n 1 ) + 1 ))}"
-  MAC="${6:-$(printf "%s:%02x" "$(cat /etc/sv/kvm/*/env/MAC | sort | head -n1 | cut -f 1-5 -d: )" "$(( 0x$( cat /etc/sv/kvm/*/env/MAC | cut -f 6 -d:  | sort -n  | tail -n 1 ) + 1 ))" )}"
+  MAC="${6:-$(printf "%s:%02x" "$(cat /etc/sv/kvm/*/env/MAC | sort | head -n1 | cut -f 1-5 -d: )" "$(( 0x$( cat /etc/sv/kvm/*/env/MAC | cut -f 6 -d:  | sort | tail -n 1 ) + 1 ))" )}"
 else
   TAP=tap0
   # use a locally-administered MAC address: