Discussion:
[Shorewall-users] Possible bug/change in behaviour with INLINE perl
Ed W
2016-09-12 11:17:40 UTC
Permalink
Hi, ref the docs here:

http://shorewall.net/configuration_file_basics.htm#Embedded

I expect to be able to slap in an INLINE perl script into the accounting
file with:

?BEGIN PERL
my $i_count = 1;
foreach my $iface (qw/lan1 lan2 lan3 lan4/) {
# rules: ACTION CHAIN SOURCE DESTINATION
shorewall("acct_in_$i_count - $iface -");
$i_count++;
}
1;
?END


However, this gives an error

Compiling /etc/shorewall/accounting...
ERROR: Undefined subroutine &Shorewall::User::shorewall called at
/etc/shorewall/accounting line 21.


Adding "use Shorewall::Config;" resolves this


This code worked in some previous 4.6.13.4. Was it supposed to? The
docs imply that the inline script should be autowrapped with a "use
Shorewall::Config;" - this would certainly save a little typing?

Note sure if this is a change of behaviour or bug?

Thanks

Ed W


------------------------------------------------------------------------------
Ed W
2016-09-12 12:01:27 UTC
Permalink
Grr... Cut and paste error. Meant to add this is with version 5.0.10
Post by Ed W
http://shorewall.net/configuration_file_basics.htm#Embedded
I expect to be able to slap in an INLINE perl script into the accounting
?BEGIN PERL
my $i_count = 1;
foreach my $iface (qw/lan1 lan2 lan3 lan4/) {
# rules: ACTION CHAIN SOURCE DESTINATION
shorewall("acct_in_$i_count - $iface -");
$i_count++;
}
1;
?END
However, this gives an error
Compiling /etc/shorewall/accounting...
ERROR: Undefined subroutine &Shorewall::User::shorewall called at
/etc/shorewall/accounting line 21.
Adding "use Shorewall::Config;" resolves this
This code worked in some previous 4.6.13.4. Was it supposed to? The
docs imply that the inline script should be autowrapped with a "use
Shorewall::Config;" - this would certainly save a little typing?
Note sure if this is a change of behaviour or bug?
Thanks
Ed W
------------------------------------------------------------------------------
_______________________________________________
Shorewall-users mailing list
https://lists.sourceforge.net/lists/listinfo/shorewall-users
------------------------------------------------------------------------------
Tom Eastep
2016-09-12 16:13:32 UTC
Permalink
Post by Ed W
Grr... Cut and paste error. Meant to add this is with version
5.0.10
Post by Ed W
http://shorewall.net/configuration_file_basics.htm#Embedded
I expect to be able to slap in an INLINE perl script into the
?BEGIN PERL my $i_count = 1; foreach my $iface (qw/lan1 lan2 lan3
lan4/) { # rules: ACTION CHAIN SOURCE
DESTINATION shorewall("acct_in_$i_count - $iface -");
$i_count++; } 1; ?END
However, this gives an error
Compiling /etc/shorewall/accounting... ERROR: Undefined
subroutine &Shorewall::User::shorewall called at
/etc/shorewall/accounting line 21.
Adding "use Shorewall::Config;" resolves this
This code worked in some previous 4.6.13.4. Was it supposed to?
The docs imply that the inline script should be autowrapped with
a "use Shorewall::Config;" - this would certainly save a little
typing?
Note sure if this is a change of behaviour or bug?
It's a bug introduced in 5.0.7 :-(

Patch attached.

- -Tom
- --
Tom Eastep \ When I die, I want to go like my Grandfather who
Shoreline, \ died peacefully in his sleep. Not screaming like
Washington, USA \ all of the passengers in his car
http://shorewall.net \________________________________________________
Loading...