F OpenNebula/addon-context-linux#86: Update GATEWAY6 to IP6_GATEWAY

pull/252/head
Vlastimil Holer 3 years ago
parent df90cb5eb0
commit 6796fa0a7d
No known key found for this signature in database
GPG Key ID: EB549BADEFD07C53

@ -410,13 +410,6 @@ get_gateway()
get_iface_var "$1" "GATEWAY"
)
# Gets the network gateway6
# arg: <iface>
get_gateway6()
(
get_iface_var "$1" "GATEWAY6"
)
# arg: <iface>
get_ip()
(
@ -494,17 +487,19 @@ setup_iface_vars()
export mac=$(get_iface_var "$1" "MAC")
export dev=$(get_dev "$_iface_mac" "$mac")
#export mtu=$(get_mtu "$1")
export mtu=$(get_iface_var "$1" "MTU")
export gateway=$(get_gateway "$1")
export gateway6=$(get_gateway6 "$1")
export metric=$(get_iface_var "$1" "METRIC")
export ip6_metric=$(get_iface_var "$1" "IP6_METRIC")
export dns=$(get_dns "$1")
export search_domains=$(get_search_domain "$1")
export method=$(get_iface_var "$1" "METHOD")
export ip6_gateway=$(get_iface_var "$1" "IP6_GATEWAY")
export ip6_metric=$(get_iface_var "$1" "IP6_METRIC")
export ip6_method=$(get_iface_var "$1" "IP6_METHOD")
# backward compatibility
[ -z "$ip6_gateway" ] && ip6_gateway=$(get_iface_var "$1" "GATEWAY6")
# defaults
[ -z "$ip6_metric" ] && ip6_metric="${metric}"
[ -z "$method" ] && method='static'

@ -77,7 +77,7 @@ export mac
export dev
export mtu
export gateway
export gateway6
export ip6_gateway
export method
export ip6_method
export metric
@ -162,8 +162,8 @@ gen_iface6_conf()
###
if [ -n "${gateway6}" ]; then
echo "ipv6_defaultrouter=\"${gateway6}\"" >> /etc/rc.conf.d/routing
if [ -n "${ip6_gateway}" ]; then
echo "ipv6_defaultrouter=\"${ip6_gateway}\"" >> /etc/rc.conf.d/routing
fi
}

@ -128,7 +128,7 @@ export mac
export dev
export mtu
export gateway
export gateway6
export ip6_gateway
export method
export ip6_method
export metric
@ -222,12 +222,12 @@ EOT
# they override the metric on IPv4 routes. We better configure
# default route via up script.
if [ "${os_id}" = 'alpine' ] && \
[ -n "${gateway6}" ] && [ -n "${ip6_metric}" ];
[ -n "${ip6_gateway}" ] && [ -n "${ip6_metric}" ];
then
echo " up ip -6 route add default via ${gateway6} dev ${dev} metric ${ip6_metric}"
echo " up ip -6 route add default via ${ip6_gateway} dev ${dev} metric ${ip6_metric}"
elif [ -n "${gateway6}" ]; then
echo " gateway ${gateway6}"
elif [ -n "${ip6_gateway}" ]; then
echo " gateway ${ip6_gateway}"
if [ -n "${ip6_metric}" ]; then
echo " metric ${ip6_metric}"

@ -85,7 +85,7 @@ export mac
export dev
export mtu
export gateway
export gateway6
export ip6_gateway
export method
export ip6_method
export metric
@ -145,10 +145,10 @@ EOT
fi
fi
if [ -n "${gateway6}" ] && { [ -z "${ip6_method}" ] || [ "${ip6_method}" = 'static' ]; }; then
if [ -n "${ip6_gateway}" ] && { [ -z "${ip6_method}" ] || [ "${ip6_method}" = 'static' ]; }; then
cat <<EOT
- to: "::/0"
via: ${gateway6}
via: ${ip6_gateway}
EOT
# Force default Linux IPv6 metric (man 8 route) to override

@ -76,7 +76,7 @@ export mac
export dev
export mtu
export gateway
export gateway6
export ip6_gateway
export method
export ip6_method
export metric
@ -210,8 +210,8 @@ EOT
[Route]
EOT
if [ -n "$gateway6" ]; then
echo "Gateway=${gateway6}"
if [ -n "$ip6_gateway" ]; then
echo "Gateway=${ip6_gateway}"
if [ -n "$ip6_metric" ]; then
echo "Metric=${ip6_metric}"

@ -72,7 +72,7 @@ export mac
export dev
export mtu
export gateway
export gateway6
export ip6_gateway
export method
export ip6_method
export metric
@ -159,8 +159,8 @@ gen_iface6_conf()
nmcli con mod "${dev}" +ipv6.addresses "${ip6_ula}/64"
fi
if [ -n "$gateway6" ]; then
nmcli con mod "${dev}" ipv6.gateway "${gateway6}"
if [ -n "$ip6_gateway" ]; then
nmcli con mod "${dev}" ipv6.gateway "${ip6_gateway}"
else
nmcli con mod "${dev}" ipv6.gateway ""
fi

@ -86,7 +86,7 @@ export mac
export dev
export mtu
export gateway
export gateway6
export ip6_gateway
export method
export ip6_method
export metric
@ -202,12 +202,12 @@ EOT
fi
fi
if [ -n "${gateway6}" ]; then
if [ -n "${ip6_gateway}" ]; then
if [ "${config_path}" = "/etc/sysconfig/network" ]; then
echo "default ${gateway6} - ${dev} ${ip6_metric:+metric ${ip6_metric}}" \
echo "default ${ip6_gateway} - ${dev} ${ip6_metric:+metric ${ip6_metric}}" \
>> "/etc/sysconfig/network/ifroute-${dev}"
else
echo "default via ${gateway6} dev ${dev} ${ip6_metric:+metric ${ip6_metric}}" \
echo "default via ${ip6_gateway} dev ${dev} ${ip6_metric:+metric ${ip6_metric}}" \
>> "${config_path}/route6-${dev}"
fi
fi

Loading…
Cancel
Save