Description: lxc-clone: update any hwaddrs
 Since we are creating a new container it should not share a macaddr with
 the original container.
 This patch will be forwarded upstream.
Author: Serge Hallyn <serge.hallyn@ubuntu.com>
Forwarded: yes
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/934256

Index: lxc-0.8.0~rc1/src/lxc/lxc-clone.in
===================================================================
--- lxc-0.8.0~rc1.orig/src/lxc/lxc-clone.in	2012-04-23 23:09:19.047940787 -0500
+++ lxc-0.8.0~rc1/src/lxc/lxc-clone.in	2012-04-23 23:09:35.103940516 -0500
@@ -263,6 +263,20 @@
     sed -i "s/send host-name.*$/send host-name \"$hostname\";/" $rootfs/etc/dhcp/dhclient.conf
 fi
 
+c=$lxc_path/$lxc_new/config
+# change hwaddrs
+mv ${c} ${c}.old
+(
+while read line; do
+	if [ "${line:0:18}" = "lxc.network.hwaddr" ]; then
+		echo "lxc.network.hwaddr= 00:16:3e:$(openssl rand -hex 3| sed 's/\(..\)/\1:/g; s/.$//')"
+	else
+		echo $line
+	fi
+done
+) < ${c}.old > ${c}
+rm -f ${c}.old
+
 # set the hostname
 cat <<EOF > $rootfs/etc/hostname
 $hostname
