public inbox for iwd@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH v2] auto-t: update scapy imports for newer version
@ 2025-03-06 18:55 James Prestwood
  2025-03-07 16:29 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: James Prestwood @ 2025-03-06 18:55 UTC (permalink / raw)
  To: iwd; +Cc: James Prestwood

Something changed between scapy versions and now the modules
being imported don't exist.
---
 autotests/testFrameFuzzing/fake_ap.py |  6 +++++-
 autotests/util/hwsim.py               | 17 +++++++++++++----
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/autotests/testFrameFuzzing/fake_ap.py b/autotests/testFrameFuzzing/fake_ap.py
index 8ee369de..a9eaa1e9 100644
--- a/autotests/testFrameFuzzing/fake_ap.py
+++ b/autotests/testFrameFuzzing/fake_ap.py
@@ -3,7 +3,11 @@ import sys
 import sys
 import os
 from scapy.layers.dot11 import *
-from scapy.arch import str2mac, get_if_raw_hwaddr
+from scapy.arch import str2mac
+try:
+    from scapy.arch import get_if_raw_hwaddr
+except:
+    from scapy.arch.unix import get_if_raw_hwaddr
 from time import time, sleep
 from threading import Thread
 
diff --git a/autotests/util/hwsim.py b/autotests/util/hwsim.py
index 5456d30b..df6be26a 100755
--- a/autotests/util/hwsim.py
+++ b/autotests/util/hwsim.py
@@ -7,7 +7,10 @@ from weakref import WeakValueDictionary
 from abc import ABCMeta, abstractmethod
 from enum import Enum
 from scapy.all import *
-from scapy.contrib.wpa_eapol import WPA_key
+try:
+    from scapy.contrib.wpa_eapol import WPA_key
+except:
+    from scapy.layers.eap import EAPOL_KEY
 
 import iwd
 from config import ctx
@@ -444,9 +447,15 @@ class Hwsim(iwd.AsyncOpAbstract):
 
         # NOTE: Expected key_info is 0x008a, with the install flag
         # this becomes 0x00ca.
-        eapol = WPA_key( descriptor_type = 2,
-                        key_info = 0x00ca, # Includes an invalid install flag!
-                        replay_counter = struct.pack(">Q", 100))
+        try:
+            eapol = WPA_key( descriptor_type = 2,
+                            key_info = 0x00ca, # Includes an invalid install flag!
+                            replay_counter = struct.pack(">Q", 100))
+        except:
+            eapol = EAPOL_KEY( key_descriptor_type = 2,
+                            install = 1,
+                            key_ack = 1,
+                            key_replay_counter = 1)
         frame /= LLC()/SNAP()/EAPOL(version="802.1X-2004", type="EAPOL-Key")
         frame /= eapol
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] auto-t: update scapy imports for newer version
  2025-03-06 18:55 [PATCH v2] auto-t: update scapy imports for newer version James Prestwood
@ 2025-03-07 16:29 ` Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2025-03-07 16:29 UTC (permalink / raw)
  To: James Prestwood, iwd

Hi James,

On 3/6/25 12:55 PM, James Prestwood wrote:
> Something changed between scapy versions and now the modules
> being imported don't exist.
> ---
>   autotests/testFrameFuzzing/fake_ap.py |  6 +++++-
>   autotests/util/hwsim.py               | 17 +++++++++++++----
>   2 files changed, 18 insertions(+), 5 deletions(-)
> 

Applied, thanks.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-03-07 16:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-06 18:55 [PATCH v2] auto-t: update scapy imports for newer version James Prestwood
2025-03-07 16:29 ` Denis Kenzior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox