Merge lp:~benji/ubuntu/precise/lxc/bug-949956 into lp:ubuntu/precise/lxc

Proposed by Benji York
Status: Merged
Merged at revision: 74
Proposed branch: lp:~benji/ubuntu/precise/lxc/bug-949956
Merge into: lp:ubuntu/precise/lxc
Diff against target: 32 lines (+17/-0)
2 files modified
.bzrignore (+2/-0)
debian/local/lxc-start-ephemeral (+15/-0)
To merge this branch: bzr merge lp:~benji/ubuntu/precise/lxc/bug-949956
Reviewer Review Type Date Requested Status
Ubuntu branches Pending
Review via email: mp+96601@code.launchpad.net

Commit message

add MAC address randomization to lxc-start-ephemeral. (LP: #949956)

Description of the change

This branch adds the lxc-clone MAC address randomization functionality
to lxc-start-ephemeral.

The code was copied nearly verbatim, with only a slight tweak to account
for the different variable names used in lxc-start-ephemeral.

The change has been manually tested in an application that requires
starting multiple ephemeral containers based on the same original
container.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file '.bzrignore'
2--- .bzrignore 1970-01-01 00:00:00 +0000
3+++ .bzrignore 2012-03-08 16:03:06 +0000
4@@ -0,0 +1,2 @@
5+tags
6+TAGS
7
8=== modified file 'debian/local/lxc-start-ephemeral'
9--- debian/local/lxc-start-ephemeral 2012-03-02 17:20:46 +0000
10+++ debian/local/lxc-start-ephemeral 2012-03-08 16:03:06 +0000
11@@ -125,6 +125,21 @@
12 fi
13 sudo sed -i -e "s/$LXC_BASE/$LXC_NAME/" $LXC_DIR/fstab $LXC_DIR/config $LXC_DIR/rootfs/etc/hostname $LXC_DIR/rootfs/etc/hosts
14
15+# update the ephemeral container's MAC address (lifted from lxc-clone)
16+c=$LXC_DIR/config
17+# change hwaddrs
18+mv ${c} ${c}.old
19+(
20+while read line; do
21+ if [ "${line:0:18}" = "lxc.network.hwaddr" ]; then
22+ echo "lxc.network.hwaddr= 00:16:3e:$(openssl rand -hex 3| sed 's/\(..\)/\1:/g; s/.$//')"
23+ else
24+ echo $line
25+ fi
26+done
27+) < ${c}.old > ${c}
28+rm -f ${c}.old
29+
30 # precise is now the worst - its dhclient *uses*
31 # /var/lib/dhcp3/dhclient.eth0.leases but ships without that
32 # directory, so you get no leases file at all.

Subscribers

People subscribed via source and target branches

to all changes: