sk_buff里的hdr_len和nohdr字段是什么意思
这两天看到组装ip分片的流程ip_frag_reasm->skb_morph->__skb_clone, __skb_clone里面有这么一句话n->hdr_len = skb->nohdr ? skb_headroom(skb) : skb->hdr_len
内核对这两个字段的解释是
@hdr_len: writable header length of cloned skb
@nohdr: Payload reference only, must not modify header
然后去搜了内核里引用他们的地方,也没看出个所以然来,网上的描述也语焉不详,不知道哪位可以解惑一下 /* We divide dataref into two halves.The higher 16 bits hold references
* to the payload part of skb->data.The lower 16 bits hold references to
* the entire skb->data.A clone of a headerless skb holds the length of
* the header in skb->hdr_len.
*
* All users must obey the rule that the skb->data reference count must be
* greater than or equal to the payload reference count.
*
* Holding a reference to the payload part means that the user does not
* care about modifications to the header part of skb->data.
*/
#define SKB_DATAREF_SHIFT 16
#define SKB_DATAREF_MASK ((1 << SKB_DATAREF_SHIFT) - 1) 这段描述我也看到过,但还是没有解释这个问题啊 给nohdr赋值(1)的函数只有skb_header_release,这个函数目前只有tcp相关的代码在用。
http://lxr.free-electrons.com/ident?i=__skb_header_release
所有这些调用后面都跟着一个往tcp_write_queue里插入的操作。
个人理解,所有queue里的skb共享五元组信息(因为都属于一个tcp连接),不同的是(7层)内容部分,
所以不关心header部分(3/4层)是如何修改的,满足nohdr的定义。
看起来这时候skb->data还指向layer 7,l3/l4层头还没有被构建?? 回复 4# nswcfd
又看了一遍代码,的确是这样的,谢谢
页:
[1]