From e211d70e1cde292d51eb6e7edc5dbb008bd01788 Mon Sep 17 00:00:00 2001
From: Pierre LALET <pierre.lalet@cea.fr>
Date: Thu, 24 Mar 2016 08:17:10 +0100
Subject: [PATCH] Tiny code cleanup

---
 scapy/arch/linux.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/scapy/arch/linux.py b/scapy/arch/linux.py
index 504ad693..ec0495f1 100644
--- a/scapy/arch/linux.py
+++ b/scapy/arch/linux.py
@@ -395,12 +395,11 @@ class L3PacketSocket(SuperSocket):
             sdto = (iff, conf.l3types[type(x)])
         if sn[3] in conf.l2types:
             ll = lambda x:conf.l2types[sn[3]]()/x
+        sx = str(ll(x))
+        x.sent_time = time.time()
         try:
-            sx = str(ll(x))
-            x.sent_time = time.time()
             self.outs.sendto(sx, sdto)
         except socket.error, msg:
-            x.sent_time = time.time()  # bad approximation
             if msg[0] == 22 and len(sx) < conf.min_pkt_size:
                 self.outs.send(sx + "\x00" * (conf.min_pkt_size - len(sx)))
             elif conf.auto_fragment and msg[0] == 90:
-- 
GitLab