Results 1 to 4 of 4
hi ,everyone. Recently I have writen a kernel module in redhat 126.96.36.199. I register a new packet_type "test" in module_init(); in the test.func:test_rcv() function ,at last I have call ipv6_rcv() ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 05-31-2006 #1
- Join Date
- May 2006
Hi,how can I call the ipv6_rcv() function in my own kernel module.
in the test.func:test_rcv() function ,at last I have call ipv6_rcv() function to put the skb to ipv6 protocol.below is my module and funtion:
the directory is as below:
1.my test.c file is as below:
#include <net/ipv6.h> /*define the ipv6_rcv() prototype*/
#include "receive.c" /*test_rcv()*/
extern int test_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt );
//register a new packet_type for rohc
static struct packet_type test=
static int test_init(void)
printk("register a new network lay protocol for test");
static void test_exit(void)
printk("remove network lay protocol test");
2. my receive.c file is as below:
int test_rcv(struct sk_buff *skb,struct net_device *dev, struct packet_type *pt)
printk("we have receive a ipv6 packet\n" );
3. my receive.h file is as below:
int test_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt);
4. my Makefile file is as below:
obj-m := test.o
PWD := $(shell pwd)
KVER := $(shell uname -r)
KDIR := /lib/modules/$(KVER)/build
$(MAKE) -C $(KDIR) M=$(PWD) modules
rm -rf .*.cmd *.o *.mod.c *.ko .tmp_versions
when i was in test/src directory , i run make, but dont pass the compiler.the information is :
[y041138@302wan src]$ make
make -C /lib/modules/188.8.131.52/build M=/home/y041138/src modules
make: Entering directory `/usr/src/linux-184.108.40.206'
CC [M] /home/y041138/src/test.o
Building modules, stage 2.
*** Warning: "ipv6_rcv" [/home/y041138/src/test.ko] undefined!
LD [M] /home/y041138/src/test.ko
make: Leaving directory `/usr/src/linux-220.127.116.11'
the ipv6_rcv() function procotype is in /usr/src/linux-18.104.22.168/net/ipv6.h . I have include the ipv6.h file in test.c file.why can`t I use the ipv6_rcv() funtion?? can you help me?? now I was doing a software which I must put the "ipv6" skb to the ipv6 protocol when completed my own "test_rcv()" funtion; Do you have some idears that I can pass the ipv6 packet to the ipv6 protocol or ipv6_rcv function after completed my funtion test_rcv()??
can you give me your help and modify the test(test.c Makefile receive.c receive.h) file correctly that can pass the compiler and implement the function??
At last thank you very much!
- 05-31-2006 #2
It's not a compilation problem but a linking one...
You included the needed file, but kernel modules are linked only against kernel.
Make a grep ipv6_rcv /boot/System.map to know if the symbol that you need is declared and exported.
- 06-01-2006 #3
Originally Posted by fernape
- Join Date
- May 2006
c03beb90 T ipv6_rcv
c03c0a19 T ipv6_rcv_saddr_equal
- 06-01-2006 #4
If it is exported, you should declare it as "extern" in order to use it.