Skip to contentSkip to conversation

Difference between skb_put() and skb_push()

DISCUSSION Akshay Kawale 2 participants 3 messages Mar 31, 2005 – Apr 2, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

I was wondering about the difference between skb_put() and skb_push(). Both appear to take in the same parameters and produce the same result
- that of lengthening the data area.

If I wanted to add data before the current data area, which one should I use? (e.g. my data is 5678... and I wanted to prepend 1234 to it).

I am using these functions in a Netfilter hook to insert a header between TCP and IP for a course project I am doing.

Please help me!!! :-)

Thanks.

- Akshay

#1 lore raw

In article <[email protected]> (at Thu, 31 Mar 2005 00:46:03 -0500), Akshay Kawale <[email protected]> says:

Quoted 6 lines

I was wondering about the difference between skb_put() and skb_push(). Both appear to take in the same parameters and produce the same result
- that of lengthening the data area.

If I wanted to add data before the current data area, which one should I use? (e.g. my data is 5678... and I wanted to prepend 1234 to it).

http://www.skbuff.net/skbbasic.html

--yoshfuji

#2 lore raw
In reply to Akshay Kawale

Hi,

I am trying to access the tot_len field in the IP Header using a sk_buff structure inside a Netfilter hook.

I do something like:

(**skb).nh.iph->tot_len += 64

I have tried other variants of the same statement but none of them work. I want to increment the length by 64 bytes, but it gives me an error saying that I am trying to access an 'incomplete data type'.

Can anyone shed some light on this problem?
tot_len if of type __u16 (unsigned short int).

Thanks.

- Akshay