my_hard_start_xmit(...)
{
malloc new skb - skb_new ;
unshare the skb - skb_old ;
process and send the skb_new ;
}
my_xmit_done_process(...)
{
free the skb;
}
thank you very much for your help. hop you happy everyday. i am very glad for your help.
you said the "free skb" shouldn`t do in the my_hard_start_xmit() function. but i want to free the skb, So where i can do this inorder to free the skb? And which you give me the function my_xmit_done_process() should be where and how to do the interface with the linux kernel? I know that my_hard_start_xmit() function should do likely this :dev->hard_start_xmit=my_hard_start_xmit();But how to do the function my_xmit_done_process() ?
below is my funtion which is concisied
br /]int my_hard_start_xmit(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_AAA);
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);
}
when my computer come to the free_skb() sentence , my computer`s CAPS LOCK and SCROLL LOCK light glitter for all the time and i can`t do anything and my computer is died, there is nothing in my consol so I must reboot it.
I have study linux not long ,so some debug tools don`t know a lot.i ususally used printk() to find the debug and this is very slowly. Can you commend a tool for LKM programe test?