weave run and weave attach accept --no-multicast-route
This commit is contained in:
1 parent
c3e1f5a6c6
commit
98a7d3fc99
1 file changed
+49
-9
@@ -59,7 +59,8 @@ weave connect [--replace] [<peer> ...]
|
||||
weave forget <peer> ...
|
||||
weave status [targets | connections | peers | dns]
|
||||
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> ...
|
||||
weave start [<addr> ...] <container_id>
|
||||
weave attach [<addr> ...] <container_id>
|
||||
@@ -258,20 +259,42 @@ elif [ "$1" = "run" -a -z "$IS_LOCAL" ] ; then
|
||||
# because we are passing arbitrary arguments on to docker run, and
|
||||
# we can't rely on our baked-in docker to support those arguments.
|
||||
shift 1
|
||||
|
||||
if [ "$1" != "--without-dns" ] ; then
|
||||
DNS_ARGS=$(exec_remote dns-args "$@" || true)
|
||||
fi
|
||||
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
|
||||
else
|
||||
done
|
||||
|
||||
if [ -n "$REWRITE_HOSTS" ] ; then
|
||||
extra_hosts_args "$@"
|
||||
DNS_EXTRA_HOSTS_ARGS="--rewrite-hosts $DNS_EXTRA_HOSTS_ARGS"
|
||||
fi
|
||||
|
||||
if [ -n "$NO_MULTICAST_ROUTE" ] ; then
|
||||
ATTACH_ARGS="--no-multicast-route"
|
||||
fi
|
||||
|
||||
collect_cidr_args "$@"
|
||||
shift $CIDR_ARG_COUNT
|
||||
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
|
||||
exit 0
|
||||
fi
|
||||
@@ -841,8 +864,10 @@ attach() {
|
||||
# multicast packets. Since RFC1122 prohibits sending of ICMP
|
||||
# errors for packets with multicast destinations, that causes
|
||||
# packets larger than the PMTU to be dropped silently.
|
||||
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
|
||||
if [ -z "$NO_MULTICAST_ROUTE" ] ; then
|
||||
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
|
||||
}
|
||||
|
||||
@@ -1914,10 +1939,21 @@ EOF
|
||||
dns_args "$@"
|
||||
shift $(dns_arg_count "$@")
|
||||
REWRITE_HOSTS=1
|
||||
if [ "$1" = "--no-rewrite-hosts" ] ; then
|
||||
REWRITE_HOSTS=
|
||||
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
|
||||
fi
|
||||
done
|
||||
collect_cidr_args "$@"
|
||||
shift $CIDR_ARG_COUNT
|
||||
CONTAINER=$(docker run -e WEAVE_CIDR=none $DNS_ARGS -d "$@")
|
||||
@@ -1954,6 +1990,7 @@ EOF
|
||||
attach)
|
||||
DNS_EXTRA_HOSTS=
|
||||
REWRITE_HOSTS=
|
||||
NO_MULTICAST_ROUTE=
|
||||
collect_cidr_args "$@"
|
||||
shift $CIDR_ARG_COUNT
|
||||
while [ $# -gt 0 ]; do
|
||||
@@ -1971,6 +2008,9 @@ EOF
|
||||
--add-host=*)
|
||||
DNS_EXTRA_HOSTS="${1#*=} $DNS_EXTRA_HOSTS"
|
||||
;;
|
||||
--no-multicast-route)
|
||||
NO_MULTICAST_ROUTE=1
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
|
||||
Reference in new issue
Block a user