Skip to contentSkip to conversation

About loadable kernel modules

DISCUSSION Alexandros Fragkiadakis 3 participants 3 messages Oct 2, 2002 – Oct 8, 2002

lore
Share & tools
lore
#0 lore raw

Hi all,

Well, i have written a (netfilter) loadable kernel module for filtering various packets. I pass these packets from kernel space to user space using libipq.
I also have a user process thas loads and unloads this loadable kernel module using the commands:
system("insmod kernel_module.o")
system("rmmod kernel_module") respectively.

I'd like to pass parameters to the loadable module, hence having a more flexible user process.
So, instead of using the command system("insmod kernel_module.o"),
i'd like to use: system("insmod kernel_module.o <param1> <param2>...<param n>") , hence passing command line parameters to my loadable module.

Do you know if it is possible?

Thanks

#1 lore raw

Hello,

Quoted 4 lines

I also have a user process thas loads and unloads this loadable kernel
module using the commands:
system("insmod kernel_module.o")
system("rmmod kernel_module") respectively.

Ok.

Quoted 7 lines

I'd like to pass parameters to the loadable module, hence having a more
flexible user process.
So, instead of using the command /system("insmod kernel_module.o"),/
i'd like to use: /system("insmod kernel_module.o <param1> <param2>...<param n>")/ , hence passing command line parameters to my loadable module.

Do you know if it is possible?

You definitely want the know about the MODULE_PARM() macro. Get more information by reading an existing module like for example:

grep ^MODULE_ /usr/src/linux/drivers/net/3c59x.c

Best regards,
Roberto Nibali, ratz

Signature · 1 line
echo '[q]sa[ln0=aln256%Pln256/snlbx]sb3135071790101768542287578439snlbxq' | dc
#2 lore raw
In reply to Alexandros Fragkiadakis
Quoted 8 lines · Alexandros Fragkiadakis

Hi all,

Well, i have written a (netfilter) loadable kernel module for filtering various packets. I pass these packets from kernel space to user space using libipq. I also have a user process thas loads and unloads this loadable kernel module using the commands: system("insmod kernel_module.o") system("rmmod kernel_module") respectively.

Quoted 5 lines

I'd like to pass parameters to the loadable module, hence having a more
flexible user process. So, instead of using the command system("insmod kernel_module.o"), i'd like to use: system("insmod kernel_module.o <param1> <param2>...<param n>") , hence passing command line parameters to my loadable module.

Probably execl(*command,*arg1,*arg2,*arg3...,null) will do what you want.

j