On Thu, 27 Nov 2014 20:12:23 -0200
Ricardo Balbinot <[email protected]> wrote:

> I am trying to create a new packet that changes some fields from an
> existing (received via packet_in) ethernet packet, adds a new vlan header
> and then sends back (via packet_out) the packet to the switch, with the
> same original ethernet payload....
> 
> At this moment I am solving this using some OF13 rules, but I would like to
> know how to do this at the controller.
> 
> Reading about the packet library I know I can easily build a new ethernet
> packet, with a vlan header after it, and that I can even add a bytearray to
> the end of the original serialized and newly created packet... what I do
> not know is how I can access the right position of the original received
> packet that points me to the original ethernet packet's payload.
> 
> Could you give some insight on how this can be done?

https://github.com/osrg/ryu/blob/master/ryu/lib/packet/packet.py#L112

After parsing, protcol instances are stored at Packet.packets list. So
you create 'vlan' instance and insert it after 'ethernet' instance,
then call serialize(). You might want to modify ethernet type member
in the ethernet instance.

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to