- 論壇徽章:
- 0
|
本帖最后由 rainballdh 于 2010-12-02 13:11 編輯
- static struct sk_buff *ip_frag_reasm(struct ipq *qp, struct net_device *dev)
- {
- ...省略
- /* 頭部不能被克隆,因?yàn)橄旅鎸⒖赡軐?duì)其進(jìn)行修改. */
- if (skb_cloned(head) && pskb_expand_head(head, 0, 0, GFP_ATOMIC))
- goto out_nomem;
- /* If the first fragment is fragmented itself, we split
- * it to two chunks: the first with data and paged part
- * and the second, holding only fragments.
- */
- if (skb_shinfo(head)->frag_list) {
- struct sk_buff *clone;
- int i, plen = 0;
-
- if ((clone = alloc_skb(0, GFP_ATOMIC)) == NULL)
- goto out_nomem;
- clone->next = head->next;
- head->next = clone;
- /* clone指向frag_list */
- skb_shinfo(clone)->frag_list = skb_shinfo(head)->frag_list;
- skb_shinfo(head)->frag_list = NULL;
- for (i=0; i<skb_shinfo(head)->nr_frags; i++)
- plen += skb_shinfo(head)->frags[i].size;
- clone->len = clone->data_len = head->data_len - plen;
- head->data_len -= clone->len;
- head->len -= clone->len;
- clone->csum = 0;
- clone->ip_summed = head->ip_summed;
- atomic_add(clone->truesize, &ip_frag_mem);
- }
- ...省略
- }
復(fù)制代碼 代碼部分我理解的是如果head存在從屬的skbuff即frag_list不為空(skb_shinfo(head)->frag_list),就創(chuàng)建一個(gè)新的skbuff名為clone。clone指向從屬的skbuff鏈表,而head就保存data和page緩沖區(qū)。
請(qǐng)問(wèn)為什么要這么做?不懂其含義。
謝謝 |
|