Help needed in compling a kernel program :((

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux