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

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

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

@ -85,7 +85,7 @@ export mac
export dev export dev
export mtu export mtu
export gateway export gateway
export gateway6 export ip6_gateway
export method export method
export ip6_method export ip6_method
export metric export metric
@ -145,10 +145,10 @@ EOT
fi fi
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 cat <<EOT
- to: "::/0" - to: "::/0"
via: ${gateway6} via: ${ip6_gateway}
EOT EOT
# Force default Linux IPv6 metric (man 8 route) to override # Force default Linux IPv6 metric (man 8 route) to override

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

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

@ -86,7 +86,7 @@ export mac
export dev export dev
export mtu export mtu
export gateway export gateway
export gateway6 export ip6_gateway
export method export method
export ip6_method export ip6_method
export metric export metric
@ -202,12 +202,12 @@ EOT
fi fi
fi fi
if [ -n "${gateway6}" ]; then if [ -n "${ip6_gateway}" ]; then
if [ "${config_path}" = "/etc/sysconfig/network" ]; 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}" >> "/etc/sysconfig/network/ifroute-${dev}"
else 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}" >> "${config_path}/route6-${dev}"
fi fi
fi fi

Loading…
Cancel
Save