mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 06:03:28 +00:00
Added support for comments on interfaces
This commit is contained in:
@@ -33,3 +33,5 @@ Fixed broken SuSE 10.2+ support.
|
||||
Re-wrote Gentoo networking support code to work with 2006 and later versions.
|
||||
---- Changes since 1.380 ----
|
||||
Added support for VLANs and channel bonding on Debian, thanks to Tim Oberfoell.
|
||||
Boot-time network interfaces can have comments on Redhat-based systems.
|
||||
The list of interfaces is now separated into active and boot time using tabs.
|
||||
|
||||
@@ -17,5 +17,5 @@ foreach $d (@d) {
|
||||
}
|
||||
|
||||
&webmin_log("delete", "aifcs", scalar(@d));
|
||||
&redirect("list_ifcs.cgi");
|
||||
&redirect("list_ifcs.cgi?mode=active");
|
||||
|
||||
|
||||
@@ -47,5 +47,5 @@ foreach $d (reverse(@d)) {
|
||||
}
|
||||
|
||||
&webmin_log($in{'apply'} ? "apply" : "delete", "bifcs", scalar(@d));
|
||||
&redirect("list_ifcs.cgi");
|
||||
&redirect("list_ifcs.cgi?mode=boot");
|
||||
|
||||
|
||||
@@ -141,5 +141,5 @@ else {
|
||||
}
|
||||
print "</tr></table></form>\n";
|
||||
|
||||
&ui_print_footer("list_ifcs.cgi", $text{'ifcs_return'});
|
||||
&ui_print_footer("list_ifcs.cgi?mode=active", $text{'ifcs_return'});
|
||||
|
||||
|
||||
@@ -36,6 +36,15 @@ print "<tr $tb> <td><b>",
|
||||
"</b></td> </tr>\n";
|
||||
print "<tr $cb> <td><table width=100%>\n";
|
||||
|
||||
# Comment, if allowed
|
||||
if (defined(&can_iface_desc) && &can_iface_desc($b)) {
|
||||
print "<tr> <td><b>$text{'ifcs_desc'}</b></td>\n";
|
||||
print "<td colspan=3>",
|
||||
&ui_textbox("desc", $b ? $b->{'desc'} : undef, 60),
|
||||
"</td> </tr>\n";
|
||||
}
|
||||
|
||||
# Interface name
|
||||
print "<tr> <td><b>$text{'ifcs_name'}</b></td> <td>\n";
|
||||
if ($in{'new'} && $in{'virtual'}) {
|
||||
print "<input type=hidden name=name value=$in{'virtual'}>\n";
|
||||
@@ -55,6 +64,7 @@ else {
|
||||
}
|
||||
print "</td>\n";
|
||||
|
||||
# IP address
|
||||
print "<td><b>$text{'ifcs_ip'}</b></td> <td>\n";
|
||||
$virtual = (!$b && $in{'virtual'}) || ($b && $b->{'virtual'} ne "");
|
||||
$dhcp = &can_edit("dhcp") && !$virtual;
|
||||
@@ -78,6 +88,7 @@ else {
|
||||
printf "<input name=address size=15 value=\"%s\"></td> </tr>\n",
|
||||
$b && !$b->{'bootp'} && !$b->{'dhcp'} ? $b->{'address'} : "";
|
||||
|
||||
# Netmask
|
||||
print "<tr> <td><b>$text{'ifcs_mask'}</b></td>\n";
|
||||
if ($in{'virtual'} && $in{'new'} && $virtual_netmask) {
|
||||
# Virtual netmask cannot be edited
|
||||
@@ -282,5 +293,5 @@ else {
|
||||
}
|
||||
print "</tr></table></form>\n";
|
||||
|
||||
&ui_print_footer("list_ifcs.cgi", $text{'ifcs_return'});
|
||||
&ui_print_footer("list_ifcs.cgi?mode=boot", $text{'ifcs_return'});
|
||||
|
||||
|
||||
@@ -56,5 +56,5 @@ else {
|
||||
}
|
||||
print "</tr></table></form>\n";
|
||||
|
||||
&ui_print_footer("list_ifcs.cgi", $text{'ifcs_return'});
|
||||
&ui_print_footer("list_ifcs.cgi?mode=boot", $text{'ifcs_return'});
|
||||
|
||||
|
||||
@@ -21,11 +21,10 @@ foreach $i ('ifcs', 'routes', 'dns', 'hosts',
|
||||
if (defined(&apply_network) && $access{'apply'} && !$zone) {
|
||||
# Allow the user to apply the network config
|
||||
print "<hr>\n";
|
||||
print "<form action=apply.cgi>\n";
|
||||
print "<table width=100%><tr>\n";
|
||||
print "<td><input type=submit value='$text{'index_apply'}'></td>\n";
|
||||
print "<td>$text{'index_applydesc'}</td>\n";
|
||||
print "</tr></table></form>\n";
|
||||
print &ui_buttons_start();
|
||||
print &ui_buttons_row("apply.cgi", $text{'index_apply'},
|
||||
$text{'index_applydesc'});
|
||||
print &ui_buttons_end();
|
||||
}
|
||||
&ui_print_footer("/", $text{'index'});
|
||||
|
||||
|
||||
@@ -9,9 +9,12 @@ index_apply2=Apply Selected Interfaces
|
||||
|
||||
ifcs_title=Network Interfaces
|
||||
ifcs_now=Interfaces Active Now
|
||||
ifcs_activedesc=Interfaces listed in this table are currently active on the system. In most cases, you should edit them under the <b>Boot Time</b> tab.
|
||||
ifcs_bootdesc=Interfaces listed in this table will be activated when the system boots up, and will generally be active now too.
|
||||
ifcs_name=Name
|
||||
ifcs_type=Type
|
||||
ifcs_ip=IP Address
|
||||
ifcs_desc=Interface description
|
||||
ifcs_mask=Netmask
|
||||
ifcs_status=Status
|
||||
ifcs_virtual=Virtual
|
||||
|
||||
@@ -8,11 +8,21 @@ $access{'ifcs'} || &error($text{'ifcs_ecannot'});
|
||||
$allow_add = &can_create_iface() && !$noos_support_add_ifcs;
|
||||
&ui_print_header(undef, $text{'ifcs_title'}, "");
|
||||
|
||||
# Start tabs for active/boot time interfaces
|
||||
@tabs = ( [ "active", $text{'ifcs_now'}, "list_ifcs.cgi?mode=active" ] );
|
||||
$defmode = "active";
|
||||
if (!$access{'bootonly'}) {
|
||||
push(@tabs, [ "boot", $text{'ifcs_boot'}, "list_ifcs.cgi?mode=boot" ] );
|
||||
$defmode = "boot";
|
||||
}
|
||||
print &ui_tabs_start(\@tabs, "mode", $in{'mode'} || $defmode, 1);
|
||||
|
||||
# Show interfaces that are currently active
|
||||
@act = &active_interfaces();
|
||||
if (!$access{'bootonly'}) {
|
||||
# Table heading and links
|
||||
print &ui_subheading($text{'ifcs_now'});
|
||||
print &ui_tabs_start_tab("mode", "active");
|
||||
print $text{'ifcs_activedesc'},"<p>\n";
|
||||
local @tds;
|
||||
@links = ( );
|
||||
if ($access{'ifcs'} >= 2) {
|
||||
@@ -79,11 +89,12 @@ if (!$access{'bootonly'}) {
|
||||
if ($access{'ifcs'} >= 2) {
|
||||
print &ui_form_end([ [ "delete", $text{'index_delete1'} ] ]);
|
||||
}
|
||||
print "<hr>\n";
|
||||
print &ui_tabs_end_tab();
|
||||
}
|
||||
|
||||
# Show interfaces that get activated at boot
|
||||
print &ui_subheading($text{'ifcs_boot'});
|
||||
print &ui_tabs_start_tab("mode", "boot");
|
||||
print $text{'ifcs_bootdesc'},"<p>\n";
|
||||
print &ui_form_start("delete_bifcs.cgi", "post");
|
||||
@links = ( &select_all_link("b", 1),
|
||||
&select_invert_link("b", 1) );
|
||||
@@ -185,6 +196,9 @@ print &ui_form_end([ [ "delete", $text{'index_delete2'} ],
|
||||
[ "deleteapply", $text{'index_delete3'} ],
|
||||
undef,
|
||||
[ "apply", $text{'index_apply2'} ] ]);
|
||||
print &ui_tabs_end_tab();
|
||||
|
||||
print &ui_tabs_end(1);
|
||||
|
||||
&ui_print_footer("", $text{'index_return'});
|
||||
|
||||
|
||||
@@ -21,5 +21,5 @@ if ($acl{$base_remote_user,$mod->{'module'}}) {
|
||||
}
|
||||
print "<p>\n";
|
||||
|
||||
&ui_print_footer("list_ifcs.cgi", $text{'ifcs_return'});
|
||||
&ui_print_footer("list_ifcs.cgi?mode=active", $text{'ifcs_return'});
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ while($f = readdir(CONF)) {
|
||||
: "Automatic";
|
||||
$b->{'dhcp'} = $conf{'DYNAMIC'} eq 'dhcp';
|
||||
$b->{'edit'} = ($b->{'name'} !~ /^ppp|plip/);
|
||||
$b->{'desc'} = $conf{'NAME'};
|
||||
$b->{'index'} = scalar(@rv);
|
||||
$b->{'file'} = "$net_scripts_dir/$f";
|
||||
push(@rv, $b);
|
||||
@@ -67,6 +68,7 @@ $conf{'NETWORK'} = sprintf "%d.%d.%d.%d",
|
||||
($ip4 & int($nm4))&0xff;
|
||||
$conf{'BROADCAST'} = $_[0]->{'broadcast'};
|
||||
$conf{'ONBOOT'} = $_[0]->{'up'} ? "yes" : "no";
|
||||
$conf{'NAME'} = $_[0]->{'desc'};
|
||||
&write_env_file("$net_scripts_dir/ifcfg-$name", \%conf);
|
||||
&unlock_file("$net_scripts_dir/ifcfg-$name");
|
||||
}
|
||||
@@ -87,6 +89,13 @@ sub can_edit
|
||||
return $_[0] ne "bootp" && $_[0] ne "mtu";
|
||||
}
|
||||
|
||||
# can_iface_desc([&iface])
|
||||
# Returns 1 if boot-interfaces can have comments
|
||||
sub can_iface_desc
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
# valid_boot_address(address)
|
||||
# Is some address valid for a bootup interface
|
||||
sub valid_boot_address
|
||||
|
||||
@@ -67,6 +67,7 @@ while($f = readdir(CONF)) {
|
||||
$b->{'num'} = $conf{'CLONENUM_START'};
|
||||
$b->{'up'} = 1;
|
||||
$b->{'edit'} = 1;
|
||||
$b->{'desc'} = $conf{'NAME'};
|
||||
$b->{'index'} = scalar(@rv);
|
||||
$b->{'file'} = "$net_scripts_dir/$f";
|
||||
push(@rv, $b);
|
||||
@@ -91,6 +92,7 @@ while($f = readdir(CONF)) {
|
||||
$b->{'dhcp'} = ($conf{'BOOTPROTO'} eq 'dhcp');
|
||||
$b->{'bootp'} = ($conf{'BOOTPROTO'} eq 'bootp');
|
||||
$b->{'edit'} = ($b->{'name'} !~ /^ppp|irlan/);
|
||||
$b->{'desc'} = $conf{'NAME'};
|
||||
$b->{'index'} = scalar(@rv);
|
||||
$b->{'file'} = "$net_scripts_dir/$f";
|
||||
push(@rv, $b);
|
||||
@@ -148,6 +150,7 @@ else {
|
||||
$conf{'BOOTPROTO'} = $_[0]->{'bootp'} ? "bootp" :
|
||||
$_[0]->{'dhcp'} ? "dhcp" : "none";
|
||||
}
|
||||
$conf{'NAME'} = $_[0]->{'desc'};
|
||||
&write_env_file("$net_scripts_dir/ifcfg-$name", \%conf);
|
||||
if (-d &translate_filename($devices_dir)) {
|
||||
&link_file("$net_scripts_dir/ifcfg-$name",
|
||||
@@ -680,6 +683,11 @@ sub range_input
|
||||
{
|
||||
local $new = !$_[0];
|
||||
|
||||
# Range description
|
||||
print "<tr> <td><b>$text{'ifcs_desc'}</b></td>\n";
|
||||
print "<td colspan=3>",&ui_textbox("desc", $_[0] ? $_[0]->{'desc'} : undef, 60),
|
||||
"</td> </tr>\n";
|
||||
|
||||
# Base interface
|
||||
print "<tr> <td><b>$text{'range_iface'}</b></td>\n";
|
||||
if ($new) {
|
||||
@@ -733,6 +741,7 @@ if ($in{'new'}) {
|
||||
$_[0]->{'range'} = $in{'range'};
|
||||
$_[0]->{'fullname'} = $in{'iface'}."-range".$in{'range'};
|
||||
}
|
||||
$_[0]->{'desc'} = $in{'desc'};
|
||||
|
||||
&check_ipaddress($in{'start'}) || &error($text{'range_estart'});
|
||||
$_[0]->{'start'} = $in{'start'};
|
||||
|
||||
@@ -147,5 +147,5 @@ else {
|
||||
&webmin_log($in{'new'} ? 'create' : 'modify',
|
||||
"aifc", $a->{'fullname'}, $a);
|
||||
}
|
||||
&redirect("list_ifcs.cgi");
|
||||
&redirect("list_ifcs.cgi?mode=active");
|
||||
|
||||
|
||||
@@ -127,6 +127,11 @@ else {
|
||||
$b->{'address'} = $in{'address'};
|
||||
}
|
||||
|
||||
# Set description if possible
|
||||
if (defined($in{'desc'})) {
|
||||
$b->{'desc'} = $in{'desc'};
|
||||
}
|
||||
|
||||
if ($virtual_netmask && $b->{'virtual'} ne "") {
|
||||
# Always use this netmask for virtuals
|
||||
$b->{'netmask'} = $virtual_netmask;
|
||||
@@ -229,5 +234,5 @@ else {
|
||||
&webmin_log($in{'new'} ? 'create' : 'modify',
|
||||
"bifc", $b->{'fullname'}, $b);
|
||||
}
|
||||
&redirect("list_ifcs.cgi");
|
||||
&redirect("list_ifcs.cgi?mode=boot");
|
||||
|
||||
|
||||
@@ -53,5 +53,5 @@ else {
|
||||
&webmin_log($in{'new'} ? 'create' : 'modify',
|
||||
"range", $b->{'fullname'}, $b);
|
||||
}
|
||||
&redirect("list_ifcs.cgi");
|
||||
&redirect("list_ifcs.cgi?mode=boot");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user