From: Arne Fitzenreiter Date: Sat, 19 Dec 2009 10:12:48 +0000 (+0100) Subject: Add field for changing vdsl internet mac. X-Git-Tag: v2.9-beta1~567 X-Git-Url: http://git.ipfire.org/?p=people%2Fpmueller%2Fipfire-2.x.git;a=commitdiff_plain;h=1bffb899be93de0c6aeb44aa59d5409afd58ba0c Add field for changing vdsl internet mac. --- diff --git a/html/cgi-bin/mac.cgi b/html/cgi-bin/mac.cgi index 99eb6088ca..f95c0d8026 100644 --- a/html/cgi-bin/mac.cgi +++ b/html/cgi-bin/mac.cgi @@ -55,8 +55,21 @@ if ($macsettings{'ACTION'} eq $Lang::tr{'save'}) { } else { $errormessage = $Lang::tr{'mac address error not valid'}; } + $macsettings{'MAC1'} =~ s/\-/:/g; + if ( not ($macsettings{'MAC1'} eq "" )) { + my @mac = split(/:/,$macsettings{"MAC1"}); + if ($#mac == 5) { + foreach (@mac) { + unless ($_ =~ /^[a-fA-F0-9]{1,2}$/) { + $errormessage = $Lang::tr{'mac address error not valid'}; + last; + } + } + } else { + $errormessage = $Lang::tr{'mac address error not valid'}; + } + } $macsettings{'MAC2'} =~ s/\-/:/g; - if ( not ($macsettings{'MAC2'} eq "" )) { my @mac = split(/:/,$macsettings{"MAC2"}); if ($#mac == 5) { @@ -72,6 +85,7 @@ if ($macsettings{'ACTION'} eq $Lang::tr{'save'}) { } if ($errormessage eq "") { $macsettings{'MAC'} =~ s/\:/-/g; + $macsettings{'MAC1'} =~ s/\:/-/g; $macsettings{'MAC2'} =~ s/\:/-/g; &General::writehash("${General::swroot}/mac/settings", \%macsettings); &Header::openbox('100%', 'left', $Lang::tr{'mac address saved'}); @@ -134,6 +148,26 @@ print < + +   + + + $Lang::tr{'mac1 new'}  +END +; +if ($macsettings{'ACTION'} eq $Lang::tr{'delete'} ) { +print <* +END +; +} else { +print <* +END +; +} print < @@ -154,6 +188,7 @@ print < diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl index b1ef8aa2f5..a82df3d218 100644 --- a/langs/de/cgi-bin/de.pl +++ b/langs/de/cgi-bin/de.pl @@ -1070,6 +1070,7 @@ 'mac address done' => 'Die MAC-Adressen Einstellungen werden übernommen', 'mac desc' => 'Sie können an dieser Stelle die MAC-Adresse von red0 ändern. Die Adresse muss in hexadezimal (0-9,a-f) eingegeben werden, eine gültige Eingaben ist z.B. 00-01-02-0e-b8-d6 oder 00:01:02:0e:b8:d6.', 'mac new' => 'Neue MAC-Adresse:', +'mac1 new' => 'Neue MAC-Adresse 1 (vdsl-inet):', 'mac2 new' => 'Neue MAC-Adresse 2 (vdsl-iptv):', 'magic packet send to:' => 'Sende WOL-Paket an', 'mailmethod' => 'Mail Methode', diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl index a4ed91e547..c880769171 100644 --- a/langs/en/cgi-bin/en.pl +++ b/langs/en/cgi-bin/en.pl @@ -1100,6 +1100,7 @@ 'mac address done' => 'The MAC address settings are going to be saved.', 'mac desc' => 'Here you are able to change the MAC address on red0. The address must be entered in hexadecimal (0-9,a-f), a valid entry is
e.g. 00-01-02-0e-b8-d6 or 00:01:02:0e:b8:d6.', 'mac new' => 'new MAC address:', +'mac1 new' => 'new MAC address 1 (vdsl-inet):', 'mac2 new' => 'new MAC address 2 (vdsl-iptv):', 'magic packet send to:' => 'Magic packet send to:', 'mailmethod' => 'Mailmethod', diff --git a/langs/fr/cgi-bin/fr.pl b/langs/fr/cgi-bin/fr.pl index a4ed91e547..c880769171 100644 --- a/langs/fr/cgi-bin/fr.pl +++ b/langs/fr/cgi-bin/fr.pl @@ -1100,6 +1100,7 @@ 'mac address done' => 'The MAC address settings are going to be saved.', 'mac desc' => 'Here you are able to change the MAC address on red0. The address must be entered in hexadecimal (0-9,a-f), a valid entry is
e.g. 00-01-02-0e-b8-d6 or 00:01:02:0e:b8:d6.', 'mac new' => 'new MAC address:', +'mac1 new' => 'new MAC address 1 (vdsl-inet):', 'mac2 new' => 'new MAC address 2 (vdsl-iptv):', 'magic packet send to:' => 'Magic packet send to:', 'mailmethod' => 'Mailmethod', diff --git a/src/initscripts/init.d/networking/red b/src/initscripts/init.d/networking/red index f24bdb3a06..21952f475c 100644 --- a/src/initscripts/init.d/networking/red +++ b/src/initscripts/init.d/networking/red @@ -33,6 +33,7 @@ eval $(/usr/local/bin/readhash /var/ipfire/dns/settings) eval $(/usr/local/bin/readhash /var/ipfire/mac/settings) MAC=$(tr - : <<<$MAC) +MAC1=$(tr - : <<<$MAC1) MAC2=$(tr - : <<<$MAC2) TYPE="${RED_TYPE}" @@ -253,6 +254,11 @@ case "${1}" in boot_mesg "Createing VLAN Interface ${DEVICE}.${RED_VDSL_INET_VLAN} ..." modprobe 8021q vconfig add ${DEVICE} ${RED_VDSL_INET_VLAN} + if [ -n "$MAC1" ]; then + boot_mesg "Setting mac address on ${DEVICE}.${RED_VDSL_INET_VLAN} to ${MAC1}" + ip link set dev ${DEVICE}.${RED_VDSL_INET_VLAN} address ${MAC1} + evaluate_retval + fi PPP_NIC=${DEVICE}.${RED_VDSL_INET_VLAN} sleep 0.2 ip link set ${PPP_NIC} up