#!/usr/local/bin/perl # edit_bifc.cgi # Edit or create a bootup interface require './net-lib.pl'; &ReadParse(); if ($in{'new'}) { &ui_print_header(undef, $text{'bifc_create'}, ""); &can_create_iface() || &error($text{'ifcs_ecannot'}); } else { @boot = &boot_interfaces(); $b = $boot[$in{'idx'}]; &can_iface($b) || &error($text{'ifcs_ecannot_this'}); &ui_print_header(undef, $text{'bifc_edit'}, ""); } print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
", $in{'virtual'} || $b && $b->{'virtual'} ne "" ? $text{'bifc_desc2'} : $text{'bifc_desc1'}, "
\n"; print "\n"; print "\n", $b && !$b->{'bootp'} && !$b->{'dhcp'} ? $b->{'address'} : ""; print "\n"; if ($in{'virtual'} && $in{'new'} && $virtual_netmask) { # Virtual netmask cannot be edited print "\n"; } elsif (&can_edit("netmask", $b) && $access{'netmask'}) { printf "\n", $b ? $b->{'netmask'} : $config{'def_netmask'}; } else { printf "\n", $b ? $b->{'netmask'} : $text{'ifcs_auto'}; } print "\n"; if (&can_edit("broadcast", $b) && $access{'broadcast'}) { printf "\n", $b ? $b->{'broadcast'} : $config{'def_broadcast'}; } else { printf "\n", $b ? $b->{'broadcast'} : $text{'ifcs_auto'}; } print "\n"; if (&can_edit("mtu", $b) && $access{'mtu'}) { printf "\n", $b ? $b->{'mtu'} : $config{'def_mtu'}; } else { printf "\n", $b && $b->{'mtu'} ? $b->{'mtu'} : $text{'ifcs_auto'}; } print "\n"; if (&can_edit("up", $b) && $access{'up'}) { printf "\n", $b && !$b->{'up'} ? "checked" : ""; } else { printf "\n", !$b ? $text{'yes'} : $b->{'up'} ? $text{'yes'} : $text{'no'}; } print "\n"; if ($b && $b->{'virtual'} eq "") { print "\n"; $vcount = 0; foreach $vb (@boot) { if ($vb->{'virtual'} ne "" && $vb->{'name'} eq $b->{'name'}) { $vcount++; } } print "\n"; } print "\n"; print "
$text{'ifcs_name'} \n"; if ($in{'new'} && $in{'virtual'}) { print "\n"; print "$in{'virtual'}:\n"; } elsif ($in{'new'}) { print "\n"; } else { print "$b->{'fullname'}\n"; } print "$text{'ifcs_ip'} \n"; $virtual = (!$b && $in{'virtual'}) || ($b && $b->{'virtual'} ne ""); $dhcp = &can_edit("dhcp") && !$virtual; $bootp = &can_edit("bootp") && !$virtual; if ($dhcp) { printf " %s\n", $b && $b->{'dhcp'} ? "checked" : "", $text{'ifcs_dhcp'}; } if ($bootp) { printf " %s\n", $b && $b->{'bootp'} ? "checked" : "", $text{'ifcs_bootp'}; } if ($dhcp || $bootp) { printf " %s\n", !$b || (!$b->{'bootp'} && !$b->{'dhcp'}) ? "checked" : "", $text{'ifcs_static'}; } else { print "\n"; } printf "
$text{'ifcs_mask'}$virtual_netmask%s$text{'ifcs_broad'}%s
$text{'ifcs_mtu'}%s$text{'ifcs_act'} $text{'yes'}\n", !$b || $b->{'up'} ? "checked" : ""; printf " $text{'no'}%s
$text{'ifcs_virts'}$vcount\n"; if ($access{'virt'} && !$noos_support_add_virtifcs) { print "(", "$text{'ifcs_addvirt'})\n"; } print "
\n"; print "\n"; if ($access{'bootonly'}) { # Can only save both boot-time and active if ($in{'new'}) { print "\n"; } else { print "\n"; if ($access{'delete'}) { print "\n"; } } } else { # Show buttons to save both boot-time and/or active if ($in{'new'}) { print "\n"; print "\n"; } else { print "\n" unless $always_apply_ifcs; if (!($b->{'bootp'} || $b->{'dhcp'}) || defined(&apply_interface)) { print "\n"; } if ($access{'delete'}) { print "\n"; print "\n" unless $noos_support_delete_ifcs; } } } print "
\n"; &ui_print_footer("list_ifcs.cgi", $text{'ifcs_return'});