Commit 75b55352 by Natanael Copa Committed by Serge Hallyn

lxc-alpine: add hwaddr for a single macvlan interface

We already add harware address for a single veth interface. Do the same with a single macvlan interface. Signed-off-by: 's avatarNatanael Copa <ncopa@alpinelinux.org> Signed-off-by: 's avatarSerge Hallyn <serge.hallyn@ubuntu.com>
parent e34b5d2e
...@@ -173,9 +173,11 @@ lxc.network.flags = up ...@@ -173,9 +173,11 @@ lxc.network.flags = up
EOF EOF
fi fi
# if there is exactly one veth network entry, make sure it has an # if there is exactly one veth or macvlan network entry, make sure
# associated mac address. # it has an associated mac address.
nics=$(grep -e '^lxc\.network\.type[ \t]*=[ \t]*veth' $path/config | wc -l) nics=$(awk -F '[ \t]*=[ \t]*' \
'$1=="lxc.network.type" && ($2=="veth" || $2=="macvlan") {print $2}' \
$path/config | wc -l)
if [ "$nics" -eq 1 ] && ! grep -q "^lxc.network.hwaddr" $path/config; then if [ "$nics" -eq 1 ] && ! grep -q "^lxc.network.hwaddr" $path/config; then
# see http://sourceforge.net/tracker/?func=detail&aid=3411497&group_id=163076&atid=826303 # see http://sourceforge.net/tracker/?func=detail&aid=3411497&group_id=163076&atid=826303
hwaddr="fe:$(dd if=/dev/urandom bs=8 count=1 2>/dev/null |od -t x8 | \ hwaddr="fe:$(dd if=/dev/urandom bs=8 count=1 2>/dev/null |od -t x8 | \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment