免费注册 查看新帖 |

Chinaunix

广告
  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1876 | 回复: 9
打印 上一主题 下一主题

添加模块后编译出错 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-06-04 12:10 |只看该作者 |倒序浏览
添加模块time后,编译就会有如下错误:
net/ipv4/netfilter/ipt_time.c:128: warning: initialization makes integer from pointer without a cast
net/ipv4/netfilter/ipt_time.c:128: error: initializer element is not computable at load time
net/ipv4/netfilter/ipt_time.c:128: error: (near initialization for `time_match.revision')
net/ipv4/netfilter/ipt_time.c:128: warning: initialization from incompatible pointer type
net/ipv4/netfilter/ipt_time.c:128: warning: initialization from incompatible pointer type
make[3]: *** [net/ipv4/netfilter/ipt_time.o] 错误 1
make[2]: *** [net/ipv4/netfilter] 错误 2
make[1]: *** [net/ipv4] 错误 2
make: *** [net] 错误 2
我编译了2.6.13和2.6.15都是这样.

论坛徽章:
0
2 [报告]
发表于 2006-06-04 14:23 |只看该作者
贴出 ipt_time.c 中 128 行前后的内容看一下

论坛徽章:
0
3 [报告]
发表于 2006-06-04 15:39 |只看该作者
static struct ipt_match time_match
= { { NULL, NULL }, "time", &match, &checkentry, NULL, THIS_MODULE };

static int __init init(void)
{
        printk("ipt_time loading\n");
        return ipt_register_match(&time_match);
}

static void __exit fini(void)
{
        ipt_unregister_match(&time_match);
        printk("ipt_time unloaded\n");
}

论坛徽章:
0
4 [报告]
发表于 2006-06-04 16:49 |只看该作者

  1. static struct ipt_match time_match
  2. = { { NULL, NULL }, "time", &match, &checkentry, NULL, THIS_MODULE };
复制代码

这是 2.4 内核的标准,2.6 内核的注册方式不是这样的
换成下面的内容试试

  1. static struct ipt_match time_match = {
  2.     .name       = "time",
  3.     .match      = &match,
  4.     .checkentry = &checkentry,
  5.     .me         = THIS_MODULE
  6. };
复制代码

若方便起见,可以加个判断,在编译的时候自动选择所需代码

  1. static struct ipt_match time_match = {
  2. #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
  3.         { NULL, NULL },
  4.         "time",
  5.         &match,
  6.         &checkentry,
  7.         NULL,
  8.         THIS_MODULE
  9. #else
  10.         .name           = "time",
  11.         .match          = &match,
  12.         .checkentry     = &checkentry,
  13.         .me             = THIS_MODULE
  14. #endif
  15. };
复制代码

[ 本帖最后由 platinum 于 2006-6-4 17:23 编辑 ]

论坛徽章:
0
5 [报告]
发表于 2006-06-05 10:16 |只看该作者
可是我很奇怪.我是下载的patch-o-matic-ng 为什么里面的ipp2p可以编译而time不能呢?

论坛徽章:
0
6 [报告]
发表于 2006-06-05 10:31 |只看该作者
原帖由 ellyzyl 于 2006-6-5 10:16 发表
可是我很奇怪.我是下载的patch-o-matic-ng 为什么里面的ipp2p可以编译而time不能呢?

有可能 patch-o-matic-ng 的版本你没选对
有可能 patch-o-matic-ng 有 BUG
你的问题解决没有?

论坛徽章:
0
7 [报告]
发表于 2006-06-05 10:59 |只看该作者
就是添加了IPP2P 但没法添加TIME
添加进去的IPP2P还有layer7都没法用
[root@localhost ~]# service iptables restart
清除防火墙规则:                                           [  确定  ]
把 chains 设置为 ACCEPT 策略:filter mangle nat            [  确定  ]
正在卸载 Iiptables 模块:                                  [  确定  ]
应用 iptables 防火墙规则:iptables-restore v1.3.3: Couldn't load match `ipp2p':/usr/local/lib/iptables/libipt_ipp2p.so: cannot open shared object file: No such file or directory

Error occurred at line: 23
Try `iptables-restore -h' or 'iptables-restore --help' for more information.
                                                           [失败]
应该是在/lib/iptables下面才对.为什么会是在/usr/local/lib/iptables下?这是iptables有问题吗?

论坛徽章:
0
8 [报告]
发表于 2006-06-05 11:05 |只看该作者
是 iptables 的问题,编译安装的时候参数不对,没有指定路径

论坛徽章:
0
9 [报告]
发表于 2006-06-05 11:12 |只看该作者
make KERNEL_DIR=/usr/src/linux-2.6.13 IPTABLES_DIR=/usr/src/iptables-1.3.3
make BINDIR=/sbin LIBDIR=/lib MANDIR=/usr/share/man install
我是这样安装的呀?这个步骤不对吗?还有其实我不太明白第二个步骤的具体含义,望版主指点一下,谢谢!

论坛徽章:
0
10 [报告]
发表于 2006-06-05 11:33 |只看该作者
我又按照INSTALL重新安装现在可以了.谢谢
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP