#!/usr/bin/perl # edit_bifc.cgi # Edit or create a bootup interface require './net-lib.pl'; &ReadParse(); !$in{'new'} || &can_create_iface() || &error($text{'ifcs_ecannot'}); @boot = &boot_interfaces(); # Show page title and get interface if ($in{'new'} && $in{'bond'}) { # New bonding interface &ui_print_header(undef, $text{'bonding_create'}, ""); $bmax = -1; foreach $b (@boot) { if ($b->{'fullname'} =~ /^bond(\d+)$/) { $bmax = $1; } } } elsif ($in{'new'} && $in{'vlan'}) { # New VLAN &ui_print_header(undef, $text{'vlan_create'}, ""); } elsif ($in{'new'} && $in{'bridge'}) { # New Bridge &ui_print_header(undef, $text{'bridge_create'}, ""); $bmax = -1; foreach $b (@boot) { if ($b->{'fullname'} =~ /^br(\d+)$/) { $bmax = $1; } } } elsif ($in{'new'}) { # New real or virtual interface &ui_print_header(undef, $text{'bifc_create'}, ""); if ($in{'virtual'}) { # Pick a virtual number $vmax = int($min_virtual_number) - 1; foreach my $e (@boot) { $vmax = $e->{'virtual'} if ($e->{'virtual'} ne '' && $e->{'name'} eq $in{'virtual'} && $e->{'virtual'} > $vmax); } } } else { # Editing existing $b = $boot[$in{'idx'}]; &can_iface($b) || &error($text{'ifcs_ecannot_this'}); &ui_print_header(undef, $text{'bifc_edit'}, ""); if (!$b->{'dhcp'} && !$b->{'bootp'} && !$b->{'broadcast'} && !&can_broadcast_def()) { # Fill in broadcast if missing, unless system can compute # it automatically $b->{'broadcast'} = &compute_broadcast( $b->{'address'}, $b->{'netmask'}); } } # Start of the form print &ui_form_start("save_bifc.cgi"); print &ui_hidden("new", $in{'new'}); print &ui_hidden("idx", $in{'idx'}); print &ui_hidden("vlan", $in{'vlan'}); print &ui_hidden("bond", $in{'bond'}); print &ui_hidden("bridge", $in{'bridge'}); print &ui_table_start($in{'virtual'} || $b && $b->{'virtual'} ne "" ? $text{'bifc_desc2'} : $text{'bifc_desc1'}, undef, 2); # Comment, if allowed if (defined(&can_iface_desc) && &can_iface_desc($b)) { print &ui_table_row($text{'ifcs_desc'}, &ui_textbox("desc", $b ? $b->{'desc'} : undef, 60), 3); } # Interface name if ($in{'new'} && $in{'virtual'}) { # New virtual interface $namefield = $in{'virtual'}.":". &ui_textbox("virtual", $vmax+1, 3). &ui_hidden("name", $in{'virtual'}); } elsif ($in{'new'}) { # New real interface if ($in{'vlan'}) { $namefield = "auto".&ui_hidden("name", "auto"); } elsif ($in{'bridge'}) { $namefield = "br ".&ui_textbox("name", ($bmax+1), 3); } elsif ($in{'bond'}) { $namefield = "bond ".&ui_textbox("name", ($bmax+1), 3); } else { $namefield = &ui_textbox("name", undef, 6); } } else { # Existing interface $namefield = "<tt>$b->{'fullname'}</tt>"; } print &ui_table_row($text{'ifcs_name'}, $namefield); # Activate at boot? if (&can_edit("up", $b) && $access{'up'}) { $upfield = &ui_yesno_radio("up", !$b || $b->{'up'}); } else { $upfield = !$b ? $text{'yes'} : $b->{'up'} ? $text{'yes'} : $text{'no'}; } print &ui_table_row($text{'bifc_act'}, $upfield); # IP address source. This can either be DHCP, BootP or a fixed IP, # netmask and broadcast $virtual = (!$b && $in{'virtual'}) || ($b && $b->{'virtual'} ne ""); $dhcp = &can_edit("dhcp") && !$virtual; $bootp = &can_edit("bootp") && !$virtual; if (defined(&supports_no_address) && &supports_no_address()) { # Having no address is allowed $canno = 1; } elsif ($b && !$b->{'address'} && !$b->{'dhcp'} && !$b->{'bootp'}) { # Has no address $canno = 1; } @opts = ( ); if ($canno) { push(@opts, [ "none", $text{'ifcs_noaddress'} ]); } if ($dhcp) { push(@opts, [ "dhcp", $text{'ifcs_dhcp'} ]); } if ($bootp) { push(@opts, [ "bootp", $text{'ifcs_bootp'} ]); } if ($canno) { } @grid = ( $text{'ifcs_ip'}, &ui_textbox("address", $b ? $b->{'address'} : "", 15) ); if ($in{'virtual'} && $in{'new'} && $virtual_netmask) { # Netmask is fixed push(@grid, $text{'ifcs_mask'}, "<tt>$virtual_netmask</tt>"); } elsif (&can_edit("netmask", $b) && $access{'netmask'}) { # Can edit netmask push(@grid, $text{'ifcs_mask'}, &ui_textbox("netmask", $b ? $b->{'netmask'} : $config{'def_netmask'}, 15)); } elsif ($b && $b->{'netmask'}) { # Cannot edit push(@grid, $text{'ifcs_mask'}, "<tt>$b->{'netmask'}</tt>"); } if (&can_edit("broadcast", $b) && $access{'broadcast'}) { # Can edit broadcast address push(@grid, $text{'ifcs_broad'}, &ui_opt_textbox("broadcast", $b ? $b->{'broadcast'} : $config{'def_broadcast'}, 15, $text{'ifcs_auto'})); } elsif ($b && $b->{'broadcast'}) { # Broadcast is fixed push(@grid, $text{'ifcs_broad'}, "<tt>$b->{'broadcast'}</tt>"); } push(@opts, [ "address", $text{'ifcs_static2'}, &ui_grid_table(\@grid, 2) ]); # Show the IP field if (@opts > 1) { print &ui_table_row($text{'ifcs_mode'}, &ui_radio_table("mode", $b && $b->{'dhcp'} ? "dhcp" : $b && $b->{'bootp'} ? "bootp" : $b && !$b->{'address'} ? "none" : "address", \@opts), 3); } else { print &ui_table_row($opts[0]->[1], $opts[0]->[2]); } # Show the IPv6 field if (&supports_address6($b)) { # Multiple IPs allowed $table6 = &ui_columns_start([ $text{'ifcs_address6'}, $text{'ifcs_netmask6'} ], 50); for($i=0; $i<=($b ? scalar(@{$b->{'address6'}}) : 0); $i++) { $table6 .= &ui_columns_row([ &ui_textbox("address6_$i", $b->{'address6'}->[$i], 40), &ui_textbox("netmask6_$i", $b->{'netmask6'}->[$i] || 64, 10) ]); } $table6 .= &ui_columns_end(); print &ui_table_row($text{'ifcs_mode6'}, &ui_radio_table("mode6", !$b ? "none" : $b->{'auto6'} ? "auto" : @{$b->{'address6'}} ? "address" : "none", [ [ "none", $text{'ifcs_none6'} ], [ "auto", $text{'ifcs_auto6'} ], [ "address", $text{'ifcs_static2'}, $table6 ] ]), 2); } # MTU if (&can_edit("mtu", $b) && $access{'mtu'}) { $mtufield = &ui_opt_textbox( "mtu", $b ? $b->{'mtu'} : $config{'def_mtu'}, 8, $text{'default'}); } else { $mtufield = $b && $b->{'mtu'} ? $b->{'mtu'} : undef; } if ($mtufield) { print &ui_table_row($text{'ifcs_mtu'}, $mtufield); } # Virtual sub-interfaces if ($b && $b->{'virtual'} eq "" && !$in{'new'}) { $vcount = 0; foreach $vb (@boot) { if ($vb->{'virtual'} ne "" && $vb->{'name'} eq $b->{'name'}) { $vcount++; } } $vlink = ""; if ($access{'virt'} && !$noos_support_add_virtifcs) { $vlink = "(<a href='edit_bifc.cgi?new=1&virtual=$b->{'name'}'>". "$text{'ifcs_addvirt'}</a>)\n"; } print &ui_table_row($text{'ifcs_virts'}, $vcount." ".$vlink); } # Special parameters for teaming if ($in{'bond'} || &iface_type($b->{'name'}) eq 'Bonded') { # Select bonding teampartner print &ui_table_row($text{'bonding_teamparts'}, &ui_textbox("partner", $b->{'partner'}, 10)." ".$text{'bonding_teampartsdesc'}); # Select teaming mode @mode = ("balance-rr", "activebackup", "balance-xor", "broadcast", "802.3ad", "balance-tlb", "balance-alb"); print &ui_table_row($text{'bonding_teammode'}, &ui_select("bondmode", int($b->{'mode'}), [ map { [ $_, $mode[$_] ] } (0 .. $#mode) ])); # Select bonding primary interface print &ui_table_row($text{'bonding_primary'}, &ui_textbox("primary", $b->{'primary'}, 5)." ".$text{'bonding_primarydesc'}); # Select mii Monitoring Interval print &ui_table_row($text{'bonding_miimon'}, &ui_textbox("miimon", $b->{'miimon'} ? $b->{'miimon'} : "100", 5)." ms ".$text{'bonding_miimondesc'}); # Select updelay print &ui_table_row($text{'bonding_updelay'}, &ui_textbox("updelay", $b->{'updelay'} ? $b->{'updelay'} : "200", 5)." ms"); # Select downdelay print &ui_table_row($text{'bonding_downdelay'}, &ui_textbox("downdelay", $b->{'downdelay'} ? $b->{'downdelay'} : "200", 5)." ms"); } # Special Parameter for vlan tagging if ($in{'vlan'} || &iface_type($b->{'name'}) =~ /^(.*) (VLAN)$/) { $b->{'name'} =~ /(\S+)\.(\d+)/; $physical = $1; $vlanid = $2; # Phyical device @phys = grep { (($_->{'virtual'} eq '') && ($_->{'vlanid'} eq '')) } &active_interfaces(1); print &ui_table_row($text{'vlan_physical'}, $in{'new'} ? &ui_select("physical", $physical, [ map { $_->{'fullname'} } @phys ]) : $physical.&ui_hidden("physical", $physical)); # VLAN ID print &ui_table_row($text{'vlan_id'}, $in{'new'} ? &ui_textbox("vlanid", $vlanid, 10) : $vlanid.&ui_hidden("vlanid", $vlanid)); } # Hardware address, if non-virtual if (($in{'new'} && $in{'virtual'} eq "" && !$in{'bridge'}) || (!$in{'new'} && $b->{'virtual'} eq "" && defined(&boot_iface_hardware) && &boot_iface_hardware($b->{'name'}))) { $hardfield = &ui_opt_textbox("ether", $b->{'ether'}, 30, $text{'aifc_default'}); print &ui_table_row($text{'aifc_hard'}, $hardfield); } # Real interface for bridge if ($in{'bridge'} || $b && $b->{'bridge'}) { @ethboot = sort { $a cmp $b } map { $_->{'fullname'} } grep { ($_->{'fullname'} =~ /^(vlan|bond)/ || &iface_type($_->{'fullname'}) eq 'Ethernet') && $_->{'virtual'} eq '' } @boot; print &ui_table_row($text{'bifc_bridgeto'}, &ui_select("bridgeto", $b->{'bridgeto'}, [ [ "", $text{'bifc_nobridge'} ], @ethboot ], 1, 0, $in{'new'} ? 0 : 1)); print &ui_table_row($text{'bifc_bridgestp'}, &ui_radio("bridgestp", $b->{'bridgestp'} ? $b->{'bridgestp'} : "off", [["off", "Off"], ["on", "On"]])); print &ui_table_row($text{'bifc_bridgefd'}, &ui_textbox("bridgefd", $b->{'bridgefd'} ? $b->{'bridgefd'} : "0", 3)." seconds"); print &ui_table_row($text{'bifc_bridgewait'}, &ui_textbox("bridgewait", $b->{'bridgewait'} ? $b->{'bridgewait'} : "0", 3)." seconds"); } print &ui_table_end(); # Generate and show buttons at end of the form @buts = ( ); if ($access{'bootonly'}) { # Can only save both boot-time and active if ($in{'new'}) { push(@buts, [ "activate", $text{'bifc_capply'} ]); } else { push(@buts, [ "activate", $text{'bifc_apply'} ]); if ($access{'delete'}) { push(@buts, [ "unapply", $text{'bifc_dapply'} ]); } } } else { # Show buttons to save both boot-time and/or active if ($in{'new'}) { push(@buts, [ undef, $text{'create'} ]); push(@buts, [ "activate", $text{'bifc_capply'} ]); } else { push(@buts, [ undef, $text{'save'} ]) unless $always_apply_ifcs; if (!($b->{'bootp'} || $b->{'dhcp'}) || defined(&apply_interface)) { push(@buts, [ "activate", $text{'bifc_apply'} ]); } if ($access{'delete'}) { push(@buts, [ "unapply", $text{'bifc_dapply'} ]); push(@buts, [ "delete", $text{'delete'} ]) unless $noos_support_delete_ifcs; } } } print &ui_form_end(\@buts); &ui_print_footer("list_ifcs.cgi?mode=boot", $text{'ifcs_return'});
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
images | Folder | 0755 |
|
|
lang | Folder | 0755 |
|
|
CHANGELOG | File | 5.55 KB | 0644 |
|
acl_security.pl | File | 3.08 KB | 0755 |
|
apply.cgi | File | 184 B | 0755 |
|
backup_config.pl | File | 1005 B | 0755 |
|
cgi_args.pl | File | 752 B | 0755 |
|
cobalt-linux-lib.pl | File | 32.85 KB | 0755 |
|
coherent-linux-lib.pl | File | 32.85 KB | 0755 |
|
config | File | 48 B | 0644 |
|
config-ALL-linux | File | 48 B | 0644 |
|
config-cygwin | File | 82 B | 0644 |
|
config-freebsd | File | 48 B | 0644 |
|
config-macos | File | 48 B | 0644 |
|
config-netbsd | File | 48 B | 0644 |
|
config-openbsd | File | 48 B | 0644 |
|
config-solaris | File | 79 B | 0644 |
|
config-syno-linux | File | 48 B | 0644 |
|
config-unixware | File | 48 B | 0644 |
|
config-windows | File | 78 B | 0644 |
|
config.info | File | 193 B | 0644 |
|
config.info.ca | File | 241 B | 0644 |
|
config.info.cs | File | 205 B | 0644 |
|
config.info.de | File | 219 B | 0644 |
|
config.info.es | File | 175 B | 0644 |
|
config.info.fa | File | 255 B | 0644 |
|
config.info.fr | File | 246 B | 0644 |
|
config.info.hu | File | 0 B | 0644 |
|
config.info.ja | File | 68 B | 0644 |
|
config.info.nl | File | 197 B | 0644 |
|
config.info.no | File | 208 B | 0644 |
|
config.info.pl | File | 240 B | 0644 |
|
config.info.pt_BR | File | 229 B | 0644 |
|
config.info.ru | File | 361 B | 0644 |
|
config.info.sk | File | 225 B | 0644 |
|
config.info.sv | File | 42 B | 0644 |
|
config.info.tr | File | 65 B | 0644 |
|
config.info.uk | File | 87 B | 0644 |
|
config.info.zh | File | 43 B | 0644 |
|
config.info.zh_TW | File | 44 B | 0644 |
|
create_route.cgi | File | 1004 B | 0755 |
|
cygwin-lib.pl | File | 11.28 KB | 0755 |
|
debian-linux-lib.pl | File | 33.58 KB | 0755 |
|
defaultacl | File | 114 B | 0644 |
|
delete_aifcs.cgi | File | 537 B | 0755 |
|
delete_bifcs.cgi | File | 1.44 KB | 0755 |
|
delete_hosts.cgi | File | 523 B | 0755 |
|
delete_ipnodes.cgi | File | 542 B | 0755 |
|
delete_routes.cgi | File | 458 B | 0755 |
|
edit_aifc.cgi | File | 5.09 KB | 0755 |
|
edit_bifc.cgi | File | 10.42 KB | 0755 |
|
edit_host.cgi | File | 1.13 KB | 0755 |
|
edit_ipnode.cgi | File | 1.04 KB | 0755 |
|
edit_range.cgi | File | 1.34 KB | 0755 |
|
freebsd-lib.pl | File | 19.22 KB | 0755 |
|
gentoo-linux-lib.pl | File | 8.47 KB | 0755 |
|
index.cgi | File | 1.25 KB | 0755 |
|
interface_chooser.cgi | File | 3.8 KB | 0755 |
|
linux-lib.pl | File | 27.58 KB | 0755 |
|
list_dns.cgi | File | 2.3 KB | 0755 |
|
list_hosts.cgi | File | 1.36 KB | 0755 |
|
list_ifcs.cgi | File | 7.96 KB | 0755 |
|
list_ipnodes.cgi | File | 1.07 KB | 0755 |
|
list_routes.cgi | File | 3.38 KB | 0755 |
|
log_parser.pl | File | 1.24 KB | 0755 |
|
macos-lib.pl | File | 11.57 KB | 0755 |
|
mandrake-linux-lib.pl | File | 32.85 KB | 0755 |
|
mod_aifc.cgi | File | 720 B | 0755 |
|
module.info | File | 485 B | 0644 |
|
module.info.af | File | 0 B | 0644 |
|
module.info.af.auto | File | 123 B | 0644 |
|
module.info.ar | File | 0 B | 0644 |
|
module.info.ar.auto | File | 170 B | 0644 |
|
module.info.be | File | 0 B | 0644 |
|
module.info.be.auto | File | 226 B | 0644 |
|
module.info.bg | File | 0 B | 0644 |
|
module.info.bg.auto | File | 261 B | 0644 |
|
module.info.ca | File | 127 B | 0644 |
|
module.info.ca.auto | File | 25 B | 0644 |
|
module.info.cs | File | 27 B | 0644 |
|
module.info.cs.auto | File | 111 B | 0644 |
|
module.info.da | File | 0 B | 0644 |
|
module.info.da.auto | File | 129 B | 0644 |
|
module.info.de | File | 121 B | 0644 |
|
module.info.de.auto | File | 19 B | 0644 |
|
module.info.el | File | 0 B | 0644 |
|
module.info.el.auto | File | 229 B | 0644 |
|
module.info.es | File | 30 B | 0644 |
|
module.info.es.auto | File | 116 B | 0644 |
|
module.info.eu | File | 0 B | 0644 |
|
module.info.eu.auto | File | 142 B | 0644 |
|
module.info.fa | File | 0 B | 0644 |
|
module.info.fa.auto | File | 194 B | 0644 |
|
module.info.fi | File | 0 B | 0644 |
|
module.info.fi.auto | File | 145 B | 0644 |
|
module.info.fr | File | 30 B | 0644 |
|
module.info.fr.auto | File | 128 B | 0644 |
|
module.info.he | File | 0 B | 0644 |
|
module.info.he.auto | File | 161 B | 0644 |
|
module.info.hr | File | 0 B | 0644 |
|
module.info.hr.auto | File | 148 B | 0644 |
|
module.info.hu | File | 34 B | 0644 |
|
module.info.hu.auto | File | 148 B | 0644 |
|
module.info.it | File | 28 B | 0644 |
|
module.info.it.auto | File | 112 B | 0644 |
|
module.info.ja | File | 33 B | 0644 |
|
module.info.ja.auto | File | 153 B | 0644 |
|
module.info.ko | File | 28 B | 0644 |
|
module.info.ko.auto | File | 105 B | 0644 |
|
module.info.lt | File | 0 B | 0644 |
|
module.info.lt.auto | File | 157 B | 0644 |
|
module.info.lv | File | 0 B | 0644 |
|
module.info.lv.auto | File | 157 B | 0644 |
|
module.info.ms | File | 136 B | 0644 |
|
module.info.ms.auto | File | 18 B | 0644 |
|
module.info.mt | File | 0 B | 0644 |
|
module.info.mt.auto | File | 144 B | 0644 |
|
module.info.nl | File | 29 B | 0644 |
|
module.info.nl.auto | File | 105 B | 0644 |
|
module.info.no | File | 31 B | 0644 |
|
module.info.no.auto | File | 99 B | 0644 |
|
module.info.pl | File | 122 B | 0644 |
|
module.info.pl.auto | File | 19 B | 0644 |
|
module.info.pt | File | 31 B | 0644 |
|
module.info.pt.auto | File | 125 B | 0644 |
|
module.info.pt_BR | File | 34 B | 0644 |
|
module.info.pt_BR.auto | File | 131 B | 0644 |
|
module.info.ro | File | 0 B | 0644 |
|
module.info.ro.auto | File | 143 B | 0644 |
|
module.info.ru | File | 36 B | 0644 |
|
module.info.ru.auto | File | 167 B | 0644 |
|
module.info.sk | File | 28 B | 0644 |
|
module.info.sk.auto | File | 113 B | 0644 |
|
module.info.sl | File | 0 B | 0644 |
|
module.info.sl.auto | File | 140 B | 0644 |
|
module.info.sv | File | 31 B | 0644 |
|
module.info.sv.auto | File | 103 B | 0644 |
|
module.info.th | File | 0 B | 0644 |
|
module.info.th.auto | File | 327 B | 0644 |
|
module.info.tr | File | 30 B | 0644 |
|
module.info.tr.auto | File | 130 B | 0644 |
|
module.info.uk | File | 0 B | 0644 |
|
module.info.uk.auto | File | 223 B | 0644 |
|
module.info.ur | File | 0 B | 0644 |
|
module.info.ur.auto | File | 210 B | 0644 |
|
module.info.vi | File | 0 B | 0644 |
|
module.info.vi.auto | File | 170 B | 0644 |
|
module.info.zh | File | 21 B | 0644 |
|
module.info.zh.auto | File | 90 B | 0644 |
|
module.info.zh_TW | File | 24 B | 0644 |
|
module.info.zh_TW.auto | File | 96 B | 0644 |
|
msc-linux-lib.pl | File | 32.85 KB | 0755 |
|
net-lib.pl | File | 12 KB | 0755 |
|
netbsd-lib.pl | File | 19.22 KB | 0755 |
|
netplan-lib.pl | File | 21.01 KB | 0644 |
|
open-linux-lib.pl | File | 7.2 KB | 0755 |
|
openbsd-lib.pl | File | 12.6 KB | 0755 |
|
openmamba-linux-lib.pl | File | 32.85 KB | 0755 |
|
pardus-linux-lib.pl | File | 32.85 KB | 0755 |
|
rbac-mapping | File | 180 B | 0644 |
|
rc.inet1 | File | 1.95 KB | 0644 |
|
redhat-linux-lib.pl | File | 32.85 KB | 0755 |
|
save_aifc.cgi | File | 5.78 KB | 0755 |
|
save_bifc.cgi | File | 10.12 KB | 0755 |
|
save_dns.cgi | File | 3.65 KB | 0755 |
|
save_host.cgi | File | 1.18 KB | 0755 |
|
save_ipnode.cgi | File | 1.26 KB | 0755 |
|
save_range.cgi | File | 1.42 KB | 0755 |
|
save_routes.cgi | File | 283 B | 0755 |
|
slackware-linux-9.1-ALL-lib.pl | File | 7.85 KB | 0755 |
|
slackware-linux-lib.pl | File | 6.71 KB | 0755 |
|
solaris-lib.pl | File | 20.79 KB | 0755 |
|
suse-linux-8.0-lib.pl | File | 7.31 KB | 0755 |
|
suse-linux-8.2-lib.pl | File | 7.31 KB | 0755 |
|
suse-linux-9.0-lib.pl | File | 8.74 KB | 0755 |
|
suse-linux-9.1-lib.pl | File | 8.74 KB | 0755 |
|
suse-linux-9.2-ALL-lib.pl | File | 11.23 KB | 0755 |
|
suse-linux-lib.pl | File | 9.08 KB | 0755 |
|
system_info.pl | File | 2.42 KB | 0644 |
|
trustix-linux-lib.pl | File | 32.85 KB | 0755 |
|
turbo-linux-lib.pl | File | 32.85 KB | 0755 |
|
united-linux-lib.pl | File | 7.31 KB | 0755 |
|
unixware-lib.pl | File | 9.9 KB | 0755 |
|
windows-lib.pl | File | 11.28 KB | 0755 |
|