hi all
Firstly a little intro about myself.. I m as new
to the Linux kernel as one can be... So please bear
with my ignorance and help me out of my misery
:((
I have written the following code and frankly that
also
cut-paste :)) But still I am not able to compile
it.. i m
feeling embarrased.. its ok everyone has a bad
day....
is'nt it?
#define MODULE #include <linux/module.h> #include <linux/init.h> #include <linux/config.h> #include <linux/kernel.h> #include <asm/types.h> #include <linux/netfilter_ipv4.h> #include <linux/ip.h> #include <net/ip.h> #include <asm-i386/types.h>
static unsigned int stupid_hook(unsigned int hook, struct sk_buff **pskb, const struct net_device *indev, const struct net_device *outdev, int (*okfn) (struct sk_buff *)) { return NF_ACCEPT; } static struct nf_hooks_ops stupid_ops={{NULL, NULL}, stupid_hook, PF_INET, NF_IP_LOCAL_OUT, 0}; static int __init init(void) { nf_register_hook(&stupid_ops); return 0; } static void __exit fini(void) { printk("bye - bye.......... \n"); nf_unregister_hook(&stupid_ops); } module_init(init); module_exit(fini); But when I am trying to compile it with the
following flags:
gcc -c -I/usr/src/linux/include/ -Wall -DMODULE
-D__KERNEL__ -DLINUX file_name.c -o file_name.o
The error says:
stupid_ops has an initializer but incomplete type
and many more errors saying all sorts of things like extra brace
group
at end of initializer (despite the fact that I have counted the braces
atleast million number of times..)
So, have a look and if possible try it out and
extricate me out of my misery..
cheers :) tarun B |
**************************Disclaimer************************************************** Information contained in this E-MAIL being proprietary to Wipro Limited is 'privileged' and 'confidential' and intended for use only by the individual or entity to which it is addressed. You are notified that any use, copying or dissemination of the information contained in the E-MAIL in any manner whatsoever is strictly prohibited. ****************************************************************************************