From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Tremer To: development@lists.ipfire.org Subject: Re: [PATCH] zoneconf.cgi: Fix VLAN tag range check Date: Mon, 22 Mar 2021 11:26:17 +0000 Message-ID: <9DBEEB59-6590-40A0-9971-376EB35E9D77@ipfire.org> In-Reply-To: <20210321212303.1718-1-hofmann@leo-andres.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5809912501799681612==" List-Id: --===============5809912501799681612== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Thank you :) > On 21 Mar 2021, at 21:23, Leo-Andres Hofmann wrot= e: >=20 > Use the correct VLAN tag range 1-4094 and add an error message > to the range check. > The missing error message was discovered by Jonatan. >=20 > Signed-off-by: Leo-Andres Hofmann > --- > doc/language_missings | 7 +++++++ > html/cgi-bin/zoneconf.cgi | 11 +++++------ > langs/de/cgi-bin/de.pl | 1 + > langs/en/cgi-bin/en.pl | 1 + > 4 files changed, 14 insertions(+), 6 deletions(-) >=20 > diff --git a/doc/language_missings b/doc/language_missings > index 3cd277726..4b5a90c67 100644 > --- a/doc/language_missings > +++ b/doc/language_missings > @@ -912,6 +912,7 @@ > < zoneconf val stp zone mode error > < zoneconf val vlan amount assignment error > < zoneconf val vlan tag assignment error > +< zoneconf val vlan tag range error > < zoneconf val zoneslave amount error > ############################################################################ > # Checking cgi-bin translations for language: fr # > @@ -933,6 +934,7 @@ > < zoneconf stp priority > < zoneconf val stp priority range error > < zoneconf val stp zone mode error > +< zoneconf val vlan tag range error > ############################################################################ > # Checking cgi-bin translations for language: it # > ############################################################################ > @@ -1322,6 +1324,7 @@ > < zoneconf val stp zone mode error > < zoneconf val vlan amount assignment error > < zoneconf val vlan tag assignment error > +< zoneconf val vlan tag range error > < zoneconf val zoneslave amount error > ############################################################################ > # Checking cgi-bin translations for language: nl # > @@ -1766,6 +1769,7 @@ > < zoneconf val stp zone mode error > < zoneconf val vlan amount assignment error > < zoneconf val vlan tag assignment error > +< zoneconf val vlan tag range error > < zoneconf val zoneslave amount error > ############################################################################ > # Checking cgi-bin translations for language: pl # > @@ -2652,6 +2656,7 @@ > < zoneconf val stp zone mode error > < zoneconf val vlan amount assignment error > < zoneconf val vlan tag assignment error > +< zoneconf val vlan tag range error > < zoneconf val zoneslave amount error > ############################################################################ > # Checking cgi-bin translations for language: ru # > @@ -3545,6 +3550,7 @@ > < zoneconf val stp zone mode error > < zoneconf val vlan amount assignment error > < zoneconf val vlan tag assignment error > +< zoneconf val vlan tag range error > < zoneconf val zoneslave amount error > ############################################################################ > # Checking cgi-bin translations for language: tr # > @@ -3741,4 +3747,5 @@ > < zoneconf val stp zone mode error > < zoneconf val vlan amount assignment error > < zoneconf val vlan tag assignment error > +< zoneconf val vlan tag range error > < zoneconf val zoneslave amount error > diff --git a/html/cgi-bin/zoneconf.cgi b/html/cgi-bin/zoneconf.cgi > index b90ea8a41..c0d44764f 100644 > --- a/html/cgi-bin/zoneconf.cgi > +++ b/html/cgi-bin/zoneconf.cgi > @@ -279,11 +279,10 @@ if ($cgiparams{"ACTION"} eq $Lang::tr{"save"}) { > } >=20 > $VALIDATE_nic_check{"VLAN $mac $vlan_tag"} =3D 1; > - > - if (! looks_like_number($vlan_tag)) { > - last; > - } > - if ($vlan_tag < 1 || $vlan_tag > 4095) { > + =09 > + # check VLAN tag range: 1..4094 (0, 4095 are reserved) > + unless (looks_like_number($vlan_tag) && ($vlan_tag >=3D 1) && ($vlan_t= ag <=3D 4094)) { > + $VALIDATE_error =3D $Lang::tr{"zoneconf val vlan tag range error"}; > last; > } >=20 > @@ -486,7 +485,7 @@ END > > > > - > + > > END > ; > diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl > index 6a8133807..191c778d2 100644 > --- a/langs/de/cgi-bin/de.pl > +++ b/langs/de/cgi-bin/de.pl > @@ -2988,6 +2988,7 @@ > 'zoneconf val stp zone mode error' =3D> 'STP kann nur aktiviert werden, wen= n sich die Zone im Br=C3=BCckenmodus befindet', > 'zoneconf val vlan amount assignment error' =3D> 'Pro Zone kann nur ein VLA= N verwendet werden.', > 'zoneconf val vlan tag assignment error' =3D> 'Pro Netzwerkkarte kann derse= lbe VLAN-Tag nur einmal verwendet werden.', > +'zoneconf val vlan tag range error' =3D> 'VLAN-Tag muss im Bereich 1-4094 = liegen.', > 'zoneconf val zoneslave amount error' =3D> 'Wenn eine Zone nicht im Br=C3= =BCckenmodus ist, kann ihr nur eine Netzwerkkarte zugewiesen werden.', > ); >=20 > diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl > index 8f7e0c2cf..1d059aac8 100644 > --- a/langs/en/cgi-bin/en.pl > +++ b/langs/en/cgi-bin/en.pl > @@ -3037,6 +3037,7 @@ > 'zoneconf val stp zone mode error' =3D> 'STP can only be enabled if the zon= e is in bridge mode', > 'zoneconf val vlan amount assignment error' =3D> 'A zone cannot have more t= han one VLAN assigned.', > 'zoneconf val vlan tag assignment error' =3D> 'You cannot use the same VLAN= tag more than once per NIC.', > +'zoneconf val vlan tag range error' =3D> 'VLAN tag must be in the range of= 1-4094.', > 'zoneconf val zoneslave amount error' =3D> 'A zone that is not in bridge mo= de can\'t have more than one NIC assigned', > ); >=20 > --=20 > 2.27.0.windows.1 >=20 --===============5809912501799681612==--