[Ovirt-devel] [PATCH node] validify ipv4/ipv6 static/dhcp choice else loop
Darryl L. Pierce
dpierce at redhat.com
Mon Nov 9 16:41:03 UTC 2009
On Fri, Oct 09, 2009 at 01:51:20PM -0400, Joey Boggs wrote:
> If you select an option that's not listed during ipv4/ipv6 setup it will accept it without verification. This corrects that behavior and forces a valid option to be picked.
> ---
> scripts/ovirt-config-networking | 106 +++++++++++++++++++++------------------
> 1 files changed, 58 insertions(+), 48 deletions(-)
>
> diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking
> index 7d4e363..45f7129 100755
> --- a/scripts/ovirt-config-networking
> +++ b/scripts/ovirt-config-networking
> @@ -160,56 +160,66 @@ function configure_interface
> return;;
> esac
>
> - read -ep "Enable IPv4 support ([S]tatic IP, [D]HCP, [N]o or [A]bort)? "
> - case $REPLY in
> - D|d)
> - BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/BOOTPROTO dhcp"
> - ;;
> - S|s)
> - printf "\n"
> - read -ep "IP Address: "; IPADDR=$REPLY
> - read -ep " Netmask: "; NETMASK=$REPLY
> - read -ep " Gateway: "; GATEWAY=$REPLY
> -
> - BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/BOOTPROTO none"
> - BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPADDR $IPADDR"
> - BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/NETMASK $NETMASK"
> - if [ -n "${GATEWAY}" ]; then
> - BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/GATEWAY $GATEWAY"
> - fi
> - ;;
> - A|a)
> - CONFIGURED_NIC=""
> - VLAN_ID=""
> - return
> - ;;
> - esac
> + while true; do
> + read -ep "Enable IPv4 support ([S]tatic IP, [D]HCP, [N]o or [A]bort)? "
> + case $REPLY in
> + D|d)
> + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/BOOTPROTO dhcp"
> + break
> + ;;
> + S|s)
> + printf "\n"
> + read -ep "IP Address: "; IPADDR=$REPLY
> + read -ep " Netmask: "; NETMASK=$REPLY
> + read -ep " Gateway: "; GATEWAY=$REPLY
> +
> + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/BOOTPROTO none"
> + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPADDR $IPADDR"
> + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/NETMASK $NETMASK"
> + if [ -n "${GATEWAY}" ]; then
> + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/GATEWAY $GATEWAY"
> + fi
> + break
> + ;;
> + A|a)
> + CONFIGURED_NIC=""
> + VLAN_ID=""
> + return
> + ;;
> + esac
> + done
>
> printf "\n"
> - read -ep "Enable IPv6 support ([S]tatic, [D]HCPv6, A[u]to, [N]o or [A]bort)? "
> - case $REPLY in
> - S|s)
> - read -ep "IPv6 Address: "; IPADDR=$REPLY
> - BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPV6INIT yes"
> - BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IP6ADDR $IPADDR"
> - ;;
> - D|d)
> - BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPV6INIT yes"
> - BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPV6AUTCONF no"
> - BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPV6FORWARDING no"
> - BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/DHCPV6C yes"
> - ;;
> - U|u)
> - BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPV6INIT yes"
> - BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPV6FORWARDING no"
> - BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPV6AUTOCONF yes"
> - ;;
> - A|a)
> - CONFIGURED_NIC=""
> - VLAN_ID=""
> - return
> - ;;
> - esac
> +
> + while true; do
> + read -ep "Enable IPv6 support ([S]tatic, [D]HCPv6, A[u]to, [N]o or [A]bort)? "
> + case $REPLY in
> + S|s)
> + read -ep "IPv6 Address: "; IPADDR=$REPLY
> + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPV6INIT yes"
> + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IP6ADDR $IPADDR"
> + break
> + ;;
> + D|d)
> + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPV6INIT yes"
> + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPV6AUTCONF no"
> + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPV6FORWARDING no"
> + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/DHCPV6C yes"
> + break
> + ;;
> + U|u)
> + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPV6INIT yes"
> + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPV6FORWARDING no"
> + BR_CONFIG="$BR_CONFIG\nset $BR_ROOT/IPV6AUTOCONF yes"
> + break
> + ;;
> + A|a)
> + CONFIGURED_NIC=""
> + VLAN_ID=""
> + return
> + ;;
> + esac
> + done
NAK.
This portion is missing support for [N]o on IPv6 support.
--
Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc.
Delivering value year after year.
Red Hat ranks #1 in value among software vendors.
http://www.redhat.com/promo/vendor/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/ovirt-devel/attachments/20091109/8e12a39b/attachment.sig>
More information about the ovirt-devel
mailing list