From 2369b43c8dc332f173409be7854e33b156c7fd6a Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Mon, 16 Mar 2015 15:33:05 +0000 Subject: [PATCH] cosmetic: move new funs to 'right' place --- weave | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/weave b/weave index f3ad2e8f..89763f0f 100755 --- a/weave +++ b/weave @@ -121,6 +121,30 @@ delete_iptables_rule() { fi } +# Configure the ARP cache parameters for the given interface. This +# makes containers react more quickly to a change in the MAC address +# associated with an IP address. +configure_arp_cache() { + $2 sh -c "echo 5 >/proc/sys/net/ipv4/neigh/$1/base_reachable_time && + echo 2 >/proc/sys/net/ipv4/neigh/$1/delay_first_probe_time && + echo 1 >/proc/sys/net/ipv4/neigh/$1/ucast_solicit" +} + +# Send out an unsolicated ARP response to update ARP cache entries +# accross the weave network. We do this in addition to +# configure_arp_cache because a) with those ARP cache settings it +# still takes a few seconds to correct a stale ARP mapping, and b) +# there is a kernel bug that means that the base_reachable_time +# setting is not promptly obeyed +# (>). +arp_update() { + # It's not the end of the world if this doesn't run - we configure + # ARP caches so that stale entries will be noticed quickly. + if command_exists arping ; then + $3 arping -U -q -I $1 -c 1 ${2%/*} + fi +} + create_bridge() { [ ! -d /sys/class/net/$BRIDGE ] && { ip link add name $BRIDGE type bridge @@ -285,30 +309,6 @@ attach() { arp_update $CONTAINER_IFNAME $1 "ip netns exec $NETNS" } -# Configure the ARP cache parameters for the given interface. This -# makes containers react more quickly to a change in the MAC address -# associated with an IP address. -configure_arp_cache() { - $2 sh -c "echo 5 >/proc/sys/net/ipv4/neigh/$1/base_reachable_time && - echo 2 >/proc/sys/net/ipv4/neigh/$1/delay_first_probe_time && - echo 1 >/proc/sys/net/ipv4/neigh/$1/ucast_solicit" -} - -# Send out an unsolicated ARP response to update ARP cache entries -# accross the weave network. We do this in addition to -# configure_arp_cache because a) with those ARP cache settings it -# still takes a few seconds to correct a stale ARP mapping, and b) -# there is a kernel bug that means that the base_reachable_time -# setting is not promptly obeyed -# (>). -arp_update() { - # It's not the end of the world if this doesn't run - we configure - # ARP caches so that stale entries will be noticed quickly. - if command_exists arping ; then - $3 arping -U -q -I $1 -c 1 ${2%/*} - fi -} - detach() { if ! ip netns exec $NETNS ip addr show dev $CONTAINER_IFNAME | grep -F $1 >/dev/null ; then # address is not there, leave the device alone