How to remove ip options from existing skbuff?

Guibin(Bill) Tian gbtian at gmail.com
Tue Jan 28 20:54:35 EST 2014


Hi,
In the kernel, I added some customized options to the ip_options struct,
and I send the ip packet with these option fields set.

After I receive the packet, I extract these options and try to remove them
from the ip packet because I don't want these options be delivered to upper
layer.

In the method ip_rcv_finish of the file ip_input.c, I added following code:

/*********My code to process the options****/
process_my_options(skb);
/*********My code to remove the options ****/
  //skb_pull(skb, sizeof(struct iphdr) + 12);
//skb_push(skb, sizeof(struct iphdr));
//skb_reset_network_header(skb);
//iph->ihl -= 3;

/*********Normal process of the ip packet.****/
if (iph->ihl > 5 && ip_rcv_options(skb))
goto drop;


The question is at how to remove the options. I tried some code but none of
them works correctly. Can anybody give me some suggestion? Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140128/a06a5d7c/attachment.html 


More information about the Kernelnewbies mailing list