From 1da6d51d1aa06b569bc1ec58951487360fa1c7b5 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Mon, 30 Aug 2010 16:43:30 -0700 Subject: [PATCH] Reduce the Beta3 patch footprint by making the second arg to known_interface() optional --- Shorewall/Perl/Shorewall/Chains.pm | 8 ++++---- Shorewall/Perl/Shorewall/Nat.pm | 6 +++--- Shorewall/Perl/Shorewall/Rules.pm | 6 +++--- Shorewall/Perl/Shorewall/Zones.pm | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Chains.pm b/Shorewall/Perl/Shorewall/Chains.pm index 19b675bd2..c69a9bf6c 100644 --- a/Shorewall/Perl/Shorewall/Chains.pm +++ b/Shorewall/Perl/Shorewall/Chains.pm @@ -2437,7 +2437,7 @@ sub do_length( $ ) { # sub match_source_dev( $ ) { my $interface = shift; - my $interfaceref = known_interface( $interface, 0 ); + my $interfaceref = known_interface( $interface ); $interface = $interfaceref->{physical} if $interfaceref; return '' if $interface eq '+'; if ( $interfaceref && $interfaceref->{options}{port} ) { @@ -2452,7 +2452,7 @@ sub match_source_dev( $ ) { # sub match_dest_dev( $ ) { my $interface = shift; - my $interfaceref = known_interface( $interface, 0 ); + my $interfaceref = known_interface( $interface ); $interface = $interfaceref->{physical} if $interfaceref; return '' if $interface eq '+'; if ( $interfaceref && $interfaceref->{options}{port} ) { @@ -3251,7 +3251,7 @@ sub expand_rule( $$$$$$$$$$;$ ) # Verify Interface, if any # if ( $iiface ) { - fatal_error "Unknown Interface ($iiface)" unless known_interface( $iiface, 0 ); + fatal_error "Unknown Interface ($iiface)" unless known_interface $iiface; if ( $restriction & POSTROUTE_RESTRICT ) { # @@ -3341,7 +3341,7 @@ sub expand_rule( $$$$$$$$$$;$ ) # Verify Destination Interface, if any # if ( $diface ) { - fatal_error "Unknown Interface ($diface)" unless known_interface( $diface, 0 ); + fatal_error "Unknown Interface ($diface)" unless known_interface $diface; if ( $restriction & PREROUTE_RESTRICT ) { # diff --git a/Shorewall/Perl/Shorewall/Nat.pm b/Shorewall/Perl/Shorewall/Nat.pm index fdfcc51b4..b73dc3be7 100644 --- a/Shorewall/Perl/Shorewall/Nat.pm +++ b/Shorewall/Perl/Shorewall/Nat.pm @@ -142,7 +142,7 @@ sub process_one_masq( ) $rule .= "-m realm --realm $realm "; } - fatal_error "Unknown interface ($interface)" unless my $interfaceref = known_interface( $interface, 0 ); + fatal_error "Unknown interface ($interface)" unless my $interfaceref = known_interface( $interface ); unless ( $interfaceref->{root} ) { $rule .= match_dest_dev( $interface ); @@ -314,7 +314,7 @@ sub do_one_nat( $$$$$ ) my $rulein = ''; my $ruleout = ''; - fatal_error "Unknown interface ($interface)" unless my $interfaceref = known_interface( $interface, 0 ); + fatal_error "Unknown interface ($interface)" unless my $interfaceref = known_interface( $interface ); unless ( $interfaceref->{root} ) { $rulein = match_source_dev $interface; @@ -408,7 +408,7 @@ sub setup_netmap() { my $ruleout = ''; my $iface = $interface; - fatal_error "Unknown interface ($interface)" unless my $interfaceref = known_interface( $interface, 0 ); + fatal_error "Unknown interface ($interface)" unless my $interfaceref = known_interface( $interface ); unless ( $interfaceref->{root} ) { $rulein = match_source_dev( $interface ); diff --git a/Shorewall/Perl/Shorewall/Rules.pm b/Shorewall/Perl/Shorewall/Rules.pm index 45d2bf37a..566960aa7 100644 --- a/Shorewall/Perl/Shorewall/Rules.pm +++ b/Shorewall/Perl/Shorewall/Rules.pm @@ -177,7 +177,7 @@ sub setup_ecn() my ($interface, $hosts ) = split_line 1, 2, 'ecn file entry'; - fatal_error "Unknown interface ($interface)" unless known_interface( $interface, 0 ); + fatal_error "Unknown interface ($interface)" unless known_interface( $interface ); $interfaces{$interface} = 1; @@ -328,7 +328,7 @@ sub process_routestopped() { my $interfaceref; - fatal_error "Unknown interface ($interface)" unless $interfaceref = known_interface( $interface, 0 ); + fatal_error "Unknown interface ($interface)" unless $interfaceref = known_interface( $interface ); $hosts = ALLIP unless $hosts && $hosts ne '-'; my $routeback = 0; @@ -769,7 +769,7 @@ sub setup_mac_lists( $ ) { my $targetref = $maclist_targets{$disposition}; fatal_error "Invalid DISPOSITION ($original_disposition)" if ! $targetref || ( ( $table eq 'mangle' ) && ! $targetref->{mangle} ); - fatal_error "Unknown Interface ($interface)" unless known_interface( $interface, 0 ); + fatal_error "Unknown Interface ($interface)" unless known_interface $interface; fatal_error "No hosts on $interface have the maclist option specified" unless $maclist_interfaces{$interface}; my $chainref = $chain_table{$table}{( $ttl ? macrecent_target $interface : mac_chain $interface )}; diff --git a/Shorewall/Perl/Shorewall/Zones.pm b/Shorewall/Perl/Shorewall/Zones.pm index 8296d46ee..0f8216756 100644 --- a/Shorewall/Perl/Shorewall/Zones.pm +++ b/Shorewall/Perl/Shorewall/Zones.pm @@ -1155,7 +1155,7 @@ sub map_physical( $$ ) { # If the passed name matches a wildcard and 'cache' is true, an entry for the name is added in # %interfaces. # -sub known_interface($$) +sub known_interface($;$) { my ( $interface, $cache ) = @_; my $interfaceref = $interfaces{$interface}; @@ -1230,7 +1230,7 @@ sub get_physical( $ ) { # sub physical_name( $ ) { my $device = shift; - my $devref = known_interface( $device, 0 ); + my $devref = known_interface $device; $devref ? $devref->{physical} : $device; }