Hi guys,
I want to send arp reply message to the switch,and I use the ryu
documentation "Build Packet",as follow:

---------------------------------

dst = 'a' * 6
src = 'b' * 6
e = ethernet.ethernet(dst, src, ether.ETH_TYPE_8021Q)
a = arp.arp(1, 0x0800, 6, 4, 2, '\a' * 6, 50, '\b' * 6, 30)
p = packet.Packet()
p.add_protocol(e)
p.add_protocol(a)
p.serialize()

---------------------------------

and in my ryu app,is as follow:

----------------------------

@set_ev_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER)
    def _packet_in_handler(self, ev):
        msg = ev.msg
        datapath = msg.datapath
        ofproto = datapath.ofproto

        dst = haddr_to_bin('f0:4d:a3:ab:b4:73')
        src = haddr_to_bin('f0:4d:a3:ab:c4:23')
        
        e = ethernet.ethernet(dst, src, ether.ETH_TYPE_ARP)
        a = arp.arp(1, ether.ETH_TYPE_IP, 6, 4, 2, src, 3232236035, dst, 
3232236034)
        p = packet.Packet()
        p.add_protocol(e)
        p.add_protocol(a)
        buff = p.serialize()
        
        actions = [datapath.ofproto_parser.OFPActionOutput(msg.in_port)]
        
        out = datapath.ofproto_parser.OFPPacketOut(
            datapath=datapath, buffer_id=0xffffffff, in_port=msg.in_port,
            actions=actions,data=buff)
        datapath.send_msg(out)

---------------------------------------------------

is it right?

I use wireshark to catch the of message,only to see the the info:

Packet Out (CSM) (24B) => [Malformed Packet]

the Marlformed Packet? is my code right?



Regards,

chaojiong zheng
------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to