From 5260b38113a441ee60319084baf4ba142196fe0a Mon Sep 17 00:00:00 2001 From: teastep Date: Fri, 8 Sep 2006 23:53:49 +0000 Subject: [PATCH] Restore proper module loading git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@4553 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall/lib.base | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/Shorewall/lib.base b/Shorewall/lib.base index a85563c5b..ed877f580 100644 --- a/Shorewall/lib.base +++ b/Shorewall/lib.base @@ -171,6 +171,41 @@ deleteallchains() { run_iptables -X } +# +# Load a Kernel Module -- assumes that the variable 'moduledirectories' contains +# a space-separated list of directories to search for +# the module and that 'moduleloader' contains the +# module loader command. +# +loadmodule() # $1 = module name, $2 - * arguments +{ + local modulename=$1 + local modulefile + local suffix + + if ! list_search $modulename $MODULES ; then + shift + + for suffix in $MODULE_SUFFIX ; do + for directory in $moduledirectories; do + modulefile=$directory/${modulename}.${suffix} + + if [ -f $modulefile ]; then + case $moduleloader in + insmod) + insmod $modulefile $* + ;; + *) + modprobe $modulename $* + ;; + esac + break 2 + fi + done + done + fi +} + # # Reload the Modules # @@ -454,7 +489,6 @@ ip_network() { # The following hack is supplied to compensate for the fact that many of # the popular light-weight Bourne shell derivatives don't support XOR ("^"). # - ip_broadcast() { local x=$(( 32 - ${1#*/} ))