mirror of
https://gitlab.com/shorewall/code.git
synced 2024-12-29 17:48:53 +01:00
New compiler can now load modules
git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@5796 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
parent
e69390370d
commit
40a270fcd0
@ -492,6 +492,64 @@ sub mywhich( $ ) {
|
||||
'';
|
||||
}
|
||||
|
||||
sub load_kernel_modules( ) {
|
||||
my $moduleloader = mywhich 'modprobe' ? 'modprobe' : 'insmod';
|
||||
|
||||
my $modulesdir = $config{MODULESDIR};
|
||||
|
||||
unless ( $modulesdir ) {
|
||||
my $uname = `uname -r`;
|
||||
fatal_error "The command 'uname -r' failed" unless $? == 0;
|
||||
chomp $uname;
|
||||
$modulesdir = "/lib/modules/$uname/kernel/net/ipv4/netfilter:/lib/modules/$uname/kernel/net/netfilter";
|
||||
}
|
||||
|
||||
my @moduledirectories = split /:/, $modulesdir;
|
||||
|
||||
if ( @moduledirectories && open_file 'modules' ) {
|
||||
my %loadedmodules;
|
||||
|
||||
progress_message "Loading Modules...";
|
||||
|
||||
open LSMOD , '-|', 'lsmod' or fatal_error "Can't run lsmod";
|
||||
|
||||
while ( $line = <LSMOD> ) {
|
||||
my $module = ( split( /\s+/, $line ) )[0];
|
||||
|
||||
unless ( $module eq 'Module' ) {
|
||||
$loadedmodules{$module} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
close LSMOD;
|
||||
|
||||
$config{MODULE_SUFFIX} = 'o gz ko o.gz ko.gz' unless $config{MODULES_SUFFIX};
|
||||
|
||||
my @suffixes = split /\s+/ , $config{MODULE_SUFFIX};
|
||||
|
||||
while ( read_a_line ) {
|
||||
fatal_error "Invalid modules file entry" unless ( $line =~ /^loadmodule\s+([a-zA-Z]\w*)\s*(.*)$/ );
|
||||
my ( $module, $arguments ) = ( $1, $2 );
|
||||
unless ( $loadedmodules{ $module } ) {
|
||||
for my $suffix ( @suffixes ) {
|
||||
for my $directory ( @moduledirectories ) {
|
||||
my $modulefile = "$directory/$module.$suffix";
|
||||
if ( -f $modulefile ) {
|
||||
if ( $moduleloader eq 'insmod' ) {
|
||||
system ("insmod $modulefile $arguments" );
|
||||
} else {
|
||||
system( "modprobe $module $arguments" );
|
||||
}
|
||||
|
||||
$loadedmodules{ $module } = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# Determine which optional facilities are supported by iptables/netfilter
|
||||
#
|
||||
@ -632,6 +690,8 @@ sub get_configuration( $ ) {
|
||||
} else {
|
||||
fatal_error "\$IPTABLES=$capabilities{IPTABLES} does not exist or is not executable" unless -x $capabilities{IPTABLES};
|
||||
}
|
||||
|
||||
load_kernel_modules;
|
||||
|
||||
unless ( open_file 'capabilities' ) {
|
||||
determine_capabilities;
|
||||
|
@ -31,7 +31,6 @@
|
||||
# EXPORT=Yes -e option specified to /sbin/shorewall
|
||||
# SHOREWALL_DIR A directory name was passed to /sbin/shorewall
|
||||
# VERBOSE Standard Shorewall verbosity control.
|
||||
# VERSION Shorewall Version
|
||||
# TIMESTAMP=Yes -t option specified to /sbin/shorewall
|
||||
# FW Firewall zone (for shell-variable expansion).
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user