Skip to content

Commit

Permalink
Merge pull request flannel-io#1546 from zhangzhangzf/flannel-zhangzha…
Browse files Browse the repository at this point in the history
…ngzf

Fixed a route conflict bug.
  • Loading branch information
manuelbuil authored May 4, 2022
2 parents e9d4b91 + 73960a6 commit 74b5e50
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions dist/mk-docker-opts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,16 @@ done
if [ "$combined_opts" = true ]; then
echo "${combined_opts_key}=\"${docker_opts}\"" >>$docker_env
fi

if [ -n "${FLANNEL_SUBNET}" ];then
dot_four=`echo ${FLANNEL_SUBNET}|cut -d. -f4|cut -d/ -f1`
dot_four=$((${dot_four}-1))
subnets_pre=`echo ${FLANNEL_SUBNET}|cut -d. -f 1,2,3`
subnets_lat=`echo ${FLANNEL_SUBNET}|cut -d/ -f2`
subnets=${subnets_pre}.${dot_four}/${subnets_lat}
route_invalid=`ip route show|grep ${subnets}|grep via`
if [ -n "${route_invalid}" ];then
echo "Your routing table already contains the subnet: ${route_invalid}" >&2
exit 1
fi
fi

0 comments on commit 74b5e50

Please sign in to comment.