Skip to contentSkip to conversation

detecting if compiled or loaded modules

DISCUSSION 24 3 participants 4 messages Dec 15, 2002 1 message not in the archive netfilter

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 20021215053701.15581.32963.Mailman@kashyyyk

24

author
#1 lore raw

Greets,

Is there a way to determine if one of the Netfilter Configs is loaded as module or built-in in the
kernel? For example FTP protocol support. Once the system boots or the module is loaded shouldnt it create a file somewhere in /proc once the module is up or once the system boots. I'm trying to create a customized firewall program if it didnt detect the FTP protocol support it will load the module or what. Need help...

#2 lore raw

there are probably better and more efficient ways, but:

/proc/modules gives you the list of loaded modules

you can check if a module was built into the kernel by checking its functions in /boot/System.map
for istance:
cat /boot/System.map | grep hisax to check if hisax support was built into the kernel (that will give you the list of related functions).

in /lib/modules/kernelversion/modules.dep you'll find a list of compiled modules with their dependencies.

hope that this can be useful
andrea

Quoted 6 lines · 24 wrote:

Greets,

Is there a way to determine if one of the Netfilter Configs is loaded as module or built-in in the
kernel? For example FTP protocol support. Once the system boots or the module is loaded shouldnt it create a file somewhere in /proc once the module is up or once the system boots. I'm trying to create a customized firewall program if it didnt detect the FTP protocol support it will load the module or what. Need help...

author
#3 lore raw

Greets,

Useful indeed :) thanks! i just thought once the module is up or it's built in the kernel a file in /proc/sys/net/ipv4/* would appear but I think your suggestion would work thanks again

Quoted 15 lines · On Sun, 15 Dec 2002 09:59:39 +0100 Andrea Rossato…

there are probably better and more efficient ways, but:

/proc/modules gives you the list of loaded modules

you can check if a module was built into the kernel by checking its functions in /boot/System.map
for istance:
cat /boot/System.map | grep hisax to check if hisax support was built into the kernel (that will give you the list of related functions).

in /lib/modules/kernelversion/modules.dep you'll find a list of compiled modules with their dependencies.

hope that this can be useful
andrea

#4 lore raw
In reply to 24
Quoted 2 lines

Is there a way to determine if one of the Netfilter Configs is loaded as module or built-in in the kernel?

Have a look at /proc/ksyms. But that's not portable, probably not even to the future 2.6 kernel.

There is no other way. Normal, sane people don't need a GUI to load their modules. Their init scripts do it for them already. So, there is no pressing need, especially for an iptables specific solution.

The best you can probably do, is just try to load the module, and ignore the error case which says "already loaded". Talk to the insmod maintainers if you have trouble with detecting that error case properly.

best regards
Patrick

Signature · 1 line
Who runs GUI programs as root, anyway?