Skip to contentSkip to conversation

how to replace a skb in NF_IP_LOCAL_OUT hook

DISCUSSION jywang 2 participants 2 messages Nov 2, 2005 – Nov 3, 2005

lore
Share & tools
lore

jywang

author
#0 lore raw

i want to replace the skb with my own, and in my skb i will change the data in it.

How to do it?

what i do as below:

cp = skb_copy_expand(*skb, skb_headroom(*skb)+12, skb_tailroom(*skb), GFP_ATOMIC);
//change the skb->data here
skb_set_owner_w(cp, (*skb)->sk);
*skb = cp;
return NF_ACCEPT;

but, it can't work.

=====================================================

 姓名:      王金一   
 电话:      (+86)10-58812325
 单位:      中国科学院计算机网络信息中心 R&D
 地址:      北京中关村南四街四号
 邮编:      100080
 email:     [email protected]
-----------------------------------------------------
 Name:       jinyi wang
 Phone:      (86-10) 5881-2325
 Division:   R&D,Computer Network Information Center,

Chinese Academy of Sciences
Address: 4,4th South Street, Zhongguancun,
Haidian District, Beijing, China
Zip code: 100080
Email: [email protected]
=====================================================

#1 lore raw

This question belongs on the developer list I think.

Quoted 36 lines · jywang

i want to replace the skb with my own, and in my skb i will change the data in it.

How to do it?

what i do as below:

cp = skb_copy_expand(*skb, skb_headroom(*skb)+12, skb_tailroom(*skb), GFP_ATOMIC); //change the skb->data here
skb_set_owner_w(cp, (*skb)->sk);
*skb = cp;
return NF_ACCEPT;

but, it can't work.

=====================================================

姓名:      王金一
电话:      (+86)10-58812325
单位:      中国科学院计算机网络信息中心 R&D
地址:      北京中关村南四街四号
邮编:      100080
email:     [email protected]
-----------------------------------------------------
Name:       jinyi wang
Phone:      (86-10) 5881-2325
Division:   R&D,Computer Network Information Center,
            Chinese Academy of Sciences
Address:    4,4th South Street, Zhongguancun,
            Haidian District, Beijing, China
Zip code:   100080
Email:      [email protected]

=====================================================