* [dts] [PATCH v1] framework/packet: wait link status ready before transmission packets
@ 2017-08-24 7:31 Marvin Liu
0 siblings, 0 replies; only message in thread
From: Marvin Liu @ 2017-08-24 7:31 UTC (permalink / raw)
To: dts; +Cc: Marvin Liu
Link status may not be ready when suite calling transmission function.
Now check link status first and then transmit packets.
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/framework/packet.py b/framework/packet.py
index 924fd5e..e9a1c41 100755
--- a/framework/packet.py
+++ b/framework/packet.py
@@ -351,7 +351,21 @@ class scapy(object):
def send_pkt(self, intf='', count=1):
self.print_summary()
+
if intf != '':
+ # wait few seconds for link ready
+ countdown = 600
+ while countdown:
+ link_st = subprocess.check_output("ip link show %s" % intf,
+ stderr=subprocess.STDOUT,
+ shell=True)
+ if "LOWER_UP" in link_st:
+ break
+ else:
+ time.sleep(0.01)
+ countdown -= 1
+ continue
+
# fix fortville can't receive packets with 00:00:00:00:00:00
if self.pkt.getlayer(0).src == "00:00:00:00:00:00":
self.pkt.getlayer(0).src = get_if_hwaddr(intf)
--
1.9.3
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-08-24 7:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-24 7:31 [dts] [PATCH v1] framework/packet: wait link status ready before transmission packets Marvin Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).