Find the answer to your Linux question:
Results 1 to 3 of 3
I want to deal with every ipv6 packet passing the net device. So i changed the pointer of the hard_start_xmit(struct sk_buff *skb,struct net_device *dev) to my own function my_function, and ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2006
    Posts
    7

    hi,everyone, how to deal with freeing sk_buff in hard_start_xmit() function??


    I want to deal with every ipv6 packet passing the net device. So i changed the pointer of the hard_start_xmit(struct sk_buff *skb,struct net_device *dev) to my own function my_function, and in the last of my function I call the original function hard_start_xmit to translate the skb1 which is maked in my function . In my funtion i will make a new sk_buff skb1 base on the skb which comes from the up protocol such as ipv6/ipv4. when i have the done the skb1, i free the original skb,but my computer can`t work and die out. I know the reason is the sentence "kfree_skb(skb);" . Although i know the reason, i can`t resolve this ,because i must free the skb which came from up protocol . DO you know how to free the skb which came from the up protocol and sent my own skb1??

  2. #2
    Linux User fernape's Avatar
    Join Date
    Dec 2005
    Location
    Holland
    Posts
    301
    Did you do some pointer assignments? Maybe your freed sk_buff is pointing to the same memory address that the one you passed to the original function...

    Try to hold the original struct, then call the original function and after this, before return free the skb1.

    Take this with care... I'm not an expert but this seems a problem because you freed a memory address that is still in use. Did you get some Oops from kernel? Another debug information?

    Best regards

  3. #3
    Just Joined!
    Join Date
    May 2006
    Posts
    7
    hi, thank you for your help. the skb1 is a new sk_buff struct that i kmalloced .so i thank the skb1 does`t have the same pointer as skb.
    when my programe come down once it runs here and doesn`t have any information. in this situation i must restart the system.
    i only want to make a new skb1 and delete the original skb. why i can`t ??
    How should i do with it??
    best regard.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •