From c8e0c12d34a690460acd493561f0f76feeda8dfd Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Sat, 15 Apr 2017 10:29:15 +0000 Subject: [PATCH] Move AWSVPC sysctls into Go code --- net/bridge.go | 12 ++++++++++++ weave | 8 -------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/net/bridge.go b/net/bridge.go index 7ca50a51..c0514e50 100644 --- a/net/bridge.go +++ b/net/bridge.go @@ -228,6 +228,18 @@ func CreateBridge(config *BridgeConfig) (BridgeType, error) { if config.IsAWSVPC { bridgeType = AWSVPC + // Set proxy_arp on the bridge, so that it could accept packets destined + // to containers within the same subnet but running on remote hosts. + // Without it, exact routes on each container are required. + if err := sysctl("net/ipv4/conf/"+config.WeaveBridgeName+"/proxy_arp", "1"); err != nil { + return bridgeType, errors.Wrap(err, "setting proxy_arp") + } + // Avoid delaying the first ARP request. Also, setting it to 0 avoids + // placing the request into a bounded queue as it can be seen: + // https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/net/ipv4/arp.c?id=refs/tags/v4.6.1#n819 + if err := sysctl("net/ipv4/neigh/"+config.WeaveBridgeName+"/proxy_delay", "0"); err != nil { + return bridgeType, errors.Wrap(err, "setting proxy_arp") + } } if bridgeType == Bridge { diff --git a/weave b/weave index 5fbfeb0c..b79fe4e1 100755 --- a/weave +++ b/weave @@ -1427,14 +1427,6 @@ launch_router() { setup_awsvpc() { if [ -n "$AWSVPC" ]; then - # Set proxy_arp on the bridge, so that it could accept packets destined - # to containers within the same subnet but running on remote hosts. - # Without it, exact routes on each container are required. - echo 1 >$PROC_PATH/sys/net/ipv4/conf/$BRIDGE/proxy_arp - # Avoid delaying the first ARP request. Also, setting it to 0 avoids - # placing the request into a bounded queue as it can be seen: - # https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/net/ipv4/arp.c?id=refs/tags/v4.6.1#n819 - echo 0 >$PROC_PATH/sys/net/ipv4/neigh/$BRIDGE/proxy_delay expose_ip fi }