- if ($pppsettings{'TYPE'} =~ /^(modem|serial|isdn)$/ && $pppsettings{'COMPORT'} !~ /^(ttyS0|ttyS1|ttyS2|ttyS3|ttyS4|ttyACM0|ttyACM1|ttyACM2|ttyACM3|isdn1|isdn2)$/) {
- $errormessage = $Lang::tr{'invalid input'};
- goto ERROR; }
- if ($pppsettings{'TYPE'} =~ /^(modem|serial)$/ && $pppsettings{'DTERATE'} !~ /^(9600|19200|38400|57600|115200|230400|460800|921600)$/) {
- $errormessage = $Lang::tr{'invalid input'};
- goto ERROR; }
- if ($pppsettings{'TYPE'} eq 'modem' && $pppsettings{'DIALMODE'} !~ /^(T|P)$/) {
- $errormessage = $Lang::tr{'invalid input'};
- goto ERROR; }
- if ($pppsettings{'AUTH'} !~ /^(pap-or-chap|pap|chap|standard-login-script|demon-login-script|other-login-script)$/) {
- $errormessage = $Lang::tr{'invalid input'};
- goto ERROR;
- }
-
- if ($pppsettings{'PROFILENAME'} eq '') {
- $errormessage = $Lang::tr{'profile name not given'};
- $pppsettings{'PROFILENAME'} = '';
- goto ERROR; }
- if ($pppsettings{'TYPE'} =~ /^(modem|isdn)$/) {
- if ($pppsettings{'TELEPHONE'} eq '') {
- $errormessage = $Lang::tr{'telephone not set'};
- goto ERROR; }
- if (!($pppsettings{'TELEPHONE'} =~ /^[\d\*\#\,]+$/)) {
- $errormessage = $Lang::tr{'bad characters in the telephone number field'};
- goto ERROR; }
- }
- unless (($pppsettings{'PROTOCOL'} eq 'RFC1483' && $pppsettings{'METHOD'} =~ /^(STATIC|DHCP)$/)) {
- if ($pppsettings{'USERNAME'} eq '') {
- $errormessage = $Lang::tr{'username not set'};
- goto ERROR; }
- if ($pppsettings{'PASSWORD'} eq '') {
- $errormessage = $Lang::tr{'password not set'};
- goto ERROR; }
- }
-
- if ($pppsettings{'TIMEOUT'} eq '') {
- $errormessage = $Lang::tr{'idle timeout not set'};
- goto ERROR; }
- if (!($pppsettings{'TIMEOUT'} =~ /^\d+$/)) {
- $errormessage = $Lang::tr{'only digits allowed in the idle timeout'};
- goto ERROR; }
-
- if ($pppsettings{'LOGINSCRIPT'} =~ /[.\/ ]/ ) {
- $errormessage = $Lang::tr{'bad characters in script field'};
- goto ERROR; }
-
- if ($pppsettings{'DNS1'})
- {
- if (!(&General::validip($pppsettings{'DNS1'}))) {
- $errormessage = $Lang::tr{'invalid primary dns'};
- goto ERROR; }
- }
- if ($pppsettings{'DNS2'})
- {
- if (!(&General::validip($pppsettings{'DNS2'}))) {
- $errormessage = $Lang::tr{'invalid secondary dns'};
- goto ERROR; }
- }
-
- if ($pppsettings{'MAXRETRIES'} eq '') {
- $errormessage = $Lang::tr{'max retries not set'};
- goto ERROR; }
- if (!($pppsettings{'MAXRETRIES'} =~ /^\d+$/)) {
- $errormessage = $Lang::tr{'only digits allowed in max retries field'};
- goto ERROR; }
-
- if (!($pppsettings{'HOLDOFF'} =~ /^\d+$/)) {
- $errormessage = $Lang::tr{'only digits allowed in holdoff field'};
- goto ERROR; }
-
- if ($pppsettings{'TYPE'} eq 'pptp') {
- $errormessage = '';
- if ($pppsettings{'METHOD'} eq 'STATIC') {
- if (! &General::validip($pppsettings{'ROUTERIP'})) {
- $errormessage = $Lang::tr{'router ip'}.' '.$Lang::tr{'invalid ip'};
- }
- } else {
- if (($pppsettings{'DHCP_HOSTNAME'} ne '') && (! &General::validfqdn($pppsettings{'DHCP_HOSTNAME'})) ) {
- $errormessage = $errormessage.' '.$Lang::tr{'hostname'}.' '.$Lang::tr{'invalid hostname'};
- }
- }
- if ($errormessage ne '') {goto ERROR; }
- }
- if ($pppsettings{'TYPE'} =~ /^(pppoeatm)$/) {
- if ( ($pppsettings{'VPI'} eq '') || ($pppsettings{'VCI'} eq '') ) {
- $errormessage = $Lang::tr{'invalid vpi vpci'};
- goto ERROR; }
- if ( (!($pppsettings{'VPI'} =~ /^\d+$/)) || (!($pppsettings{'VCI'} =~ /^\d+$/)) ) {
- $errormessage = $Lang::tr{'invalid vpi vpci'};
- goto ERROR; }
- if (($pppsettings{'VPI'} eq '0') && ($pppsettings{'VCI'} eq '0')) {
- $errormessage = $Lang::tr{'invalid vpi vpci'};
- goto ERROR; }
- if ( $pppsettings{'PROTOCOL'} eq '' ) {
- $errormessage = $Lang::tr{'invalid input'};
- goto ERROR; }
- }
-
- if ( ($pppsettings{'PROTOCOL'} eq 'RFC1483') && ($pppsettings{'METHOD'} eq '') && \
- ($pppsettings{'TYPE'} !~ /^(alcatelusb|fritzdsl)$/)) {
- $errormessage = $Lang::tr{'invalid input'};
- goto ERROR; }
-
- if (($pppsettings{'PROTOCOL'} eq 'RFC1483' && $pppsettings{'METHOD'} eq 'DHCP')) {
- if ($pppsettings{'DHCP_HOSTNAME'} ne '') {
- if (! &General::validfqdn($pppsettings{'DHCP_HOSTNAME'})) {
- $errormessage = $errormessage.' '.$Lang::tr{'hostname'}.': '.$Lang::tr{'invalid hostname'}; }
- }
- }
-
- if (($pppsettings{'PROTOCOL'} eq 'RFC1483' && $pppsettings{'METHOD'} eq 'STATIC')) {
- $errormessage = '';
- if (! &General::validip($pppsettings{'IP'})) {
- $errormessage = $Lang::tr{'static ip'}.' '.$Lang::tr{'invalid ip'}; }
- if (! &General::validip($pppsettings{'GATEWAY'})) {
- $errormessage = $errormessage.' '.$Lang::tr{'gateway ip'}.' '.$Lang::tr{'invalid ip'}; }
- if (! &General::validmask($pppsettings{'NETMASK'})) {
- $errormessage = $errormessage.' '.$Lang::tr{'netmask'}.' '.$Lang::tr{'invalid netmask'}; }
- if ($pppsettings{'BROADCAST'} ne '') {
- if (! &General::validip($pppsettings{'BROADCAST'})) {
- $errormessage = $errormessage.' '.$Lang::tr{'broadcast'}.' '.$Lang::tr{'invalid broadcast ip'}; }
- }
- if( $pppsettings{'DNS'} eq 'Automatic') {
- $errormessage = $Lang::tr{'invalid input'}; }
- if ($errormessage ne '') {goto ERROR; }
- }
-
- if( $pppsettings{'PROTOCOL'} eq 'RFC1483' && $pppsettings{'METHOD'} ne 'PPPOE' && \
- $pppsettings{'RECONNECTION'} eq 'dialondemand' ) {
- $errormessage = $Lang::tr{'invalid input'};
- goto ERROR; }
-
- if( $pppsettings{'RECONNECTION'} eq 'dialondemand' && `/bin/cat ${General::swroot}/ddns/config` =~ /,on$/m ) {
- $errormessage = $Lang::tr{'dod not compatible with ddns'};
- goto ERROR; }
-
-# if( $pppsettings{'PROTOCOL'} eq 'RFC1483') {
-# $pppsettings{'ENCAP'} = $pppsettings{'ENCAP_RFC1483'}; }
-# if( $pppsettings{'PROTOCOL'} eq 'RFC2364') {
-# $pppsettings{'ENCAP'} = $pppsettings{'ENCAP_RFC2364'}; }
- delete $pppsettings{'ENCAP_RFC1483'};
- delete $pppsettings{'ENCAP_RFC2364'};
+ if ($pppsettings{'TYPE'} =~ /^(modem|serial|isdn)$/ && $pppsettings{'COMPORT'} !~ /^(ttyS0|ttyS1|ttyS2|ttyS3|ttyS4|ttyACM0|ttyACM1|ttyACM2|ttyACM3|ttyUSB0|ttyUSB1|ttyUSB2|ttyUSB3|rfcomm0|rfcomm1|isdn1|isdn2)$/) {
+ $errormessage = $Lang::tr{'invalid input'};
+ goto ERROR; }
+ if ($pppsettings{'TYPE'} =~ /^(modem|serial)$/ && $pppsettings{'DTERATE'} !~ /^(9600|19200|38400|57600|115200|230400|460800|921600)$/) {
+ $errormessage = $Lang::tr{'invalid input'};
+ goto ERROR; }
+ if ($pppsettings{'TYPE'} eq 'modem' && $pppsettings{'DIALMODE'} !~ /^(T|P)$/) {
+ $errormessage = $Lang::tr{'invalid input'};
+ goto ERROR; }
+ if ($pppsettings{'AUTH'} !~ /^(pap-or-chap|pap|chap|standard-login-script|demon-login-script|other-login-script)$/) {
+ $errormessage = $Lang::tr{'invalid input'};
+ goto ERROR;
+ }
+
+ if ($pppsettings{'PROFILENAME'} eq '') {
+ $errormessage = $Lang::tr{'profile name not given'};
+ $pppsettings{'PROFILENAME'} = '';
+ goto ERROR; }
+ if ($pppsettings{'TYPE'} =~ /^(modem|isdn)$/) {
+ if ($pppsettings{'TELEPHONE'} eq '') {
+ $errormessage = $Lang::tr{'telephone not set'};
+ goto ERROR; }
+ if (!($pppsettings{'TELEPHONE'} =~ /^[\d\*\#\,]+$/)) {
+ $errormessage = $Lang::tr{'bad characters in the telephone number field'};
+ goto ERROR; }
+ }
+ unless (($pppsettings{'PROTOCOL'} eq 'RFC1483' && $pppsettings{'METHOD'} =~ /^(STATIC|DHCP)$/)) {
+ if ($pppsettings{'USERNAME'} eq '') {
+ $errormessage = $Lang::tr{'username not set'};
+ goto ERROR; }
+ if ($pppsettings{'PASSWORD'} eq '') {
+ $errormessage = $Lang::tr{'password not set'};
+ goto ERROR; }
+ }
+
+ if ($pppsettings{'TIMEOUT'} eq '') {
+ $errormessage = $Lang::tr{'idle timeout not set'};
+ goto ERROR; }
+ if (!($pppsettings{'TIMEOUT'} =~ /^\d+$/)) {
+ $errormessage = $Lang::tr{'only digits allowed in the idle timeout'};
+ goto ERROR; }
+
+ if ($pppsettings{'LOGINSCRIPT'} =~ /[.\/ ]/ ) {
+ $errormessage = $Lang::tr{'bad characters in script field'};
+ goto ERROR; }
+
+ if ($pppsettings{'DNS1'})
+ {
+ if (!(&General::validip($pppsettings{'DNS1'}))) {
+ $errormessage = $Lang::tr{'invalid primary dns'};
+ goto ERROR; }
+ }
+ if ($pppsettings{'DNS2'})
+ {
+ if (!(&General::validip($pppsettings{'DNS2'}))) {
+ $errormessage = $Lang::tr{'invalid secondary dns'};
+ goto ERROR; }
+ }
+
+ if ($pppsettings{'MAXRETRIES'} eq '') {
+ $errormessage = $Lang::tr{'max retries not set'};
+ goto ERROR; }
+ if (!($pppsettings{'MAXRETRIES'} =~ /^\d+$/)) {
+ $errormessage = $Lang::tr{'only digits allowed in max retries field'};
+ goto ERROR; }
+
+ if (!($pppsettings{'HOLDOFF'} =~ /^\d+$/)) {
+ $errormessage = $Lang::tr{'only digits allowed in holdoff field'};
+ goto ERROR; }
+
+ if ($pppsettings{'TYPE'} =~ /^(pppoeatm|pptpatm)$/) {
+ if ( ($pppsettings{'VPI'} eq '') || ($pppsettings{'VCI'} eq '') ) {
+ $errormessage = $Lang::tr{'invalid vpi vpci'};
+ goto ERROR; }
+ if ( (!($pppsettings{'VPI'} =~ /^\d+$/)) || (!($pppsettings{'VCI'} =~ /^\d+$/)) ) {
+ $errormessage = $Lang::tr{'invalid vpi vpci'};
+ goto ERROR; }
+ if (($pppsettings{'VPI'} eq '0') && ($pppsettings{'VCI'} eq '0')) {
+ $errormessage = $Lang::tr{'invalid vpi vpci'};
+ goto ERROR; }
+ if ( $pppsettings{'PROTOCOL'} eq '' ) {
+ $errormessage = $Lang::tr{'invalid input'};
+ goto ERROR; }
+ }
+
+ if ( ($pppsettings{'PROTOCOL'} eq 'RFC1483') && ($pppsettings{'METHOD'} eq '') && \
+ ($pppsettings{'TYPE'} !~ /^(alcatelusb|fritzdsl)$/)) {
+ $errormessage = $Lang::tr{'invalid input'};
+ goto ERROR; }
+
+ if (($pppsettings{'PROTOCOL'} eq 'RFC1483' && $pppsettings{'METHOD'} eq 'DHCP')) {
+ if ($pppsettings{'DHCP_HOSTNAME'} ne '') {
+ if (! &General::validfqdn($pppsettings{'DHCP_HOSTNAME'})) {
+ $errormessage = $errormessage.' '.$Lang::tr{'hostname'}.': '.$Lang::tr{'invalid hostname'}; }
+ }
+ }
+
+ if (($pppsettings{'PROTOCOL'} eq 'RFC1483' && $pppsettings{'METHOD'} eq 'STATIC')) {
+ $errormessage = '';
+ if (! &General::validip($pppsettings{'IP'})) {
+ $errormessage = $Lang::tr{'static ip'}.' '.$Lang::tr{'invalid ip'}; }
+ if (! &General::validip($pppsettings{'GATEWAY'})) {
+ $errormessage = $errormessage.' '.$Lang::tr{'gateway ip'}.' '.$Lang::tr{'invalid ip'}; }
+ if (! &General::validmask($pppsettings{'NETMASK'})) {
+ $errormessage = $errormessage.' '.$Lang::tr{'netmask'}.' '.$Lang::tr{'invalid netmask'}; }
+ if ($pppsettings{'BROADCAST'} ne '') {
+ if (! &General::validip($pppsettings{'BROADCAST'})) {
+ $errormessage = $errormessage.' '.$Lang::tr{'broadcast'}.' '.$Lang::tr{'invalid broadcast ip'}; }
+ }
+ if( $pppsettings{'DNS'} eq 'Automatic') {
+ $errormessage = $Lang::tr{'invalid input'}; }
+ if ($errormessage ne '') {goto ERROR; }
+ }
+
+ if( $pppsettings{'PROTOCOL'} eq 'RFC1483' && $pppsettings{'METHOD'} ne 'PPPOE' && \
+ $pppsettings{'RECONNECTION'} eq 'dialondemand' ) {
+ $errormessage = $Lang::tr{'invalid input'};
+ goto ERROR; }
+
+ if( $pppsettings{'RECONNECTION'} eq 'dialondemand' && `/bin/cat ${General::swroot}/ddns/config` =~ /,on$/m ) {
+ $errormessage = $Lang::tr{'dod not compatible with ddns'};
+ goto ERROR; }
+
+# if( $pppsettings{'PROTOCOL'} eq 'RFC1483') {
+# $pppsettings{'ENCAP'} = $pppsettings{'ENCAP_RFC1483'}; }
+# if( $pppsettings{'PROTOCOL'} eq 'RFC2364') {
+# $pppsettings{'ENCAP'} = $pppsettings{'ENCAP_RFC2364'}; }
+ delete $pppsettings{'ENCAP_RFC1483'};
+ delete $pppsettings{'ENCAP_RFC2364'};
+
+ if ((!($pppsettings{'INET_VLAN'} =~ /^\d+$/)) ||
+ ($pppsettings{'INET_VLAN'} eq '') ||
+ ($pppsettings{'INET_VLAN'} > 4095) ) {
+ $errormessage = 'INET_VLAN - '.$Lang::tr{'invalid input'}; }
+
+ if ((!($pppsettings{'IPTV_VLAN'} =~ /^\d+$/)) ||
+ ($pppsettings{'IPTV_VLAN'} eq '') ||
+ ($pppsettings{'IPTV_VLAN'} > 4095) ) {
+ $errormessage = 'IPTV_VLAN - '.$Lang::tr{'invalid input'}; }