On Wed, 05 Mar 2014 21:27:07 +0100
Sebastian Gebhard <[email protected]> wrote:

> Hey there,
> 
> I am just getting started using RYU and try to manually craft some
> packets to send out. But I am running into some problems with that. I
> hope you can point me into the right direction.
> 
> I have used the example from the docs
> https://github.com/osrg/ryu/blob/master/doc/source/library_packet.rst#building-packet
> 
> to build my packet like this:
> 
>         lbip = '192.168.4.42'
>         rewriteip = '192.168.4.201'
> 
>         e = ethernet.ethernet('00:00:00:00:00:00', '08:60:6e:7f:74:e7',
> ether.ETH_TYPE_8021Q)
>         a = arp.arp(hwtype=1, proto=0x0800, hlen=6, plen=4, opcode=2,
>             src_mac='08:60:6e:7f:74:e7', src_ip=self.lbip,
>             dst_mac='00:00:00:00:00:00', dst_ip=self.rewriteip)
> 
>         p = packet.Packet()
>         p.add_protocol(e)

With a vlan header here, OVS succefully sent the packet on my env.

>         p.add_protocol(a)
> 
>         p.serialize()
>         out = parser.OFPPacketOut(datapath=datapath,
> in_port=ofproto.OFPP_CONTROLLER,
>             buffer_id=ofproto.OFP_NO_BUFFER,
>             actions=[parser.OFPActionOutput(ofproto.OFPP_FLOOD,0)],
> data=p.data)
>         datapath.send_msg(out)
> 
> 
> Doing so will trigger my switch to return an error message
> 
>     error msg ev version: 0x4 msg_type 0x1 xid 0x671379c
>     
> OFPErrorMsg(code=12,data='\x04\r\x00R\x06q7\x9c\xff\xff\xff\xff\xff\xff\xff\xfd\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\xff\xff\xff\xfb\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08`n\x7ft\xe7\x81\x00\x00\x01\x08\x00\x06\x04\x00\x02\x08`',type=1)
>     type 0x1 code 0xc 0x4 0xd 0x0 0x52 0x6 0x71 0x37 0x9c 0xff 0xff 0xff
>     0xff 0xff 0xff 0xff 0xfd 0x0 0x10 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0
>     0x0 0x10 0xff 0xff 0xff 0xfb 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0
>     0x0 0x0 0x0 0x0 0x8 0x60 0x6e 0x7f 0x74 0xe7 0x81 0x0 0x0 0x1 0x8
>     0x0 0x6 0x4 0x0 0x2 0x8 0x60
> 
> 
> which I decoded to saying "Bad Request: Bad Packet".
> I tried to look at the packet. Printed p.data in hex, it looks like this
> 
>     
> 00000000000008606e7f74e78100000108000604000208606e7f74e7c0a8042a000000000000c0a804c9
> 
> Which is of course totally wrong considering the ordering.
> Can you guys maybe point me into the right direction to get the packet
> right?
> 
> Thanks in advance!
> Sebastian
> 
> P.S.: Replacing p.data with str(p) in the out message, will actually
> have the switch write the string representation to the wire in ascii,
> which is wrong as well, but doesn't return an error code.
> 
> 
> 

------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to