dsr-uu-0.2在linux2.6.32上编译问…

1、‘struct sk_buff’ has no member named ‘mac’
2.6.20内核以后的skbuff.h头文件中将struct sk_buff结构体修改了,h中包含有传输层的报文头,nh中包含有网络层的报文头,而mac中包含的是链路层的报文头。
linux-2.6.20以后的内核头文件sk_buff.h中这三个成员提取到单独的变量对应关系如下:
h-->transport_header;
nh-->network_header;
mac-->mac_header;

2、不能查找到 linux/config.h文件
Compiling for /home/dsr-uu-0.2
make -C /lib/modules/2.6.18-1.2798.fc6/build SUBDIRS=/home/dsr-uu-0.2 modules
make[1]: Entering directory `/usr/src/kernels/2.6.18-1.2798.fc6-i686'
  CC [M]  /home/dsr-uu-0.2/dsr-module.o
/home/dsr-uu-0.2/dsr-module.c:16:26: 错误:linux/config.h:没有那个文件或目录

make[2]: *** [/home/dsr-uu-0.2/dsr-module.o] 错误 1
make[1]: *** [_module_/home/dsr-uu-0.2] 错误 2
make[1]: Leaving directory `/usr/src/kernels/2.6.18-1.2798.fc6-i686'
make: *** [dsr.ko] 错误 2
解决方法;
我看的方法是从网上看到的看到的。呵呵
1)先把我实验正确的方法贴出:The file include/linux/config.h has been removed from 2.6.18 kernel. So remember this if you build your favorite module against the new 2.6.19 kernel and you get an error。 Thats because there is no more include/linux/config.h file in 2.6.19. This is from the Changelog:
Quote:

Author: Dave Jones <someone@someplace.com>
Date: Mon Oct 9 19:13:51 2006 -0400

[HEADERS] Put linux/config.h out of its misery.

Signed-off-by: Dave Jones <someone@someplace.com>



Author: Paul Mundt <nameremoved@a-linux-company.org>

Date: Tue Oct 3 13:19:02 2006 +0900

sh: Kill off remaining config.h references.


A few of these managed to sneak back in, get rid of them once

and for all.

解决方法:

The reason I posted this is for people who have the kernel sources installed and are trying to build a module against the sources and are getting the error I mentioned. You wouldn't be trying to build a module for the 2.6.19 kernel unless you had the sources installed.

Actually there is not much to the file:

Code:
#ifndef _LINUX_CONFIG_H

#define _LINUX_CONFIG_H




#include <linux/autoconf.h>




#endif



So if you have problems you could probably just add to code here to your module.c file.





我也就是和上面的一样,但是程序还是不认上面的补丁程序;所以,我亲自手动把所有包含config.h的源文件改成autoconf.h。这样就没有出错了。但是还有人说2.6.23后没有了autoconf.h了。那就需要再先看看下面的方法有用没?

2)well the .h files are not from the main kernel package ,they are from the devel package(unless you built it yourself)


if kernel-devel(or -source depending on distro) isn't installed there wouldn't be any useful includes.


3、关于NF_IP_PRE_ROUTING

问题:在内核编程中(2.6.25.17)中使用NF_IP_PRE_ROUTING,出现错误“'NF_IP_PRE_ROUTING' undeclared (first use in this function)”,而代码里面已经包含了netfilter_ipv4.h。

原因:在2.6.22以及以后的内核中,NF_IP_PRE_ROUTING以及NF_IP6_PRE_ROUTING都被放在了用户态,而在内核态编程必须统一使用NF_INET_PRE_ROUTING。
具体在netfilter_ipv4.h源代码中可以看到, NF_IP_PRE_ROUTING的定义被放在了#ifndef __KERNERL__下。

解决:NF_INET_PRE_ROUTING替代NF_IP_PRE_ROUTING

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值