diff options
author | Lucian Banu <lucian.banu@enea.com> | 2018-04-05 07:05:53 +0200 |
---|---|---|
committer | Peter Mikus <pmikus@cisco.com> | 2018-04-24 09:16:36 +0000 |
commit | 4bafd0aa54fa78c4c3a6a32281cfa551e61bcafc (patch) | |
tree | 6a28eeedfb57fd2755f70dcb6c735be5ceb80a58 /resources/libraries/python | |
parent | 53e9d835462c85738a61ce6f069a05d090645ac8 (diff) |
CSIT-1019: Fix PacketVerifier.RxQueue receive timeout issue
Change-Id: I0f7f54e721843b0252ac969ddfabc769a632c1a0
Signed-off-by: Lucian Banu <lucian.banu@enea.com>
Diffstat (limited to 'resources/libraries/python')
-rw-r--r-- | resources/libraries/python/PacketVerifier.py | 51 |
1 files changed, 23 insertions, 28 deletions
diff --git a/resources/libraries/python/PacketVerifier.py b/resources/libraries/python/PacketVerifier.py index 4500961151..9306f486ba 100644 --- a/resources/libraries/python/PacketVerifier.py +++ b/resources/libraries/python/PacketVerifier.py @@ -65,7 +65,6 @@ import os import select -import interruptingcow from scapy.config import conf from scapy.all import ETH_P_IP, ETH_P_IPV6, ETH_P_ALL, ETH_P_ARP from scapy.layers.inet6 import IPv6 @@ -218,33 +217,29 @@ class RxQueue(PacketVerifier): :returns: Ether() initialized object from packet data. :rtype: scapy.Ether """ - (rlist, _, _) = select.select([self._sock], [], [], timeout) - if self._sock not in rlist: - return None - try: - with interruptingcow.timeout(timeout, - exception=RuntimeError('Timeout')): - ignore_list = list() - if ignore is not None: - for ig_pkt in ignore: - # Auto pad all packets in ignore list - ignore_list.append(auto_pad(ig_pkt)) - while True: - 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 - except RuntimeError: - return None + ignore_list = list() + if ignore is not None: + for ig_pkt in ignore: + # 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 class TxQueue(PacketVerifier): |