From: Michael Tremer Date: Thu, 17 May 2012 19:36:35 +0000 (+0000) Subject: Throw the old GREEN/RED/ORANGE schema over board. X-Git-Tag: 004~84 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7de0637a6eea647621fd47639638dac5a03cacc7;p=network.git Throw the old GREEN/RED/ORANGE schema over board. However, this is not a very good idea at this level anymore. The colours may confuse and the difference between them is not very huge at all. So from now on, there will be lanN and uplN which represent local networks and uplinks respectively. --- diff --git a/functions.constants b/functions.constants index b73b9267..04da262f 100644 --- a/functions.constants +++ b/functions.constants @@ -66,8 +66,11 @@ DISCOVER_OK=0 DISCOVER_ERROR=1 DISCOVER_NOT_SUPPORTED=2 -# The user is able to create zones that begin with these names -VALID_ZONES="green orange red grey" +# The user is able to create zones that begin +# with these names followed by a number. +ZONE_LOCAL="lan" +ZONE_NONLOCAL="upl" +VALID_ZONES="${ZONE_LOCAL} ${ZONE_NONLOCAL}" SYS_CLASS_NET="/sys/class/net" diff --git a/functions.zone b/functions.zone index 79c6e0c0..defed8dd 100644 --- a/functions.zone +++ b/functions.zone @@ -57,15 +57,13 @@ function zone_name_is_valid() { function zone_is_local() { local zone=${1} - ! zone_is_nonlocal ${zone} + [[ "${zone:0:${#ZONE_LOCAL}}" = "${ZONE_LOCAL}" ]] } function zone_is_nonlocal() { local zone=${1} - assert isset zone - - [[ ${zone} =~ ^red[0-9]{1,5} ]] + [[ "${zone:0:${#ZONE_NONLOCAL}}" = "${ZONE_NONLOCAL}" ]] } function zone_get_hook() {