Clean up handling of %detect_capability

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2010-01-28 16:39:45 -08:00
parent ecc7861115
commit b8ec2be516

View File

@ -195,10 +195,6 @@ our @propagateconfig = qw/ DISABLE_IPV6 MODULESDIR MODULE_SUFFIX LOAD_HELPERS_ON
#
our %capabilities;
#
# Detection functions
#
our %detect_capability;
#
# Capabilities
#
our %capdesc = ( NAT_ENABLED => 'NAT',
@ -2053,16 +2049,14 @@ sub determine_kernelversion() {
}
}
sub detect_capability( $ ) {
my $capability = shift;
$detect_capability{ $capability }->();
}
#
# Report the passed capability
#
sub detect_capability( $ );
sub have_capability( $ ) {
my $capability = shift;
our %detect_capability;
$capabilities{ $capability } = detect_capability( $capability ) unless defined $capabilities{ $capability };
@ -2312,17 +2306,7 @@ sub Logmark_Target() {
qt1( "$iptables -A $sillyname -j LOGMARK" );
}
#
# Determine which optional facilities are supported by iptables/netfilter
#
sub determine_capabilities( $ ) {
$iptables = $_[0];
my $pid = $$;
$sillyname = "fooX$pid";
$sillyname1 = "foo1X$pid";
%detect_capability =
our %detect_capability =
( NAT_ENABLED => \&Nat_Enabled,
MANGLE_ENABLED => \&Mangle_Enabled,
MULTIPORT => \&Multiport,
@ -2371,6 +2355,21 @@ sub determine_capabilities( $ ) {
OLD_HL_MATCH => \&Old_Hashlimit_Match,
);
sub detect_capability( $ ) {
my $capability = shift;
$detect_capability{ $capability }->();
}
#
# Determine which optional facilities are supported by iptables/netfilter
#
sub determine_capabilities( $ ) {
$iptables = $_[0];
my $pid = $$;
$sillyname = "fooX$pid";
$sillyname1 = "foo1X$pid";
qt1( "$iptables -N $sillyname" );
qt1( "$iptables -N $sillyname1" );
@ -2667,7 +2666,9 @@ sub get_configuration( $ ) {
unshift @INC, @config_path;
default 'PATH' , '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin';
#
# get_capabilities requires that the true settings of these options be established
#
default 'MODULE_PREFIX', 'o gz ko o.gz ko.gz';
default_yes_no 'LOAD_HELPERS_ONLY' , '';