From 856b3e0562dba2042aa1e375de15690197e0a75a Mon Sep 17 00:00:00 2001 From: Darren 'Tadgy' Austin Date: Tue, 17 Nov 2020 21:21:06 +0000 Subject: Update VLAN syntax checking. Add quotes in rc.inet1.conf. --- netconfig | 35 +++++++++++++++++++++++------------ rc.inet1.conf | 6 +++--- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/netconfig b/netconfig index f314c4e..210c8a4 100644 --- a/netconfig +++ b/netconfig @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # A script to do basic network configuration. # Mostly written by Patrick Volkerding . # Modified to use /etc/rc.d/rc.inet1.conf Tue Aug 26 16:51:48 PDT 2003 @@ -229,7 +229,7 @@ GATEWAY6="$GATEWAY6" #MTU[4]="" # The default MTU is 1500, but you might need # 1360 when you use NAT'ed IPSec traffic. #PROMISCUOUS[4]="yes" # Set promiscuous mode on the interface. -#DHCP_TIMEOUT[4]=15 # The default timeout for the DHCP client to +#DHCP_TIMEOUT[4]="15" # The default timeout for the DHCP client to # wait for server resonse is 15 seconds, but # you might want a shorter or longer wait. #DHCP_KEEPRESOLV[4]="yes" # If you don't want /etc/resolv.conf overwritten @@ -248,7 +248,7 @@ GATEWAY6="$GATEWAY6" # Increase the timeout if required. #USE_RA[4]="yes" # Accept router advertisements even when SLAAC # is disabled on the interface. -#WLAN_ESSID[4]=DARKSTAR # An example of how you can override _any_ +#WLAN_ESSID[4]="DARKSTAR" # An example of how you can override _any_ # parameter defined in rc.wireless.conf, by # prepending 'WLAN_' to the parameter's name. # Useful with multiple wireless interfaces. @@ -262,7 +262,7 @@ GATEWAY6="$GATEWAY6" #WLAN_WPADRIVER[4]="ndiswrapper"# Tell wpa_supplicant to specifically use the # ndiswrapper driver (if you leave this empty # the 'wext' driver is used by default) -#WLAN_WPAWAIT[4]=30 # In case it takes long for the WPA association +#WLAN_WPAWAIT[4]="30" # In case it takes long for the WPA association # to finish, you can increase the wait time # (defaults to 10 seconds) @@ -480,21 +480,32 @@ dialog --title "CONNECT VIA VLAN" --defaultno --yesno \ "Some advanced networking set ups require a VLAN ID in order to \ connect to the network. Do you wish to configure a VLAN now? \n\n\ Unless you are sure you require a VLAN, select 'No'." 8 68 -if [ $? = 0 ]; then +ERRNO="$?" +if [ "$ERRNO" = "255" ]; then + exit +elif [ "$ERRNO" = "1" ]; then + true +else while true; do dialog --title "VLAN ID" --cancel-label "Skip" --inputbox \ - "Enter the VLAN ID used on this network." 8 45 2>$TMP/reply - if [ $? = 0 ]; then - if ! (($(cat $TMP/reply))) 2>/dev/null; then + "Enter the VLAN ID used on this network:" 8 45 2>$TMP/reply + ERRNO="$?" + if [ "$ERRNO" = "255" ]; then + exit + elif [ "$ERRNO" = "1" ]; then + break + else + if [[ ! "$(cat $TMP/reply)" =~ ^[0-9]+$ ]]; then dialog --title "VLAN ID" --ok-button "Back" --msgbox \ - "That doesn't appear to be a valid VLAN ID." 5 46 + "That doesn't appear to be a valid VLAN ID." 5 46 + if [ "$?" = "255" ]; then + exit + fi continue else - VLAN=".`cat $TMP/reply`" + VLAN=".$(( 10#$(cat $TMP/reply) ))" break fi - else - break fi done fi diff --git a/rc.inet1.conf b/rc.inet1.conf index 48b94db..5def0a8 100644 --- a/rc.inet1.conf +++ b/rc.inet1.conf @@ -192,7 +192,7 @@ GATEWAY6="" #MTU[4]="" # The default MTU is 1500, but you might need # 1360 when you use NAT'ed IPSec traffic. #PROMISCUOUS[4]="yes" # Set promiscuous mode on the interface. -#DHCP_TIMEOUT[4]=15 # The default timeout for the DHCP client to +#DHCP_TIMEOUT[4]="15" # The default timeout for the DHCP client to # wait for server resonse is 15 seconds, but # you might want a shorter or longer wait. #DHCP_KEEPRESOLV[4]="yes" # If you don't want /etc/resolv.conf overwritten @@ -211,7 +211,7 @@ GATEWAY6="" # Increase the timeout if required. #USE_RA[4]="yes" # Accept router advertisements even when SLAAC # is disabled on the interface. -#WLAN_ESSID[4]=DARKSTAR # An example of how you can override _any_ +#WLAN_ESSID[4]="DARKSTAR" # An example of how you can override _any_ # parameter defined in rc.wireless.conf, by # prepending 'WLAN_' to the parameter's name. # Useful with multiple wireless interfaces. @@ -225,7 +225,7 @@ GATEWAY6="" #WLAN_WPADRIVER[4]="ndiswrapper"# Tell wpa_supplicant to specifically use the # ndiswrapper driver (if you leave this empty # the 'wext' driver is used by default) -#WLAN_WPAWAIT[4]=30 # In case it takes long for the WPA association +#WLAN_WPAWAIT[4]="30" # In case it takes long for the WPA association # to finish, you can increase the wait time # (defaults to 10 seconds) -- cgit v1.2.3