#!/usr/bin/perl
# list_nat.cgi
# Show NAT enable form
require './itsecur-lib.pl';
&can_use_error("nat");
&header($text{'nat_title'}, "",
undef, undef, undef, undef, &apply_button());
print &ui_hr();
print &ui_form_start("save_nat.cgi","post");
print &ui_table_start($text{'nat_header'},undef,2);
my ($iface, @nets) = &get_nat();
my @maps = grep { ref($_) } @nets;
my @nets = grep { !ref($_) } @nets;
print &ui_table_row($text{'nat_desc'},
&ui_radio("nat", ( $iface ? 1 : 0 ), [
[0,$text{'nat_disabled'}."
"],[1,$text{'nat_enabled'}]
]).&iface_input("iface", $iface) );
my $style = "style='margin:0;padding:0;'";
my $tx = "";
$tx .= "
";
$tx .= "";
my $i = 0;
foreach $n ((grep { $_ !~ /^\!/ } @nets), undef, undef, undef) {
$tx .= "| ".&group_input("net_$i", $n, 1)." | ";
$i++;
}
$tx .= " | ";
$tx .= " $text{'nat_excl'} | ";
$tx .= "";
$i = 0;
foreach $n ((grep { $_ =~ /^\!/ } @nets), undef, undef, undef) {
$tx .= "| ".&group_input("excl_$i", $n =~ /^\!(.*)/ ? $1 : undef, 1)." | ";
$i++;
}
$tx .= " | ";
$tx .= "
";
print &ui_table_row($text{'nat_nets'}, $tx, undef, ["valign=top","valign=top"]);
$tx = "";
$tx .= "| $text{'nat_ext'} | ".
" $text{'nat_int'} | ".
" $text{'nat_virt'} |
";
$i = 0;
foreach $m (@maps, [ ], [ ], [ ]) {
$tx .= "";
$tx .= "| ".&ui_textbox("ext_".$i, $m->[0], 20)." | ",
$tx .= " ".&group_input("int_$i", $m->[1], 1)." | ";
$tx .= " ".&iface_input("virt_$i", $m->[2], 1, 1, 1)." | ";
$tx .= "
";
$i++;
}
$tx .= "
";
print &ui_table_row($text{'nat_maps'}."
".$text{'nat_mapsdesc'}."", $tx, undef, ["valign=top","valign=top"]);
print &ui_table_end();
print "";
print &ui_submit($text{'save'});
print &ui_form_end(undef,undef,1);
&can_edit_disable("nat");
print &ui_hr();
&footer("", $text{'index_return'});