more precise detection of weave-attached-ness

Rather than looking for the host end of the veth pair, we look for the
expected interface inside the container. This has the advantage of
detecting weave-attached-ness even when the container is sharing a
network namespace with others.

Closes #303, #302.
This commit is contained in:
Matthias Radestock committed 2014-12-29 14:14:53 +00:00
1 parent 7cfb79cfc1
commit 70eea06de0
1 file changed
+2 -2
+2 -2
View File
@@ -227,8 +227,8 @@ launch() {
}
attach() {
if ip link show $LOCAL_IFNAME >/dev/null 2>&1 ; then
# veth name already exists, so assume we set it up already;
if ip netns exec $NETNS ip link show $CONTAINER_IFNAME >/dev/null 2>&1 ; then
# container already has the expected network interface, so assume we set it up already;
# just add the IP address.
if ip netns exec $NETNS ip addr show dev $CONTAINER_IFNAME | grep -F $1 >/dev/null ; then
# address was there already