From d5af9c360de6013f0224a05a200e0de08378ae26 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Tue, 21 Feb 2012 11:23:58 -0800 Subject: [PATCH] Implement FORMAT-2 interfaces file. Signed-off-by: Tom Eastep --- Shorewall/Perl/Shorewall/Zones.pm | 22 ++++++++++++++++++++-- Shorewall/configfiles/interfaces | 4 ++++ Shorewall6/configfiles/interfaces | 4 ++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Zones.pm b/Shorewall/Perl/Shorewall/Zones.pm index c01c2c70f..e73490f96 100644 --- a/Shorewall/Perl/Shorewall/Zones.pm +++ b/Shorewall/Perl/Shorewall/Zones.pm @@ -912,10 +912,27 @@ sub process_interface( $$ ) { my ( $nextinum, $export ) = @_; my $netsref = ''; my $filterref = []; - my ($zone, $originalinterface, $bcasts, $options ) = split_line 'interfaces file', { zone => 0, interface => 1, broadcast => 2, options => 3 }; + my ($zone, $originalinterface, $bcasts, $options ); my $zoneref; my $bridge = ''; + our $format; + if ( $format == 1 ) { + ($zone, $originalinterface, $bcasts, $options ) = split_line1 'interfaces file', { zone => 0, interface => 1, broadcast => 2, options => 3 }, { COMMENT => 0, FORMAT => 2 }; + } else { + ($zone, $originalinterface, $options ) = split_line1 'interfaces file', { zone => 0, interface => 1, options => 2 }, { COMMENT => 0, FORMAT => 2 }; + $bcasts = '-'; + } + + if ( $zone eq 'FORMAT' ) { + if ( $originalinterface =~ /^[12]$/ ) { + $format = $1; + return; + } + + fatal_error "Invalid FORMAT ($1)"; + } + if ( $zone eq '-' ) { $zone = ''; } else { @@ -1185,7 +1202,8 @@ sub process_interface( $$ ) { # Parse the interfaces file. # sub validate_interfaces_file( $ ) { - my $export = shift; + my $export = shift; + our $format = 1; my @ifaces; my $nextinum = 1; diff --git a/Shorewall/configfiles/interfaces b/Shorewall/configfiles/interfaces index b13a6a6e6..935f9a5ef 100644 --- a/Shorewall/configfiles/interfaces +++ b/Shorewall/configfiles/interfaces @@ -7,4 +7,8 @@ # http://www.shorewall.net/manpages/shorewall-interfaces.html # ############################################################################### +FORMAT 1 #ZONE INTERFACE BROADCAST OPTIONS + +FORMAT 2 +#ZONE INTERFACE OPTIONS diff --git a/Shorewall6/configfiles/interfaces b/Shorewall6/configfiles/interfaces index 9f2357a5b..662844c3f 100644 --- a/Shorewall6/configfiles/interfaces +++ b/Shorewall6/configfiles/interfaces @@ -7,4 +7,8 @@ # http://www.shorewall.net/manpages6/shorewall6-interfaces.html # ############################################################################### +FORMAT 1 #ZONE INTERFACE ANYCAST OPTIONS + +FORMAT 2 +#ZONE INTERFACE OPTIONS