Hi,

I guess the problem is that the packet has an ARP payload and not an IP
payload.
The code you wrote should work for IP payloads but does not work for ARP.
You cant check whether it's an IP packet with packet.type==packet.IP_TYPE.

You could do something like:

if packet.dst.is_multicast:
    if packet.type==packet.IP_TYPE:
        ip_packet = packet.payload
        src_ip = ip_packet.srcip

    if packet.type==packet.ARP_TYPE:
        #add some logic to handle ARP packets*
*


Hope it helps,

Tim


2013/6/27 Kavit Shah <[email protected]>

> ...
> import pox.lib.packet as packet
> ....
>
>
> if *packet.dst*.is_multicast:
>
>   *ip_packet = packet.payload*
> *  src_ip = ip_packet.srcip*
>
>   if src.ip == "XXXXXX":
>     .....
>     .....
>
> packet.dst ---> works fine no errors, I think it gives me the MAC address
> ip_packet.srcip --> error: arp packet has no attributes called srcip.
>                             I am expecting it to give me the src ip.
>
> I just want to extract the IP address from this packet.  I am trying to
> get it by extracting individual header from each layer as mentioned in POX
> tutorial.
>
> I am trying to look inside the pox/pox/lib/packet to figure out how this
> works. But not much found yet.
>
> Any help would be appreciated :)
>
> -Kavit
>

Reply via email to