+ ip = ether.payload
+
+ if not isinstance(ip, ip_format):
+ raise RuntimeError(
+ "Not an IP packet received {0}".format(ip.__repr__()))
+
+ # Compare data from packets
+ if src_ip == ip.src:
+ logger.trace("Src IP matched")
+ else:
+ raise RuntimeError("Matching Src IP unsuccessful: {} != {}"
+ .format(src_ip, ip.src))
+
+ if dst_ip == ip.dst:
+ logger.trace("Dst IP matched")
+ else:
+ raise RuntimeError("Matching Dst IP unsuccessful: {} != {}"
+ .format(dst_ip, ip.dst))
+