[Contiki-developers] How to modify incoming packets directly in uip_buf and immediately forward them?

0 views
Skip to first unread message

Matthias Philipp

unread,
Jun 1, 2011, 10:07:57 AM6/1/11
to Contiki developer mailing list
Hi all,

is it possible to modify incoming IPv6 packets directly in the uIP
buffer and forward them without copying the packet to a temporary buffer?

I'm simulating Sky nodes in Cooja and am trying to change some flags of
an incoming packet and immediately resend it. But although all functions
seem to be called appropriately, the packet does not get send.

The call hierarchy looks like this:

uip_process() -> my_func1() -> my_func2() -> tcpip_ipv6_output()

Where all functions get called directly by the previous one, and
my_func1() is examining, and my_func2() is directly modifying the
content of uip_buf.

When enabling the debug mode in cc2420.c, I can see that the packet is
sent by the driver. However, neither neighboring nodes receive the
packet, nor is it shown in the Cooja radio logger.

If, however, I don't call my_func2() directly from my_func1() but with a
timer started in my_func1(), everything works fine and the packet is
sent as expected.


So here are my questions:

Can anybody explain that behavior to me? Is it related to Cooja or the
Contiki processes?

I would be fine with using a timer to call my_func2(), but how can I
make sure that no other function modifies the uip_buf in the mean time?
(i.e. a new packet coming in)

What would be the correct way to implement the desired behavior (modify
incoming packet and immediately resend it) in uIP / Contiki?

Best regards, Matthias

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today.
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
Contiki-developers mailing list
Contiki-d...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/contiki-developers

SOURAV GARG

unread,
Jun 9, 2011, 3:29:33 PM6/9/11
to Contiki developer mailing list
Hi,

I am not much a pro into these, but still if you like you can check into the example-packet-drv in doc directory, it uses poll handling process to recv a packet, I hope if you are able to do this way you can make changes to the packet as soon as you receive it and then send it ahead.
Your problem seemed to me more of processes, so above may help.

Sincerely,
Sourav Garg
Reply all
Reply to author
Forward
0 new messages