nat类型检测工具 linux,[12/8更新]OpenWrt 上实现 NAT1 (Full cone NAT) 的方法,无需 DMZ/UPnP...

这篇博客详细记录了在编译Linux内核模块xt_FULLCONENAT时遇到的警告和错误,包括const指针类型匹配问题以及nf_conntrack_event_notifier结构体使用错误。作者在检查代码和调用nf_conntrack_register_notifier及unregister_notifier函数时遇到了问题,导致编译失败。博客深入探讨了这些问题的原因和可能的解决策略。
摘要由CSDN通过智能技术生成

CC [M]  net/netfilter/xt_FULLCONENAT.o

net/netfilter/xt_FULLCONENAT.c: In function 'xt_in':

net/netfilter/xt_FULLCONENAT.c:39:13: warning: return discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]

return par->in;

~~~^~~~

net/netfilter/xt_FULLCONENAT.c: In function 'xt_out':

net/netfilter/xt_FULLCONENAT.c:43:13: warning: return discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]

return par->out;

~~~^~~~~

net/netfilter/xt_FULLCONENAT.c: In function 'fullconenat_tg_check':

net/netfilter/xt_FULLCONENAT.c:617:22: error: invalid use of undefined type 'struct nf_ct_event_notifier'

ct_event_notifier.fcn = ct_event_cb;

^

net/netfilter/xt_FULLCONENAT.c:619:50: error: passing argument 2 of 'nf_conntrack_register_notifier' from incompatible pointer type [-Werror=incompatible-pointer-types]

if (nf_conntrack_register_notifier(par->net, &ct_event_notifier) == 0) {

^

In file included from ./include/net/netfilter/nf_conntrack_core.h:18:0,

from net/netfilter/xt_FULLCONENAT.c:25:

./include/net/netfilter/nf_conntrack_ecache.h:74:12: note: expected 'struct notifier_block *' but argument is of type 'struct nf_ct_event_notifier *'

extern int nf_conntrack_register_notifier(struct net *net, struct notifier_block *nb);

^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

net/netfilter/xt_FULLCONENAT.c: In function 'fullconenat_tg_destroy':

net/netfilter/xt_FULLCONENAT.c:643:50: error: passing argument 2 of 'nf_conntrack_unregister_notifier' from incompatible pointer type [-Werror=incompatible-pointer-types]

nf_conntrack_unregister_notifier(par->net, &ct_event_notifier);

^

In file included from ./include/net/netfilter/nf_conntrack_core.h:18:0,

from net/netfilter/xt_FULLCONENAT.c:25:

./include/net/netfilter/nf_conntrack_ecache.h:75:12: note: expected 'struct notifier_block *' but argument is of type 'struct nf_ct_event_notifier *'

extern int nf_conntrack_unregister_notifier(struct net *net, struct notifier_block *nb);

^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

net/netfilter/xt_FULLCONENAT.c: At top level:

net/netfilter/xt_FULLCONENAT.c:81:29: error: storage size of 'ct_event_notifier' isn't known

struct nf_ct_event_notifier ct_event_notifier;

^~~~~~~~~~~~~~~~~

cc1: some warnings being treated as errors

scripts/Makefile.build:299: recipe for target 'net/netfilter/xt_FULLCONENAT.o' failed

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值