- if ig_pkt == pkt_pad:
- # Found the packet in ignore list, get another one
- # TODO: subtract timeout - time_spent in here
- ignore.remove(ig_pkt)
- return self.recv(timeout, ignore)
-
- return Ether(pkt)
+ # Auto pad all packets in ignore list
+ ignore_list.append(auto_pad(ig_pkt))
+ while True:
+ (rlist, _, _) = select.select([self._sock], [], [], timeout)
+ if self._sock not in rlist:
+ return None
+
+ pkt = self._sock.recv(0x7fff)
+ pkt_pad = auto_pad(pkt)
+ print 'Received packet on {0} of len {1}'\
+ .format(self._ifname, len(pkt))
+ if verbose:
+ pkt.show2() # pylint: disable=no-member
+ print
+ if pkt_pad in ignore_list:
+ ignore_list.remove(pkt_pad)
+ print 'Received packet ignored.'
+ continue
+ else:
+ return pkt