--- zzzz-none-000/linux-2.6.13.1/net/core/skbuff.c 2005-09-10 02:42:58.000000000 +0000 +++ ohio-7170-487/linux-2.6.13.1/net/core/skbuff.c 2009-09-01 12:24:17.000000000 +0000 @@ -69,6 +69,7 @@ #include static kmem_cache_t *skbuff_head_cache; +static atomic_t global_skb_id; /* * Keep out-of-line to prevent kernel bloat. @@ -149,6 +150,8 @@ memset(skb, 0, offsetof(struct sk_buff, truesize)); skb->truesize = size + sizeof(struct sk_buff); atomic_set(&skb->users, 1); + skb->uniq_id = atomic_inc_return(&global_skb_id) & 0xffffff; + skb->destructor_info = NULL; skb->head = data; skb->data = data; skb->tail = data; @@ -159,6 +162,7 @@ skb_shinfo(skb)->tso_size = 0; skb_shinfo(skb)->tso_segs = 0; skb_shinfo(skb)->frag_list = NULL; + skb_trace(skb, 0); out: return skb; nodata: @@ -181,6 +185,7 @@ * Buffers may only be allocated from interrupts using a @gfp_mask of * %GFP_ATOMIC. */ + struct sk_buff *alloc_skb_from_cache(kmem_cache_t *cp, unsigned int size, unsigned int __nocast gfp_mask) @@ -203,6 +208,8 @@ memset(skb, 0, offsetof(struct sk_buff, truesize)); skb->truesize = size + sizeof(struct sk_buff); atomic_set(&skb->users, 1); + skb->uniq_id = atomic_inc_return(&global_skb_id) & 0xffffff; + skb->destructor_info = NULL; skb->head = data; skb->data = data; skb->tail = data; @@ -283,14 +290,15 @@ { BUG_ON(skb->list != NULL); - dst_release(skb->dst); -#ifdef CONFIG_XFRM - secpath_put(skb->sp); -#endif if (skb->destructor) { WARN_ON(in_irq()); skb->destructor(skb); } + dst_release(skb->dst); + skb->dst = 0; +#ifdef CONFIG_XFRM + secpath_put(skb->sp); +#endif #ifdef CONFIG_NETFILTER nf_conntrack_put(skb->nfct); #ifdef CONFIG_BRIDGE_NETFILTER @@ -384,6 +392,8 @@ #endif #endif + C(destructor_info); + C(uniq_id); C(truesize); atomic_set(&n->users, 1); C(head); @@ -394,6 +404,8 @@ atomic_inc(&(skb_shinfo(skb)->dataref)); skb->cloned = 1; + skb_trace(skb, 1); + return n; } @@ -439,6 +451,7 @@ #endif new->tc_index = old->tc_index; #endif + new->uniq_id = old->uniq_id; atomic_set(&new->users, 1); skb_shinfo(new)->tso_size = skb_shinfo(old)->tso_size; skb_shinfo(new)->tso_segs = skb_shinfo(old)->tso_segs;