Results 1 to 4 of 4
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 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/18.104.22.168/build M=/home/y041138/src modules
make: Entering directory `/usr/src/linux-22.214.171.124'
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-126.96.36.199'
the ipv6_rcv() function procotype is in /usr/src/linux-188.8.131.52/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!
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.
Originally Posted by fernape
- Join Date
- May 2006
c03beb90 T ipv6_rcv
c03c0a19 T ipv6_rcv_saddr_equal
If it is exported, you should declare it as "extern" in order to use it.