简体   繁体   English

扩展iptables内核模块

[英]extending iptables kernel modules

I want to write a kernel module that adds some features to linux iptables. 我想编写一个内核模块,为Linux iptables添加一些功能。 Before starting to code my own module, I want to do some tests and try to use some modules and try to add them to my freshly installed Ubuntu 15.5 machine. 在开始编写自己的模块之前,我想做一些测试,尝试使用一些模块,并将它们添加到我刚安装的Ubuntu 15.5计算机上。 It provides the libipt_xx.c , ipt_xx.c and ipt_xx.h, about which I read in some tutorial that they should past the file in that way: 它提供了libipt_xx.c,ipt_xx.c和ipt_xx.h,我在一些教程中了解到它们应该以这种方式越过文件:

ipt_xx.c   -> /usr/src/linux-headers-4.2.0-16/net/ipv4/netfilter/
ipt_xx.h   -> /usr/src/linux-headers-4.2.0-16/include/uapi/linux/netfilter_ipv4
libipt_xx.c   -> /usr/local/src/iptables-x.x.x/extensions/

But, I can't find the /usr/local/src/iptables-xxx/ directory. 但是,我找不到/ usr / local / src / iptables-xxx /目录。 When I execute iptables -V , I have iptables v1.4.21 as output, so it means I should have a folder like iptables-1.4.21. 当我执行iptables -V时,我将iptables v1.4.21作为输出,因此这意味着我应该拥有一个类似于iptables-1.4.21的文件夹。

Thanks for help. 感谢帮助。

Some of the files that you mention are part of the Linux kernel source. 您提到的某些文件是Linux内核源代码的一部分。 You get them when you download the Linux kernel source code from one of multiple places. 从多个位置之一下载Linux内核源代码时,就会得到它们。 These files are compiled into the kernel, either statically or in the form of modules. 这些文件可以静态或以模块形式编译到内核中。 These are the files located in: 这些是位于以下位置的文件:

net/ipv4/netfilter/
include/uapi/linux/netfilter_ipv4/

Other files are part of iptables source code which is a user space application. 其他文件是iptables源代码(属于用户空间应用程序)的一部分。 You can get the source code from Netfilter Git repository . 您可以从Netfilter Git存储库获取源代码。 These are the files located in: 这些是位于以下位置的文件:

iptables-x.x.x/extensions/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM