Merge pull request #1755 from weaveworks/issues/1741-weave-no-multicast-route
Add options to disable multicast route - LGTM; fixes #1741
This commit is contained in:
commit
d1ba4ab7f4
13 files changed
+157
-40
No files matched your search
@@ -40,6 +40,7 @@ prog/weaveproxy/weaveproxy
|
|||||||
prog/sigproxy/sigproxy
|
prog/sigproxy/sigproxy
|
||||||
prog/weavewait/weavewait
|
prog/weavewait/weavewait
|
||||||
prog/weavewait/weavewait_noop
|
prog/weavewait/weavewait_noop
|
||||||
|
prog/weavewait/weavewait_nomcast
|
||||||
prog/netcheck/netcheck
|
prog/netcheck/netcheck
|
||||||
prog/docker_tls_args/docker_tls_args
|
prog/docker_tls_args/docker_tls_args
|
||||||
prog/plugin/plugin
|
prog/plugin/plugin
|
||||||
@@ -56,6 +57,7 @@ prog/weaveexec/weavehosts
|
|||||||
prog/weaveexec/weaveproxy
|
prog/weaveexec/weaveproxy
|
||||||
prog/weaveexec/weavewait
|
prog/weaveexec/weavewait
|
||||||
prog/weaveexec/weavewait_noop
|
prog/weaveexec/weavewait_noop
|
||||||
|
prog/weaveexec/weavewait_nomcast
|
||||||
prog/weaveexec/sigproxy
|
prog/weaveexec/sigproxy
|
||||||
prog/weaveexec/netcheck
|
prog/weaveexec/netcheck
|
||||||
prog/weaveexec/docker_tls_args
|
prog/weaveexec/docker_tls_args
|
||||||
|
|||||||
@@ -14,13 +14,14 @@ WEAVEPROXY_EXE=prog/weaveproxy/weaveproxy
|
|||||||
SIGPROXY_EXE=prog/sigproxy/sigproxy
|
SIGPROXY_EXE=prog/sigproxy/sigproxy
|
||||||
WEAVEWAIT_EXE=prog/weavewait/weavewait
|
WEAVEWAIT_EXE=prog/weavewait/weavewait
|
||||||
WEAVEWAIT_NOOP_EXE=prog/weavewait/weavewait_noop
|
WEAVEWAIT_NOOP_EXE=prog/weavewait/weavewait_noop
|
||||||
|
WEAVEWAIT_NOMCAST_EXE=prog/weavewait/weavewait_nomcast
|
||||||
NETCHECK_EXE=prog/netcheck/netcheck
|
NETCHECK_EXE=prog/netcheck/netcheck
|
||||||
DOCKERTLSARGS_EXE=prog/docker_tls_args/docker_tls_args
|
DOCKERTLSARGS_EXE=prog/docker_tls_args/docker_tls_args
|
||||||
DOCKERPLUGIN_EXE=prog/plugin/plugin
|
DOCKERPLUGIN_EXE=prog/plugin/plugin
|
||||||
RUNNER_EXE=tools/runner/runner
|
RUNNER_EXE=tools/runner/runner
|
||||||
TEST_TLS_EXE=test/tls/tls
|
TEST_TLS_EXE=test/tls/tls
|
||||||
|
|
||||||
EXES=$(WEAVER_EXE) $(SIGPROXY_EXE) $(WEAVEPROXY_EXE) $(WEAVEWAIT_EXE) $(WEAVEWAIT_NOOP_EXE) $(NETCHECK_EXE) $(DOCKERTLSARGS_EXE) $(DOCKERPLUGIN_EXE) $(TEST_TLS_EXE)
|
EXES=$(WEAVER_EXE) $(SIGPROXY_EXE) $(WEAVEPROXY_EXE) $(WEAVEWAIT_EXE) $(WEAVEWAIT_NOOP_EXE) $(WEAVEWAIT_NOMCAST_EXE) $(NETCHECK_EXE) $(DOCKERTLSARGS_EXE) $(DOCKERPLUGIN_EXE) $(TEST_TLS_EXE)
|
||||||
|
|
||||||
WEAVER_UPTODATE=.weaver.uptodate
|
WEAVER_UPTODATE=.weaver.uptodate
|
||||||
WEAVEEXEC_UPTODATE=.weaveexec.uptodate
|
WEAVEEXEC_UPTODATE=.weaveexec.uptodate
|
||||||
@@ -81,29 +82,37 @@ $(NETCHECK_EXE): prog/netcheck/netcheck.go
|
|||||||
# These next programs need separate rules as they fail the netgo check in
|
# These next programs need separate rules as they fail the netgo check in
|
||||||
# the main build stanza due to not importing net package
|
# the main build stanza due to not importing net package
|
||||||
$(SIGPROXY_EXE): prog/sigproxy/main.go
|
$(SIGPROXY_EXE): prog/sigproxy/main.go
|
||||||
$(WEAVEWAIT_EXE): prog/weavewait/*.go net/*.go
|
|
||||||
$(DOCKERTLSARGS_EXE): prog/docker_tls_args/*.go
|
$(DOCKERTLSARGS_EXE): prog/docker_tls_args/*.go
|
||||||
$(DOCKERPLUGIN_EXE): prog/plugin/*.go plugin/net/*.go plugin/ipam/*.go plugin/skel/*.go api/*.go common/docker/*.go
|
$(DOCKERPLUGIN_EXE): prog/plugin/*.go plugin/net/*.go plugin/ipam/*.go plugin/skel/*.go api/*.go common/docker/*.go
|
||||||
$(TEST_TLS_EXE): test/tls/*.go
|
$(TEST_TLS_EXE): test/tls/*.go
|
||||||
|
|
||||||
$(WEAVEWAIT_EXE) $(SIGPROXY_EXE) $(DOCKERTLSARGS_EXE) $(DOCKERPLUGIN_EXE) $(TEST_TLS_EXE):
|
$(SIGPROXY_EXE) $(DOCKERTLSARGS_EXE) $(DOCKERPLUGIN_EXE) $(TEST_TLS_EXE):
|
||||||
go get -tags netgo ./$(@D)
|
go get -tags netgo ./$(@D)
|
||||||
go build $(BUILD_FLAGS) -o $@ ./$(@D)
|
go build $(BUILD_FLAGS) -o $@ ./$(@D)
|
||||||
|
|
||||||
|
$(WEAVEWAIT_EXE): prog/weavewait/*.go net/*.go
|
||||||
|
go get -tags netgo ./$(@D)
|
||||||
|
go build $(BUILD_FLAGS) -tags "iface mcast" -o $@ ./$(@D)
|
||||||
|
|
||||||
|
$(WEAVEWAIT_NOMCAST_EXE): prog/weavewait/*.go net/*.go
|
||||||
|
go get -tags netgo ./$(@D)
|
||||||
|
go build $(BUILD_FLAGS) -tags iface -o $@ ./$(@D)
|
||||||
|
|
||||||
$(WEAVEWAIT_NOOP_EXE): prog/weavewait/*.go
|
$(WEAVEWAIT_NOOP_EXE): prog/weavewait/*.go
|
||||||
go get -tags netgo ./$(@D)
|
go get -tags netgo ./$(@D)
|
||||||
go build $(BUILD_FLAGS) -tags noop -o $@ ./$(@D)
|
go build $(BUILD_FLAGS) -o $@ ./$(@D)
|
||||||
|
|
||||||
$(WEAVER_UPTODATE): prog/weaver/Dockerfile $(WEAVER_EXE)
|
$(WEAVER_UPTODATE): prog/weaver/Dockerfile $(WEAVER_EXE)
|
||||||
$(SUDO) docker build -t $(WEAVER_IMAGE) prog/weaver
|
$(SUDO) docker build -t $(WEAVER_IMAGE) prog/weaver
|
||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
$(WEAVEEXEC_UPTODATE): prog/weaveexec/Dockerfile prog/weaveexec/symlink $(DOCKER_DISTRIB) weave $(SIGPROXY_EXE) $(WEAVEPROXY_EXE) $(WEAVEWAIT_EXE) $(WEAVEWAIT_NOOP_EXE) $(NETCHECK_EXE) $(DOCKERTLSARGS_EXE)
|
$(WEAVEEXEC_UPTODATE): prog/weaveexec/Dockerfile prog/weaveexec/symlink $(DOCKER_DISTRIB) weave $(SIGPROXY_EXE) $(WEAVEPROXY_EXE) $(WEAVEWAIT_EXE) $(WEAVEWAIT_NOOP_EXE) $(WEAVEWAIT_NOMCAST_EXE) $(NETCHECK_EXE) $(DOCKERTLSARGS_EXE)
|
||||||
cp weave prog/weaveexec/weave
|
cp weave prog/weaveexec/weave
|
||||||
cp $(SIGPROXY_EXE) prog/weaveexec/sigproxy
|
cp $(SIGPROXY_EXE) prog/weaveexec/sigproxy
|
||||||
cp $(WEAVEPROXY_EXE) prog/weaveexec/weaveproxy
|
cp $(WEAVEPROXY_EXE) prog/weaveexec/weaveproxy
|
||||||
cp $(WEAVEWAIT_EXE) prog/weaveexec/weavewait
|
cp $(WEAVEWAIT_EXE) prog/weaveexec/weavewait
|
||||||
cp $(WEAVEWAIT_NOOP_EXE) prog/weaveexec/weavewait_noop
|
cp $(WEAVEWAIT_NOOP_EXE) prog/weaveexec/weavewait_noop
|
||||||
|
cp $(WEAVEWAIT_NOMCAST_EXE) prog/weaveexec/weavewait_nomcast
|
||||||
cp $(NETCHECK_EXE) prog/weaveexec/netcheck
|
cp $(NETCHECK_EXE) prog/weaveexec/netcheck
|
||||||
cp $(DOCKERTLSARGS_EXE) prog/weaveexec/docker_tls_args
|
cp $(DOCKERTLSARGS_EXE) prog/weaveexec/docker_tls_args
|
||||||
cp $(DOCKER_DISTRIB) prog/weaveexec/docker.tgz
|
cp $(DOCKER_DISTRIB) prog/weaveexec/docker.tgz
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ LABEL works.weave.role=system
|
|||||||
WORKDIR /home/weave
|
WORKDIR /home/weave
|
||||||
VOLUME /w
|
VOLUME /w
|
||||||
VOLUME /w-noop
|
VOLUME /w-noop
|
||||||
|
VOLUME /w-nomcast
|
||||||
ENTRYPOINT ["/home/weave/sigproxy", "/home/weave/weave"]
|
ENTRYPOINT ["/home/weave/sigproxy", "/home/weave/weave"]
|
||||||
|
|
||||||
RUN apk add --update \
|
RUN apk add --update \
|
||||||
@@ -22,4 +23,5 @@ ADD ./weave ./sigproxy ./weaveproxy ./symlink /home/weave/
|
|||||||
ADD ./netcheck ./docker_tls_args /usr/bin/
|
ADD ./netcheck ./docker_tls_args /usr/bin/
|
||||||
ADD ./weavewait /w/w
|
ADD ./weavewait /w/w
|
||||||
ADD ./weavewait_noop /w-noop/w
|
ADD ./weavewait_noop /w-noop/w
|
||||||
|
ADD ./weavewait_nomcast /w-nomcast/w
|
||||||
ADD ./docker.tgz /
|
ADD ./docker.tgz /
|
||||||
@@ -40,6 +40,7 @@ func main() {
|
|||||||
mflag.BoolVar(&c.TLSConfig.Verify, []string{"#tlsverify", "-tlsverify"}, false, "Use TLS and verify the remote")
|
mflag.BoolVar(&c.TLSConfig.Verify, []string{"#tlsverify", "-tlsverify"}, false, "Use TLS and verify the remote")
|
||||||
mflag.BoolVar(&c.WithDNS, []string{"-with-dns", "w"}, false, "instruct created containers to always use weaveDNS as their nameserver")
|
mflag.BoolVar(&c.WithDNS, []string{"-with-dns", "w"}, false, "instruct created containers to always use weaveDNS as their nameserver")
|
||||||
mflag.BoolVar(&c.WithoutDNS, []string{"-without-dns"}, false, "instruct created containers to never use weaveDNS as their nameserver")
|
mflag.BoolVar(&c.WithoutDNS, []string{"-without-dns"}, false, "instruct created containers to never use weaveDNS as their nameserver")
|
||||||
|
mflag.BoolVar(&c.NoMulticastRoute, []string{"-no-multicast-route"}, false, "do not add a multicast route via the weave interface when attaching containers")
|
||||||
mflag.Parse()
|
mflag.Parse()
|
||||||
|
|
||||||
if justVersion {
|
if justVersion {
|
||||||
|
|||||||
@@ -1,12 +1,7 @@
|
|||||||
// +build !noop
|
// +build !iface,!mcast
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
|
||||||
weavenet "github.com/weaveworks/weave/net"
|
|
||||||
)
|
|
||||||
|
|
||||||
func checkNetwork() error {
|
func checkNetwork() error {
|
||||||
_, err := weavenet.EnsureInterfaceAndMcastRoute("ethwe")
|
return nil
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
// +build iface,!mcast
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
weavenet "github.com/weaveworks/weave/net"
|
||||||
|
)
|
||||||
|
|
||||||
|
func checkNetwork() error {
|
||||||
|
_, err := weavenet.EnsureInterface("ethwe")
|
||||||
|
return err
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
// +build iface,mcast
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
weavenet "github.com/weaveworks/weave/net"
|
||||||
|
)
|
||||||
|
|
||||||
|
func checkNetwork() error {
|
||||||
|
_, err := weavenet.EnsureInterfaceAndMcastRoute("ethwe")
|
||||||
|
return err
|
||||||
|
}
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
// +build noop
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
func checkNetwork() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
@@ -53,8 +53,14 @@ func (i *createContainerInterceptor) InterceptRequest(r *http.Request) error {
|
|||||||
Log.Infof("Leaving container alone because %s", err)
|
Log.Infof("Leaving container alone because %s", err)
|
||||||
} else {
|
} else {
|
||||||
Log.Infof("Creating container with WEAVE_CIDR \"%s\"", strings.Join(cidrs, " "))
|
Log.Infof("Creating container with WEAVE_CIDR \"%s\"", strings.Join(cidrs, " "))
|
||||||
if err := addVolume(hostConfig, i.proxy.weaveWaitVolume, "/w", "ro"); err != nil {
|
if i.proxy.NoMulticastRoute {
|
||||||
return err
|
if err := addVolume(hostConfig, i.proxy.weaveWaitNomcastVolume, "/w", "ro"); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if err := addVolume(hostConfig, i.proxy.weaveWaitVolume, "/w", "ro"); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if err := i.setWeaveWaitEntrypoint(container); err != nil {
|
if err := i.setWeaveWaitEntrypoint(container); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
+16
-8
@@ -60,6 +60,7 @@ type Config struct {
|
|||||||
Version string
|
Version string
|
||||||
WithDNS bool
|
WithDNS bool
|
||||||
WithoutDNS bool
|
WithoutDNS bool
|
||||||
|
NoMulticastRoute bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type wait struct {
|
type wait struct {
|
||||||
@@ -71,13 +72,14 @@ type wait struct {
|
|||||||
type Proxy struct {
|
type Proxy struct {
|
||||||
sync.Mutex
|
sync.Mutex
|
||||||
Config
|
Config
|
||||||
client *docker.Client
|
client *docker.Client
|
||||||
dockerBridgeIP string
|
dockerBridgeIP string
|
||||||
hostnameMatchRegexp *regexp.Regexp
|
hostnameMatchRegexp *regexp.Regexp
|
||||||
weaveWaitVolume string
|
weaveWaitVolume string
|
||||||
weaveWaitNoopVolume string
|
weaveWaitNoopVolume string
|
||||||
normalisedAddrs []string
|
weaveWaitNomcastVolume string
|
||||||
waiters map[*http.Request]*wait
|
normalisedAddrs []string
|
||||||
|
waiters map[*http.Request]*wait
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewProxy(c Config) (*Proxy, error) {
|
func NewProxy(c Config) (*Proxy, error) {
|
||||||
@@ -146,7 +148,10 @@ func (proxy *Proxy) findWeaveWaitVolumes() error {
|
|||||||
if proxy.weaveWaitVolume, err = proxy.findVolume("/w"); err != nil {
|
if proxy.weaveWaitVolume, err = proxy.findVolume("/w"); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
proxy.weaveWaitNoopVolume, err = proxy.findVolume("/w-noop")
|
if proxy.weaveWaitNoopVolume, err = proxy.findVolume("/w-noop"); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
proxy.weaveWaitNomcastVolume, err = proxy.findVolume("/w-nomcast")
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -430,6 +435,9 @@ func (proxy *Proxy) attach(container *docker.Container, orDie bool) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if proxy.NoMulticastRoute {
|
||||||
|
args = append(args, "--no-multicast-route")
|
||||||
|
}
|
||||||
if orDie {
|
if orDie {
|
||||||
args = append(args, "--or-die")
|
args = append(args, "--or-die")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,8 +41,14 @@ func (i *startContainerInterceptor) InterceptRequest(r *http.Request) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if err := addVolume(hostConfig, i.proxy.weaveWaitVolume, "/w", "ro"); err != nil {
|
if i.proxy.NoMulticastRoute {
|
||||||
return err
|
if err := addVolume(hostConfig, i.proxy.weaveWaitNomcastVolume, "/w", "ro"); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if err := addVolume(hostConfig, i.proxy.weaveWaitVolume, "/w", "ro"); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if dnsDomain := i.proxy.getDNSDomain(); dnsDomain != "" {
|
if dnsDomain := i.proxy.getDNSDomain(); dnsDomain != "" {
|
||||||
if err := i.proxy.setWeaveDNS(hostConfig, container.Config.Hostname, dnsDomain); err != nil {
|
if err := i.proxy.setWeaveDNS(hostConfig, container.Config.Hostname, dnsDomain); err != nil {
|
||||||
|
|||||||
Executable
+30
@@ -0,0 +1,30 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
. ./config.sh
|
||||||
|
|
||||||
|
show_multicast_route_on() {
|
||||||
|
exec_on $1 $2 ip route show 224.0.0.0/4
|
||||||
|
}
|
||||||
|
|
||||||
|
start_suite "--no-multicast-route operation"
|
||||||
|
|
||||||
|
# Ensure containers run either way have no multicast route
|
||||||
|
weave_on $HOST1 launch-router
|
||||||
|
weave_on $HOST1 launch-proxy --no-multicast-route
|
||||||
|
|
||||||
|
start_container $HOST1 --no-multicast-route --name c1
|
||||||
|
proxy_start_container $HOST1 --name c2
|
||||||
|
|
||||||
|
assert "show_multicast_route_on $HOST1 c1"
|
||||||
|
assert "show_multicast_route_on $HOST1 c2"
|
||||||
|
|
||||||
|
# Ensure current proxy options are obeyed on container start
|
||||||
|
docker_on $HOST1 stop c2
|
||||||
|
weave_on $HOST1 stop-proxy
|
||||||
|
weave_on $HOST1 launch-proxy
|
||||||
|
|
||||||
|
proxy docker_on $HOST1 start c2
|
||||||
|
|
||||||
|
assert "show_multicast_route_on $HOST1 c2" "224.0.0.0/4 dev ethwe "
|
||||||
|
|
||||||
|
end_suite
|
||||||
@@ -48,6 +48,7 @@ weave launch-router [--password <password>] [--nickname <nickname>]
|
|||||||
[--no-discovery] [--init-peer-count <count>] <peer> ...
|
[--no-discovery] [--init-peer-count <count>] <peer> ...
|
||||||
weave launch-proxy [-H <endpoint>] [--with-dns | --without-dns]
|
weave launch-proxy [-H <endpoint>] [--with-dns | --without-dns]
|
||||||
[--no-default-ipalloc] [--no-rewrite-hosts]
|
[--no-default-ipalloc] [--no-rewrite-hosts]
|
||||||
|
[--no-multicast-route]
|
||||||
[--hostname-from-label <labelkey>]
|
[--hostname-from-label <labelkey>]
|
||||||
[--hostname-match <regexp>]
|
[--hostname-match <regexp>]
|
||||||
[--hostname-replacement <replacement>]
|
[--hostname-replacement <replacement>]
|
||||||
@@ -59,7 +60,8 @@ weave connect [--replace] [<peer> ...]
|
|||||||
weave forget <peer> ...
|
weave forget <peer> ...
|
||||||
weave status [targets | connections | peers | dns]
|
weave status [targets | connections | peers | dns]
|
||||||
weave report [-f <format>]
|
weave report [-f <format>]
|
||||||
weave run [--with-dns | --without-dns] [--no-rewrite-hosts]
|
weave run [--with-dns | --without-dns]
|
||||||
|
[--no-rewrite-hosts] [--no-multicast-route]
|
||||||
[<addr> ...] <docker run args> ...
|
[<addr> ...] <docker run args> ...
|
||||||
weave start [<addr> ...] <container_id>
|
weave start [<addr> ...] <container_id>
|
||||||
weave attach [<addr> ...] <container_id>
|
weave attach [<addr> ...] <container_id>
|
||||||
@@ -258,20 +260,42 @@ elif [ "$1" = "run" -a -z "$IS_LOCAL" ] ; then
|
|||||||
# because we are passing arbitrary arguments on to docker run, and
|
# because we are passing arbitrary arguments on to docker run, and
|
||||||
# we can't rely on our baked-in docker to support those arguments.
|
# we can't rely on our baked-in docker to support those arguments.
|
||||||
shift 1
|
shift 1
|
||||||
|
|
||||||
if [ "$1" != "--without-dns" ] ; then
|
if [ "$1" != "--without-dns" ] ; then
|
||||||
DNS_ARGS=$(exec_remote dns-args "$@" || true)
|
DNS_ARGS=$(exec_remote dns-args "$@" || true)
|
||||||
fi
|
fi
|
||||||
shift $(dns_arg_count "$@")
|
shift $(dns_arg_count "$@")
|
||||||
if [ "$1" = "--no-rewrite-hosts" ] ; then
|
|
||||||
|
REWRITE_HOSTS=1
|
||||||
|
NO_MULTICAST_ROUTE=
|
||||||
|
while [ $# -gt 0 ]; do
|
||||||
|
case "$1" in
|
||||||
|
--no-rewrite-hosts)
|
||||||
|
REWRITE_HOSTS=
|
||||||
|
;;
|
||||||
|
--no-multicast-route)
|
||||||
|
NO_MULTICAST_ROUTE=1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
shift
|
shift
|
||||||
else
|
done
|
||||||
|
|
||||||
|
if [ -n "$REWRITE_HOSTS" ] ; then
|
||||||
extra_hosts_args "$@"
|
extra_hosts_args "$@"
|
||||||
DNS_EXTRA_HOSTS_ARGS="--rewrite-hosts $DNS_EXTRA_HOSTS_ARGS"
|
DNS_EXTRA_HOSTS_ARGS="--rewrite-hosts $DNS_EXTRA_HOSTS_ARGS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -n "$NO_MULTICAST_ROUTE" ] ; then
|
||||||
|
ATTACH_ARGS="--no-multicast-route"
|
||||||
|
fi
|
||||||
|
|
||||||
collect_cidr_args "$@"
|
collect_cidr_args "$@"
|
||||||
shift $CIDR_ARG_COUNT
|
shift $CIDR_ARG_COUNT
|
||||||
CONTAINER=$(docker $DOCKER_CLIENT_ARGS run -e WEAVE_CIDR=none $DNS_ARGS -d "$@")
|
CONTAINER=$(docker $DOCKER_CLIENT_ARGS run -e WEAVE_CIDR=none $DNS_ARGS -d "$@")
|
||||||
exec_remote attach $CIDR_ARGS --or-die $DNS_EXTRA_HOSTS_ARGS $CONTAINER >/dev/null
|
exec_remote attach $CIDR_ARGS --or-die $DNS_EXTRA_HOSTS_ARGS $ATTACH_ARGS $CONTAINER >/dev/null
|
||||||
echo $CONTAINER
|
echo $CONTAINER
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
@@ -841,8 +865,10 @@ attach() {
|
|||||||
# multicast packets. Since RFC1122 prohibits sending of ICMP
|
# multicast packets. Since RFC1122 prohibits sending of ICMP
|
||||||
# errors for packets with multicast destinations, that causes
|
# errors for packets with multicast destinations, that causes
|
||||||
# packets larger than the PMTU to be dropped silently.
|
# packets larger than the PMTU to be dropped silently.
|
||||||
if ! netnsenter ip route show | grep '^224\.0\.0\.0/4' >/dev/null ; then
|
if [ -z "$NO_MULTICAST_ROUTE" ] ; then
|
||||||
netnsenter ip route add 224.0.0.0/4 dev $CONTAINER_IFNAME mtu lock $MTU
|
if ! netnsenter ip route show | grep '^224\.0\.0\.0/4' >/dev/null ; then
|
||||||
|
netnsenter ip route add 224.0.0.0/4 dev $CONTAINER_IFNAME mtu lock $MTU
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1914,10 +1940,21 @@ EOF
|
|||||||
dns_args "$@"
|
dns_args "$@"
|
||||||
shift $(dns_arg_count "$@")
|
shift $(dns_arg_count "$@")
|
||||||
REWRITE_HOSTS=1
|
REWRITE_HOSTS=1
|
||||||
if [ "$1" = "--no-rewrite-hosts" ] ; then
|
NO_MULTICAST_ROUTE=
|
||||||
REWRITE_HOSTS=
|
while [ $# -gt 0 ]; do
|
||||||
|
case "$1" in
|
||||||
|
--no-rewrite-hosts)
|
||||||
|
REWRITE_HOSTS=
|
||||||
|
;;
|
||||||
|
--no-multicast-route)
|
||||||
|
NO_MULTICAST_ROUTE=1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
shift
|
shift
|
||||||
fi
|
done
|
||||||
collect_cidr_args "$@"
|
collect_cidr_args "$@"
|
||||||
shift $CIDR_ARG_COUNT
|
shift $CIDR_ARG_COUNT
|
||||||
CONTAINER=$(docker run -e WEAVE_CIDR=none $DNS_ARGS -d "$@")
|
CONTAINER=$(docker run -e WEAVE_CIDR=none $DNS_ARGS -d "$@")
|
||||||
@@ -1954,6 +1991,7 @@ EOF
|
|||||||
attach)
|
attach)
|
||||||
DNS_EXTRA_HOSTS=
|
DNS_EXTRA_HOSTS=
|
||||||
REWRITE_HOSTS=
|
REWRITE_HOSTS=
|
||||||
|
NO_MULTICAST_ROUTE=
|
||||||
collect_cidr_args "$@"
|
collect_cidr_args "$@"
|
||||||
shift $CIDR_ARG_COUNT
|
shift $CIDR_ARG_COUNT
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
@@ -1971,6 +2009,9 @@ EOF
|
|||||||
--add-host=*)
|
--add-host=*)
|
||||||
DNS_EXTRA_HOSTS="${1#*=} $DNS_EXTRA_HOSTS"
|
DNS_EXTRA_HOSTS="${1#*=} $DNS_EXTRA_HOSTS"
|
||||||
;;
|
;;
|
||||||
|
--no-multicast-route)
|
||||||
|
NO_MULTICAST_ROUTE=1
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
|
|||||||
Reference in new issue
Block a user