Hi ,everyone
Now I do some programe .I changed the hard_start_xmit() pointer to my own function in order to deal with sent packets. below is my sentence.
1.new_dev->back_hard_start_xmit = dev->hard_start_xmit;
2.new_dev->dev->hard_start_xmit = my_analysis;
in this way ,all the sent packet will come to my_analysis() function.

in my_function(skb,dev),i only deal with the ipv6 packet. for every ipv6 packet ,i make a new sk_buff data skb_cm, and copy the mac header of skb,and and copy the ipv6 header. so i register a new ip layer protocol to deal with this packets which i changed . in my_analysis(), i have this sentence:
Code:
int my_analysis(struct sk_buff *skb, struct net_device *dev)
{       
       if (skb->protocol !=htons(ETH_P_IPV6))
	     goto doneout;
       skb_cm->dev=skb->dev;
	skb_cm->protocol=htons(ETH_P_AAA);	
	skb_cm->ip_summed = CHECKSUM_NONE;
	skb_cm->pkt_type = skb->pkt_type; 
	skb_cm->priority = skb->priority; 
	skb_cm->dst = dst_clone(skb->dst); 
	skb_cm->csum = 0; 
	skb_put(skb_cm, len);
	skb_cm->mac.raw=skb_cm->data;
	memcpy(skb_cm->mac.raw, skb->mac.raw, ETH_HLEN);
	eth=(struct ethhdr *)skb_cm->mac.raw;
	eth->h_proto=htons(ETH_P_ROHC);
	skb_cm->nh.raw=skb_cm->data+ETH_HLEN;
	counter=ETH_HLEN;

	memcpy(skb_cm->nh.raw, (unsigned char *)ip, ntohs(ip->payload_len));
	counter+=(ntohs(ip->payload_len));

	data=skb->data;
	skb_cm->len=counter;
	skb_cm->tail=data+counter;
	
	kfree_skb(skb);
		
	return dev_p->back_hard_start_xmit(skb_cm, dev);
 doneout:return dev_p->back_hard_start_xmit(skb,dev);
}

I have register a new protocol for this packet to in the receiver computer.
static struct packet_type rohc=
{
    .type=__constant_htons(ETH_P_ROHC),
    .dev=NULL,
    .func=recover,
}
  
my recover function is :
int recover(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt )
{
 struct rohc_dev *dev_p;
 struct ethhdr *ethernethdr, *eth;
 struct rohc_dc_mchn *dc_p;
 struct sk_buff *skb_dc;
 unsigned char *data;
 int counter,len;
 struct ipv6hdr *ip;
 spinlock_t del_lok=SPIN_LOCK_UNLOCKED;
 
 dev_p= rohc_get_device(dev);
 

 spin_lock(&del_lok);
 
 ethernethdr=(struct ethhdr *)skb->mac.raw;
 
 
 skb->nh.raw=(unsigned char *)(skb->mac.raw+ETH_HLEN);
 ip=(struct ipv6hdr *)skb->nh.raw;
 data=skb->mac.raw;
 counter=ETH_HLEN;

 len=skb->len+40;
 skb_dc=alloc_skb(len, GFP_ATOMIC);
 if (skb_dc==NULL)
 {
  printk("ROHC-DC-IP: there isn`t enough memory for decompression \n");
  return -1;
 }
 skb_dc->dev=skb->dev;
 skb_dc->protocol=htons(ETH_P_IPV6);
 skb_dc->ip_summed = CHECKSUM_NONE;
 skb_dc->pkt_type = skb->pkt_type; 
 skb_dc->priority = skb->priority; 
 skb_dc->dst = dst_clone(skb->dst); 
 skb_dc->csum = 0; 
 skb_put(skb_dc, len);
 skb_dc->mac.raw = skb_dc->data;
 memcpy(skb_dc->mac.raw, skb->mac.raw, ETH_HLEN);
 eth=(struct ethhdr *)skb_dc->mac.raw;
 eth->h_proto=htons(ETH_P_IPV6);
 skb_dc->nh.raw=skb_dc->data+ETH_HLEN;
 skb_dc->nh.ipv6h=(struct ipv6hdr *)(skb_dc->mac.raw+ETH_HLEN);
 data=skb->data+ETH_HLEN;
 
 memcpy(skb_dc->nh.raw, (unsigned char *)ip, ntohs(ip->payload_len)+40);
 counter+=(ntohs(ip->payload_len))+40;
 skb_dc->tail=skb_dc->mac.raw+counter;
 skb_dc->len=counter;
 
 
doneout:kfree_skb(skb);
  skb_dc->protocol=htons(ETH_P_IPV6);
  skb_dc->dev=dev;
  netif_rx(skb_dc);
  spin_unlock(&del_lok);
  return 0;
}
when i run ing6 3ffe:192:168:10::201(my own computer),this run normaly.
but if i run: ping6 3ffe:192:168:10::200(the other computer in my local network),my computer is die, and i have to restart.
for some days ,i can`t deal with this problem.can you help me?? I am very hope you can give some advice or the correct code.
thank you very much .
need i add some lock to this function or other ways ??