diff options
author | Darren 'Tadgy' Austin <darren@afterdark.org.uk> | 2020-11-18 19:30:51 +0000 |
---|---|---|
committer | Robby Workman <rworkman@slackware.com> | 2021-02-27 23:47:58 -0600 |
commit | 1d329f44550d805b4185e5ab1e7cc94ba19d93f2 (patch) | |
tree | 412f8b4f1b8b576bbd2d2c18d088805175bd1c3a /netconfig | |
parent | ad904fdd379ee2fd3861ec2f130bf92917100584 (diff) | |
download | slacknetsetup-1d329f44550d805b4185e5ab1e7cc94ba19d93f2.tar.xz |
Begin implementing multiple IPv6 addresses handling.
Diffstat (limited to 'netconfig')
-rw-r--r-- | netconfig | 109 |
1 files changed, 76 insertions, 33 deletions
@@ -711,46 +711,89 @@ Enter IPv4 gateway address:" 14 68 "$GATEWAY" 2> $TMP/SeTgateway4 rm -f $TMP/SeTgateway4 fi + + + + + + + + + + while [ 0 ]; do - if [ -r $TMP/SeTIP6 ]; then - IPADDR6="`cat $TMP/SeTIP6`" + if [ -r $TMP/SeTIPSv6 ]; then + IP6ADDRS=($(cat $TMP/SeTIPSv6)) fi - dialog --title "ENTER IPv6 ADDRESS FOR '$HOSTNM.$DOMAIN'" --inputbox \ -"Enter the IPv6 address for the local machine. -Example: fe80:426c:ffff::365a -If you do not want to configure a static IPv6 address, just hit ENTER." \ - 10 74 $IPADDR6 2> $TMP/SeTlip6 - if [ $? = 1 -o $? = 255 ]; then - rm -f $TMP/SeTlip6 + dialog --title "ENTER IPv6 ADDRESSES" --cancel-label "Skip" --inputbox \ +"Enter the IPv6 addresses for this host. You may list one or more, +space delimited, IPv6 addresses with their prefixes in the format: + <IP address>/<prefix> +For example: + 11a:11b:11c:11d::abc/64 +If a prefix is not specified a default of 64 will be used. + +If you do not want to configure a static IPv6 address or don't +know what to put, just leave it blank or select 'Skip'." \ + 17 69 "${IP6ADDRS[*]}" 2> $TMP/SeTIPSv6 + ERRNO="$?" + if [ "$ERRNO" = "1" ]; then + IPA6DDRS=() + rm -f $TMP/SeTIPSv6 + break + elif [ "$ERRNO" = "255" ]; then + rm -f $TMP/SeTIPSv6 exit fi - IPADDR6="`cat $TMP/SeTlip6`" - rm -f $TMP/SeTlip6 - if [ "$IPADDR6" = "" ]; then - if [ "$IPADDR" = "" ]; then - dialog --title "NO IP ADDRESSES" --yesno \ -"You have not configured any IP addresses for your system. -Are you sure you want to proceed with no IPs?" 6 61 - if [ $? = 0 ]; then - break 2 - else - continue 2 + IP6ADDRS=($(cat $TMP/SeTIPSv6)) + rm -f $TMP/SeTIPSv6 + if [ "${IP6ADDRS[*]}" = "" ]; then + rm -f $TMP/SeTIPSv6 + break + fi + for ((I=0; I < ${#IPADDRS[@]}; I++)); do + IP="${IP6ADDRS[$I]%%/*}" + PREFIX="${IP6ADDRS[$I]#*/}" + if [ "$IP" = "" ]; then + dialog --title "NO IPv6 ADDRESSES" --ok-button "Back" --msgbox \ + "No IP specified in entry: ${IP6ADDRS[$I]}." 5 60 + if [ "$?" = "255" ]; then + rm -f $TMP/SeTIPSv6 + exit fi - fi - else - # We can only do a basic validation of the entered address - # as regexes for IPv6 addresses are very complex. - if echo "$IPADDR6" | grep -E "^[0-9a-fA-F:]+$" >/dev/null; then - echo $IPADDR6 > $TMP/SeTIP6 - break - else - dialog --title "INVALID IP ADDRESS" --msgbox \ -"The IP address you entered is not valid. -Please enter a valid IPv6 address." 6 44 continue fi - fi - done + # syntax_check_v6 "$IP" || continue 2 + if [ "$PREFIX" = "" ]; then + IP6ADDRS[$I]="$IP/64" + PREFIX="64" + fi + +# if [ "$IPADDR6" = "" ]; then +# if [ "$IPADDR" = "" ]; then +# dialog --title "NO IP ADDRESSES" --yesno \ +#"You have not configured any IP addresses for your system. +#Are you sure you want to proceed with no IPs?" 6 61 +# if [ $? = 0 ]; then +# break 2 +# else +# continue 2 +# fi +# fi +# else +# # We can only do a basic validation of the entered address +# # as regexes for IPv6 addresses are very complex. +# if echo "$IPADDR6" | grep -E "^[0-9a-fA-F:]+$" >/dev/null; then +# echo $IPADDR6 > $TMP/SeTIP6 +# break +# else +# dialog --title "INVALID IP ADDRESS" --msgbox \ +#"The IP address you entered is not valid. +#Please enter a valid IPv6 address." 6 44 +# continue +# fi +# fi +# done if [ ! "$IPADDR6" = "" ]; then while [ 0 ]; do |