Skip to content

Commit

Permalink
always arp_update new addresses in 'attach'
Browse files Browse the repository at this point in the history
Previously we'd only do that when the container had no ethwe at the
start. Therefore adding a recycled IP address to an already attached
container would not send out an arp update for that IP, which would
break connectivity to that IP for containers which had previously
accessed that IP.

Fixes #1405.
  • Loading branch information
rade committed Sep 10, 2015
1 parent ac14505 commit c76838a
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions weave
Expand Up @@ -520,31 +520,27 @@ launch() {
}

attach() {
if netnsenter ip link show $CONTAINER_IFNAME >/dev/null 2>&1 ; then
for ADDR in "$@" ; do
# container already has the expected network interface, so assume we set it up already;
# just add the IP address.
if netnsenter ip addr show dev $CONTAINER_IFNAME | grep -F $ADDR >/dev/null ; then
# address was there already
continue
fi
netnsenter ip addr add $ADDR dev $CONTAINER_IFNAME || return 1
done

return 0
if ! netnsenter ip link show $CONTAINER_IFNAME >/dev/null 2>&1 ; then
connect_container_to_bridge || return 1
fi

connect_container_to_bridge || return 1

NEW_ADDRS=
for ADDR in "$@" ; do
if netnsenter ip addr show dev $CONTAINER_IFNAME | grep -F $ADDR >/dev/null ; then
# address was there already
continue
fi
netnsenter ip addr add $ADDR dev $CONTAINER_IFNAME || return 1
NEW_ADDRS="$NEW_ADDRS $ADDR"
done

netnsenter ip link set $CONTAINER_IFNAME up || return 1

for ADDR in "$@" ; do
arp_update $CONTAINER_IFNAME $ADDR "netnsenter"
done
if [ -n "$NEW_ADDRS" ] ; then
for ADDR in "$NEW_ADDRS" ; do
arp_update $CONTAINER_IFNAME $ADDR "netnsenter"
done
fi

# Route multicast packets across the weave network.
# This must come last in 'attach'. If you change this, change weavewait to match.
Expand Down

0 comments on commit c76838a

Please sign in to comment.