Hello,

I trying to use packet lib to extract the ipv4 source address from arp and
ip4 packets, but I get the following error: AttributeError: 'NoneType'
object has no attribute 'src'. Any advice?

        pkt = packet.Packet(array.array('B', msg.data))
        eth_pkt = pkt.get_protocol(ethernet.ethernet)
        arp_pkt = pkt.get_protocol(arp.arp)
        ip4_pkt = pkt.get_protocol(ipv4.ipv4)

        if arp_pkt:
            pak = arp_pkt
        elif ip4_pkt:
            pak = ip4_pkt
        else:
            pak = eth_pkt

        mac_src = eth_pkt.src
        mac_dst = eth_pkt.dst
        #arp_src = arp_pkt.src_ip
        ip4_src = ip4_pkt.src

thank you.
------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to