diff --git a/shorewall/shorewall-lib.pl b/shorewall/shorewall-lib.pl
index b0825acc6..e31c3a7da 100755
--- a/shorewall/shorewall-lib.pl
+++ b/shorewall/shorewall-lib.pl
@@ -564,8 +564,6 @@ sub zones_colnames
{
if (&new_zones_format()) {
return ( $text{'zones_0'}, $text{'zones_1new'}, $text{'zones_2new'},
-# The option fields are not displayed in the main list.
-# $text{'zones_3new'}, $text{'zones_4new'}, $text{'zones_5new'},
$text{'zones_6new'} );
}
else {
@@ -577,44 +575,41 @@ sub zones_form
{
if (&new_zones_format()) {
# Shorewall 3 zones format
- print "
$text{'zones_0'} \n";
- print "",&ui_textbox("id", $_[0], 8)," \n";
+ print &ui_table_row($text{'zones_0'},
+ &ui_textbox("id", $_[0], 8));
- print "$text{'zones_1new'} \n";
- print "\n";
my $zf = &zone_field("parent", $_[1], 0, 1);
- print $zf;
- print " \n";
+ print &ui_table_row($text{'zones_1new'}, $zf);
- print "$text{'zones_2new'} \n";
- print "",&ui_select("type", $_[2],
- [ [ "ipv4", $text{'zones_ipv4'} ],
- [ "ipsec", $text{'zones_ipsec'} ],
- [ "firewall", $text{'zones_firewall'} ] ])," \n";
+ print &ui_table_row($text{'zones_2new'},
+ &ui_select("type", $_[2],
+ [ [ "ipv4", $text{'zones_ipv4'} ],
+ [ "ipsec", $text{'zones_ipsec'} ],
+ [ "firewall", $text{'zones_firewall'} ] ]));
- print " $text{'zones_3new'} \n";
- print "",&ui_textbox("opts", $_[3], 50)," \n";
+ print &ui_table_row($text{'zones_3new'},
+ &ui_textbox("opts", $_[3], 50));
- print " $text{'zones_4new'} \n";
- print "",&ui_textbox("opts_in", $_[4], 50)," \n";
+ print &ui_table_row($text{'zones_4new'},
+ &ui_textbox("opts_in", $_[4], 50));
- print " $text{'zones_5new'} \n";
- print "",&ui_textbox("opts_out", $_[5], 50)," \n";
+ print &ui_table_row($text{'zones_5new'},
+ &ui_textbox("opts_out", $_[5], 50));
- print " $text{'zones_6new'} \n";
- print "",&ui_textbox("comment", $_[6], 50)," \n";
+ print &ui_table_row($text{'zones_6new'},
+ &ui_textbox("comment", $_[6], 50));
}
else {
# Shorewall 2 zones format
- print " $text{'zones_0'} \n";
- print " \n";
+ print &ui_table_row($text{'zones_0'},
+ &ui_textbox("id", $_[0], 8));
- print " $text{'zones_1'} \n";
- print " \n";
+ print &ui_table_row($text{'zones_1'},
+ &ui_textbox("name", $_[1], 15));
- print " $text{'zones_2'} \n";
- print " \n";
+ print &ui_table_row($text{'zones_2'},
+ &ui_textbox("desc", $_[2], 70));
}
}
@@ -690,39 +685,27 @@ if (&version_atleast(3)) {
sub interfaces_form
{
-print " $text{'interfaces_0'} \n";
-print " \n";
+print &ui_table_row($text{'interfaces_0'},
+ &ui_textbox("iface", $_[1], 6));
-local @ztable = &read_table_file("zones", \&zones_parser);
-print "$text{'interfaces_1'} \n";
-print "\n";
my $zf = &zone_field("zone", $_[0], 0, 1);
-print $zf;
-print " \n";
+print &ui_table_row($text{'interfaces_1'}, $zf);
if (&new_interfaces_format()) {
- local %opts = map { $_, 1 } split(/,/, $_[2]);
- print " $text{'interfaces_3'} \n";
- &options_input("opts", $_[2], \@interfaces_opts);
- print " \n";
+ print &ui_table_row($text{'interfaces_3'},
+ &options_input("opts", $_[2], \@interfaces_opts));
}
else {
- local $bmode = $_[2] eq 'detect' ? 2 :
- $_[2] eq '-' || $_[2] eq '' ? 1 : 0;
- print " $text{'interfaces_2'} \n";
- printf " %s\n",
- $bmode == 1 ? "checked" : "", $text{'list_none'};
- printf " %s\n",
- $bmode == 2 ? "checked" : "", $text{'list_auto'};
- printf " \n",
- $bmode == 0 ? "checked" : "";
- printf " \n",
- $bmode == 0 ? $_[2] : "";
+ my $bmode = $_[2] eq 'detect' ? 2 :
+ $_[2] eq '-' || $_[2] eq '' ? 1 : 0;
+ print &ui_table_row($text{'interfaces_2'},
+ &ui_radio("broad_mode", $bmode,
+ [ [ 1, $text{'list_none'} ],
+ [ 2, $text{'list_auto'} ],
+ [ 0, &ui_textbox("broad", $bmode == 0 ? $_[2] : "", 50) ] ]));
- local %opts = map { $_, 1 } split(/,/, $_[3]);
- print " $text{'interfaces_3'} \n";
- &options_input("opts", $_[3], \@interfaces_opts);
- print " \n";
+ print &ui_table_row($text{'interfaces_3'},
+ &options_input("opts", $_[3], \@interfaces_opts));
}
}
@@ -730,8 +713,8 @@ sub interfaces_validate
{
$in{'iface'} =~ /^[a-z]+\d*(s\d*)?(\.\d+)?$/ ||
$in{'iface'} =~ /^[a-z]+\+$/ || &error($text{'interfaces_eiface'});
-local @result = ( $in{'zone'}, $in{'iface'});
-if (not &new_interfaces_format()) {
+my @result = ( $in{'zone'}, $in{'iface'});
+if (!&new_interfaces_format()) {
$in{'broad_mode'} || $in{'broad'} =~ /^[0-9\.,]+$/ ||
&error($text{'interfaces_ebroad'});
push(@result, $in{'broad_mode'} == 2 ? 'detect' :
@@ -748,10 +731,9 @@ return &new_interfaces_format() ? 3 : 4;
sub interfaces_colnames
{
-local @result = (
- $text{'interfaces_0'},
- $text{'interfaces_1'} );
-if (not &new_interfaces_format()) {
+my @result = ( $text{'interfaces_0'},
+ $text{'interfaces_1'} );
+if (!&new_interfaces_format()) {
push(@result, $text{'interfaces_2'});
}
push(@result, $text{'interfaces_3'});
@@ -775,56 +757,26 @@ return ( $_[0] eq 'all' ? $text{'list_any'} :
sub policy_form
{
-local $found;
-
-print " $text{'policy_0'} \n";
-print "\n";
my $zf = &zone_field("source", $_[0], 0);
-print $zf;
-print " \n";
+print &ui_table_row($text{'policy_0'}, $zf);
-print "$text{'policy_1'} \n";
-print "\n";
$zf = &zone_field("dest", $_[1], 0);
-print $zf;
-print " \n";
+print &ui_table_row($text{'policy_1'}, $zf);
-print " $text{'policy_2'} \n";
-print "\n";
-$found = !$_[2];
-foreach $p (@policy_list) {
- printf "%s \n",
- $p, lc($p) eq lc($_[2]) ? "selected" : "", $p;
- $found++ if (lc($p) eq lc($_[2]));
- }
-print "$_[2] \n" if (!$found);
-print " \n";
+print &ui_table_row($text{'policy_2'},
+ &ui_select("policy", uc($_[2]), \@policy_list, 1, 0, 1));
-print "$text{'policy_3'} \n";
-print "\n";
-printf "%s \n",
- $_[3] eq '-' || !$_[3] ? "selected" : "", "<$text{'policy_nolog'}>";
-printf "%s \n",
- $_[3] eq 'ULOG' ? "selected" : "", "<$text{'policy_ulog'}>";
-$found = !$_[3] || $_[3] eq '-' || $_[3] eq 'ULOG';
-&foreign_require("syslog", "syslog-lib.pl");
-foreach $l (&syslog::list_priorities()) {
- printf "%s \n",
- $l, $_[3] eq $l ? "selected" : "", $l;
- $found++ if ($_[3] eq $l);
- }
-print "$_[3] \n" if (!$found);
-print " \n";
+&foreign_require("syslog");
+print &ui_table_row($text{'policy_3'},
+ &ui_select("log", $_[3] || '-',
+ [ [ '-', "<$text{'policy_nolog'}>" ],
+ [ 'ULOG', "<$text{'policy_ulog'}>" ],
+ &syslog::list_priorities() ], 1, 0, 1));
-local ($l, $b) = $_[4] =~ /(\d+):(\d+)/ ? ($1, $2) : ( );
-print " $text{'policy_4'} \n";
-printf " %s\n",
- $l eq '' ? "checked" : "", $text{'list_none'};
-printf " \n",
- $l eq '' ? "" : "checked";
-print &text('policy_limit',
- " ",
- " ")," \n";
+my ($l, $b) = $_[4] =~ /(\d+):(\d+)/ ? ($1, $2) : ( );
+print &ui_table_row($text{'policy_4'},
+ &ui_opt_textbox("limit", $l, 5, $text{'list_none'})." ".
+ &ui_textbox("burst", $b, 5));
}
sub policy_validate
@@ -1474,7 +1426,7 @@ print "