Linux netfilter源码分析(7)
转贴自:http://alexanderlaw.blog.hexun.com/8968960_d.html
七、 target 匹配
7.1 ipt_target和ipt_entry_target结构 ip_tables.h
ipt_target和ipt_match结构类似:
struct ipt_target
{
struct list_head list;
const char name[IPT_FUNCTION_MAXNAMELEN];
/* 在使用本Match的规则注入表中之前调用,进行有效性检查,如果返回0,规则就不会加入iptables中 */
int (*checkentry)(const char *tablename,
const struct ipt_entry *e,
void *targinfo,
unsigned int targinfosize,
unsigned int hook_mask);
/* 在包含本Target的规则从表中删除时调用,与checkentry配合可用于动态内存分配和释放 */
void (*destroy)(void *targinfo, unsigned int targinfosize);
/* target的模块函数,如果需要继续处理则返回IPT_CONTINUE(-1),否则返回NF_ACCEPT、NF_DROP等值,它的调用者根据它的返回值来判断如何处理它处理过的报文*/
unsigned int (*target)(struct sk_buff **pskb,
const struct net_device *in,
const struct net_device *out,
unsigned int hooknum,
&n
相关文档:
一:前言
最近在研究android的sensor driver,主要是E-compass,其中用到了Linux input子系统.在网上也看了很多这方面的资料,感觉还是这篇分析的比较细致透彻,因此转载一下以便自己学习,同时和大家分享!
(这篇博客主要是以键盘驱动为例的,不过讲解的是Linux Input Subsystem,可以仔细的研究一下!)
键盘驱动将检 ......
上篇文章说到linux需要itoa函数,下面我就提供一份跨平台的itoa函数。
//return the length of result string. support only 10 radix for easy use and better performance
int my_itoa(int val, char* buf)
{
const int radix = 10;
char* p;
int a;&nbs ......
由于工作有需要和第三方MQ通信,因为以前没有整过MQ,所以对于我来说很陌生。在网上也查看了一些经验,再加上个人的实践,小总结如下:
MQ的安装包是ISO,所以需要将ISO文件mount到Linux的一个目录下面,具体操作如下:
假如你选定的mount目 ......
1.磁盘命令
mount 挂上文件系统
umount 卸下已挂上的文件系统
df   ......
五、 ipt_do_table()函数,数据包的过滤
5.1 ipt_entry 相关结构 ip_tables.h
ipt_entry结构前面有过了,再看一遍
struct ipt_entry
{
struct ipt_ip ip;
/* 所要匹配的报文的IP头信息 */
unsigned int nfcache;
/* 位向量,标示本规则关心 ......