|
请解释一下这个赋值语句?多谢!
static int check_tcp_packet(struct sk_buff *skb)
{
struct tcphdr *thead;
......
//----------------------------------------------------------
thead = (struct tcphdr *)(skb->data +
(skb->nh.iph->ihl * 4));
//---------------------------------------------------------
/* Now check the destination port */
if ((thead->dest) == *(unsigned short *)deny_port)
{
return NF_DROP;
}
return NF_ACCEPT;
}
skb->data +(skb->nh.iph->ihl * 4)
是什么意思啊?
不明白的地方是:
1。为什么要加上skb->data这个偏移量?
2。下面的结构前几句的#define语句看不懂(我知道大小ENDIAN的区别,但觉得ihl:4这种写法实在晦涩难懂,它的作用?)
struct iphdr {
#if defined(__LITTLE_ENDIAN_BITFIELD)
__u8 ihl:4,
version:4;
#elif defined (__BIG_ENDIAN_BITFIELD)
__u8 version:4,
ihl:4;
#else
#error "lease fix <asm/byteorder.h>"
#endif
__u8 tos;
__u16 tot_len;
__u16 id;
__u16 frag_off;
__u8 ttl;
__u8 protocol;
__u16 check;
__u32 saddr;
__u32 daddr;
/*The options start here. */
}; |
|