- 论坛徽章:
- 0
|
请高手解答下面的代码是什么意思?从ipp2p源代码里面提取出来的。这行代码是要匹配什么样的网络封包?封包的原数据是怎么样的?
先谢过了。
#if defined(MODVERSIONS)
#include <linux/modversions.h>
#endif
#include <linux/module.h>
#include <linux/version.h>
#include "ipt_ipp2p.h"
#include <net/tcp.h>
#include <net/udp.h>
#define get_u8(X,O) (*(__u8 *)(X + O))
#define get_u16(X,O) (*(__u16 *)(X + O))
#define get_u32(X,O) (*(__u32 *)(X + O))
。。。。。。。。
/* feidian */
if ( (plen == 4 && get_u32(payload,0) == __constant_htonl(0x291c3201)) || (plen == 61 && get_u32(payload,0) == __constant_htonl(0x291c3201) && get_u32(payload,4) == __constant_htonl(0x39000000))) return (IPP2P_PP * 100 + 7);
。。。。。。。
另:用ethereal抓取的封包,应该这样去寻找上面代码预过滤的封包?
plen==4是指数据包长?数据包头长?
__constant_htonl(0x291c3201)的结果是“01321C29” ?
get_u32()和get_u16()是什么意思?
[ 本帖最后由 cuplin2002 于 2008-5-21 16:20 编辑 ] |
|