mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-27 11:13:24 +02:00
webif: Add a GUI for configuring VLAN interfaces
This patch adds a new CGI file which allows users to edit the VLAN configuration as well as configuring zones as bridges. Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
committed by
Michael Tremer
parent
a494174979
commit
1dcf513a41
@@ -402,6 +402,48 @@ sub get_hardware_address($) {
|
||||
return $ret;
|
||||
}
|
||||
|
||||
sub get_nic_property {
|
||||
my $nicname = shift;
|
||||
my $property = shift;
|
||||
my $result;
|
||||
|
||||
open(FILE, "/sys/class/net/$nicname/$property") or die("Could not read property");
|
||||
$result = <FILE>;
|
||||
close(FILE);
|
||||
|
||||
chomp($result);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
sub valid_mac($) {
|
||||
my $mac = shift;
|
||||
|
||||
return $mac =~ /^([0-9A-Fa-f]{2}[:]){5}([0-9A-Fa-f]{2})$/;
|
||||
}
|
||||
|
||||
sub random_mac {
|
||||
my $address = "02";
|
||||
|
||||
for my $i (0 .. 4) {
|
||||
$address = sprintf("$address:%02x", int(rand(255)));
|
||||
}
|
||||
|
||||
return $address;
|
||||
}
|
||||
|
||||
sub get_mac_by_name($) {
|
||||
my $mac = shift;
|
||||
|
||||
if ((!&valid_mac($mac)) && ($mac ne "")) {
|
||||
if (-e "/sys/class/net/$mac/") {
|
||||
$mac = get_nic_property($mac, "address");
|
||||
}
|
||||
}
|
||||
|
||||
return $mac;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
# Remove the next line to enable the testsuite
|
||||
|
||||
@@ -3,6 +3,11 @@
|
||||
'title' => "$Lang::tr{'net config'}",
|
||||
'enabled' => 0,
|
||||
};
|
||||
$subnetwork->{'11.zoneconf'} = {'caption' => "$Lang::tr{'zoneconf title'}",
|
||||
'uri' => '/cgi-bin/zoneconf.cgi',
|
||||
'title' => "$Lang::tr{'zoneconf title'}",
|
||||
'enabled' => 1,
|
||||
};
|
||||
$subnetwork->{'20.proxy'} = {'caption' => "$Lang::tr{'web proxy'}",
|
||||
'uri' => '/cgi-bin/proxy.cgi',
|
||||
'title' => "$Lang::tr{'web proxy'}",
|
||||
|
||||
Reference in New Issue
Block a user