易截截图软件、单文件、免安装、纯绿色、仅160KB

Linux netfilter源码分析(5)


五、 ipt_do_table()函数,数据包的过滤
 
5.1          ipt_entry 相关结构  ip_tables.h
ipt_entry结构前面有过了,再看一遍
struct ipt_entry
{
struct ipt_ip ip;
/* 所要匹配的报文的IP头信息 */
unsigned int nfcache;
/* 位向量,标示本规则关心报文的什么部分,暂未使用 */
u_int16_t target_offset;
/* target区的偏移,通常target区位于match区之后,而match区则在ipt_entry的末尾;
初始化为sizeof(struct ipt_entry),即假定没有match */
u_int16_t next_offset;
/* 下一条规则相对于本规则的偏移,也即本规则所用空间的总和,
初始化为sizeof(struct ipt_entry)+sizeof(struct ipt_target),即没有match */
unsigned int comefrom;
/* 位向量,标记调用本规则的HOOK号,可用于检查规则的有效性 */
struct ipt_counters counters;
/* 记录该规则处理过的报文数和报文总字节数 */
unsigned char elems[0];
/*target或者是match的起始位置 */
}
 
ipt_ip结构  ip_tables.h
struct ipt_ip {
      struct in_addr src, dst;         /* 来源/目的地址 */
      struct in_addr smsk, dmsk;     /* 来源/目的地址的掩码 */
 
      char iniface[IFNAMSIZ], outiface[IFNAMSIZ];    /*输入输出网络接口*/
      unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ];
 
      u_int16_t proto;    /* 协议, 0 = ANY */
     
      u_int8_t flags;      /* 标志字段 */
      u_int8_t invflags;    /* 取反标志 */
};
 
 
5.2  ipt_do_table函数   ip_tables.c
 
unsigned int
ipt_do_table(struct sk_buff **pskb,
           unsigned int hook,
           const struct net_device *in,
    &


相关文档:

Linux netfilter源码分析(2)

转贴自http://alexanderlaw.blog.hexun.com/8968771_d.html
二、ipt_table数据结构和表的初始化
 
2.1  include/linux/netfilter_ipv4/ip_tables.h   struct  ipt_table 表结构
struct ipt_table
{
struct list_head list;
/* 表链 */
char name[IPT_TABLE_MAXNAMELEN];
/* 表名,如"fil ......

[C++] Linux下的itoa函数

上篇文章说到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 ......

Linux netfilter源码分析(3)

转贴自:http://alexanderlaw.blog.hexun.com/8968782_d.html
三、ipt_table表的注册
 
init()函数初始化时调用了ipt_register_table函数进行表的注册
 
3.1  ip_tables.c 表的注册 ipt_register_table
int ipt_register_table(struct ipt_table *table)
{
       ......

linux mysql配置


卸载mysql
1、查找以前是否装有mysql
命令:rpm -qa|grep -i mysql
可以看到mysql的两个包:
mysql-4.1.12-3.RHEL4.1
mysqlclient10-3.23.58-4.RHEL4.1
2、删除mysql
删除命令:rpm -e --nodeps 包名
( rpm -ev mysql-4.1.12-3.RHEL4.1 )
3、删除老版本mysql的开发头文件和库
命令:rm -fr /usr/lib/mysql
r ......

编程获取linux的cpu占用率和mem和硬盘使用情况

linux下提供top、ps命令查看当前cpu、mem使用情况,简要介绍如下:
一、使用ps查看进程的资源占用
ps -aux查看进程信息时,第三列就是CPU占用。
[root@localhost utx86]# ps -aux | grep my_process
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.7/FAQ
root   14415  3.4 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号