Jamie Cameron
2012-07-03 16:25:08 -07:00
parent d71b167afa
commit 14ff3ce293
4 changed files with 82 additions and 1 deletions

View File

@@ -41,3 +41,5 @@ Blacklist rules can now match any host.
Added a button to create a shorewall dump, thanks to a patch by Paul Gear.
---- Changes since 1.500 ----
New rules are added after the SECTION NEW line, if there is one.
---- Changes since 1.590 ----
Added a new page for editing routing rules.

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 B

View File

@@ -368,6 +368,33 @@ providers_enumber=Missing or invalid provider number
providers_emark=Missing or invalid provider mark number
providers_edup=Missing provider to duplicate
providers_egateway=Missing or invalid gateway
providers_return=list of routing providers
route_rules_title=Routing Rules
route_rules_desc=The page controls which traffic is routed to the providers defined on the Additional Routing Providers page.
route_rules_ip=IP address, network or interface
route_rules_add=Add a new routing rule.
route_rules_none=No routing rules have been defined yet.
route_rules_0=Traffic source
route_rules_1=Traffic destination
route_rules_2=Provider
route_rules_3=Priority
route_rules_4=Mark
route_rules_header=Routing rule options
route_rules_src=Traffic source
route_rules_dst=Traffic destination
route_rules_prov=Route via provider
route_rules_main=Default routing table
route_rules_pri=Rule priority
route_rules_mark=Mark packet with
route_rules_nomark=Nothing
route_rules_esrc=Missing traffic source
route_rules_edst=Missing traffic destination
route_rules_epri=Rule priority must be a number
route_rules_emark=Packet mark must be in number or number/mask format
route_rules_return=list of routing rules
route_rules_edit=Edit Routing Rule
route_rules_create=Create Routing Rule
manual_desc=This form can be used to manually edit the Shorewall file $1. Be careful, as no syntax checking will be done on the changes.
manual_reset=Undo

View File

@@ -19,7 +19,8 @@ $shorewall_version = &get_shorewall_version(0);
@shorewall_files = ( 'zones', 'interfaces', 'policy', 'rules', 'tos',
'masq', 'nat', 'proxyarp', 'routestopped',
'tunnels', 'hosts', 'blacklist',
( &version_atleast(2, 3) ? ( 'providers' ) : ( ) ),
( &version_atleast(2, 3) ? ( 'providers', 'route_rules' )
: ( ) ),
'params', 'shorewall.conf',
);
@comment_tables = ( 'masq', 'nat', 'rules', 'tcrules' );
@@ -1684,6 +1685,57 @@ return ( $in{'name'}, $in{'number'}, $in{'mark'},
$in{'copy'} || "-" );
}
############################## route_rules ################################
sub route_rules_row
{
return ( $_[0] eq "-" ? $text{'list_any'} : $_[0],
$_[1] eq "-" ? $text{'list_any'} : $_[1],
$_[2], $_[3], $_[4] );
}
sub route_rules_form
{
print "<tr> <td><b>$text{'route_rules_src'}</b></td>\n";
print "<td>",&ui_opt_textbox("src", $_[0] eq "-" ? "" : $_[0],
20, $text{'list_any'}, $text{'route_rules_ip'}),
"</td> </tr>\n";
print "<tr> <td><b>$text{'route_rules_dst'}</b></td>\n";
print "<td>",&ui_opt_textbox("dst", $_[1] eq "-" ? "" : $_[1],
20, $text{'list_any'}, $text{'route_rules_ip'}),
"</td> </tr>\n";
local @ptable = &read_table_file("providers", \&standard_parser);
print "<tr> <td><b>$text{'route_rules_prov'}</b></td>\n";
print "<td>",&ui_select("prov", $_[2] eq "254" ? "main" : $_[2],
[ [ "main", $text{'route_rules_main'} ],
map { $_->[0] } @ptable ]),"</td> </tr>\n";
print "<tr> <td><b>$text{'route_rules_pri'}</b></td>\n";
print "<td>",&ui_textbox("pri", $_[3], 10),"</td> </tr>\n";
print "<tr> <td><b>$text{'route_rules_mark'}</b></td>\n";
print "<td>",&ui_opt_textbox("mark", $_[4] eq "-" ? $_[4] : "", 10,
$text{'route_rules_nomark'}),"</td> </tr>\n";
}
sub route_rules_validate
{
$in{'src_def'} || $in{'src'} =~ /^\S+$/ || &error($text{'route_rules_esrc'});
$in{'dst_def'} || $in{'dst'} =~ /^\S+$/ || &error($text{'route_rules_edst'});
$in{'pri'} =~ /^\d+$/ || &error($text{'route_rules_epri'});
$in{'mark_def'} || $in{'mark'} =~ /^\d+(\/\d+)?$/ ||
&error($text{'route_rules_emark'});
return ( $in{'src_def'} ? "-" : $in{'src'},
$in{'dst_def'} ? "-" : $in{'dst'},
$in{'prov'},
$in{'pri'},
$in{'mark_def'} ? ( ) : ( $in{'mark'} ) );
}
################################ shorewall.conf ##################################
sub conf_form