Add field for changing vdsl internet mac.

This commit is contained in:
Arne Fitzenreiter
2009-12-19 11:12:48 +01:00
parent c7eab60090
commit 1bffb899be
5 changed files with 45 additions and 1 deletions

View File

@@ -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 <<END
END
;
}
print <<END
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td><font class='base'>$Lang::tr{'mac1 new'}&nbsp;</font></td><td>
END
;
if ($macsettings{'ACTION'} eq $Lang::tr{'delete'} ) {
print <<END
<input type="text" name="MAC1" maxlength="17" value=''/><img src='/blob.gif' alt='*' /></td>
END
;
} else {
print <<END
<input type="text" name="MAC1" maxlength="17" value='$macsettings{"MAC1"}'/><img src='/blob.gif' alt='*' /></td>
END
;
}
print <<END
</tr>
<tr>
@@ -154,6 +188,7 @@ print <<END
END
;
}
print <<END
</tr>
<tr>

View File

@@ -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',

View File

@@ -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 <br />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',

View File

@@ -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 <br />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',

View File

@@ -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