From 6796fa0a7d9bd270946ae0510e9a3747b268989e Mon Sep 17 00:00:00 2001 From: Vlastimil Holer Date: Mon, 13 Sep 2021 14:10:14 +0200 Subject: [PATCH] F OpenNebula/addon-context-linux#86: Update GATEWAY6 to IP6_GATEWAY --- src/etc/one-context.d/loc-10-network.d/functions | 15 +++++---------- src/etc/one-context.d/loc-10-network.d/netcfg-bsd | 6 +++--- .../loc-10-network.d/netcfg-interfaces | 10 +++++----- .../one-context.d/loc-10-network.d/netcfg-netplan | 6 +++--- .../loc-10-network.d/netcfg-networkd | 6 +++--- src/etc/one-context.d/loc-10-network.d/netcfg-nm | 6 +++--- .../one-context.d/loc-10-network.d/netcfg-scripts | 8 ++++---- 7 files changed, 26 insertions(+), 31 deletions(-) diff --git a/src/etc/one-context.d/loc-10-network.d/functions b/src/etc/one-context.d/loc-10-network.d/functions index 2854ccc..cdcdeb1 100644 --- a/src/etc/one-context.d/loc-10-network.d/functions +++ b/src/etc/one-context.d/loc-10-network.d/functions @@ -410,13 +410,6 @@ get_gateway() get_iface_var "$1" "GATEWAY" ) -# Gets the network gateway6 -# arg: -get_gateway6() -( - get_iface_var "$1" "GATEWAY6" -) - # arg: 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' diff --git a/src/etc/one-context.d/loc-10-network.d/netcfg-bsd b/src/etc/one-context.d/loc-10-network.d/netcfg-bsd index 7e50176..01deafb 100644 --- a/src/etc/one-context.d/loc-10-network.d/netcfg-bsd +++ b/src/etc/one-context.d/loc-10-network.d/netcfg-bsd @@ -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 } diff --git a/src/etc/one-context.d/loc-10-network.d/netcfg-interfaces b/src/etc/one-context.d/loc-10-network.d/netcfg-interfaces index 62baea9..fd13bf7 100644 --- a/src/etc/one-context.d/loc-10-network.d/netcfg-interfaces +++ b/src/etc/one-context.d/loc-10-network.d/netcfg-interfaces @@ -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}" diff --git a/src/etc/one-context.d/loc-10-network.d/netcfg-netplan b/src/etc/one-context.d/loc-10-network.d/netcfg-netplan index f5062a1..a2c0e94 100644 --- a/src/etc/one-context.d/loc-10-network.d/netcfg-netplan +++ b/src/etc/one-context.d/loc-10-network.d/netcfg-netplan @@ -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 <> "/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