Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenBSD 32-bit, ifaces not populated #4626

Open
sthen opened this issue Jan 3, 2025 · 2 comments
Open

OpenBSD 32-bit, ifaces not populated #4626

sthen opened this issue Jan 3, 2025 · 2 comments

Comments

@sthen
Copy link

sthen commented Jan 3, 2025

Brief description

Hi. #4497 / 528626a seems a huge improvement in general however I'm seeing a few problems on OpenBSD, some that I see on i386 but not amd64 (I don't have other 32-bit archs handy to test but I think "all 32-bit" is likely), and one that affects amd64 too that I'll log separately.

On i386, the interface list isn't fetched correctly, and as a result trying to do basically anything else fails. ("No IPv6 support in kernel" is also printed at startup, which it isn't on amd64). Example output below.

(I'm trying to update the version we have in packages; OpenBSD 7.6 shipped with 2.4.3 and Python 3.11 which was basically working ok; in -current snapshots we're now using Python 3.12 so 2.4.3 isn't working, I'm seeing some issues with 2.4.4 which are fixed with 2.6.1, but still running into others - we use scapy as part of our regression testing for the network stack and a few other parts of the OS).

Scapy version

2.6.1

Python version

3.12

Operating system

OpenBSD -current

Additional environment information

No response

How to reproduce

Install an i386 version of OpenBSD (https://cdn.openbsd.org/pub/OpenBSD/snapshots/i386 - install76.iso is iso9660 only, not a hybrid - install76.img is dd'able to USB stick etc). pkg_add python as root. Install scapy e.g. in a venv. Attempt to list interfaces, routes, make any connection, etc.

# pkg_add python
Ambiguous: choose package for python
a	0: <None>
	1: python-2.7.18p12
	2: python-3.12.8p1
Your choice: 2
[...]

$ mkdir scapy-test
$ cd scapy-test
$ python3 -m venv .
$ bin/pip install scapy
Collecting scapy
  Downloading scapy-2.6.1-py3-none-any.whl.metadata (5.6 kB)
Downloading scapy-2.6.1-py3-none-any.whl (2.4 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.4/2.4 MB 18.0 MB/s eta 0:00:00
Installing collected packages: scapy
Successfully installed scapy-2.6.1

Actual result

$ bin/scapy 
INFO: Can't import PyX. Won't be able to use psdump() or pdfdump().
INFO: No IPv6 support in kernel
INFO: Can't import python-cryptography v1.7+. Disabled PKI & TLS crypto-related features.
INFO: Can't import python-cryptography v1.7+. Disabled WEP decryption/encryption. (Dot11)
INFO: Can't import python-cryptography v1.7+. Disabled IPsec encryption/authentication.
WARNING: No alternative Python interpreters found ! Using standard Python shell instead.
INFO: Using the default Python shell: History is disabled.
                                      
                     aSPY//YASa       
             apyyyyCY//////////YCa       |
            sY//////YSpcs  scpCY//Pp     | Welcome to Scapy
 ayp ayyyyyyySCP//Pp           syY//C    | Version 2.6.1
 AYAsAYYYYYYYY///Ps              cY//S   |
         pCCCCY//p          cSSps y//Y   | https://github.com/secdev/scapy
         SPPPP///a          pP///AC//Y   |
              A//A            cyP////C   | Have fun!
              p///Ac            sC///a   |
              P////YCpc           A//A   | Craft packets like it is your last
       scccccp///pSP///p          p//Y   | day on earth.
      sY/////////y  caa           S//P   |                      -- Lao-Tze
       cayCyayP//Ya              pY/Ya   |
        sY/PsY////YCc          aC//Yp 
         sc  sccaCY//PCypaapyCP//YSs  
                  spCPY//////YPSps    
                       ccaacs         
              
>>> conf.ifaces

>>> conf.routes
>>> conf.route 
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/usr/local/lib/python3.12/site-packages/scapy/route.py", line 53, in __repr__
    if_repr = resolve_iface(iface).description
              ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/scapy/interfaces.py", line 434, in resolve_iface
    return resolve_iface(dev, retry=False)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/scapy/interfaces.py", line 431, in resolve_iface
    raise ValueError("Interface '%s' not found !" % dev)
ValueError: Interface 'em1' not found !
>>> 

Expected result

No response

Related resources

No response

@gpotter2
Copy link
Member

gpotter2 commented Jan 3, 2025

Hi. Thanks for the report and sorry about that.
I did my best to try testing the PR on all 4 BSD flavors, but I guess I missed some flavors :(

I will look into that !

@sthen
Copy link
Author

sthen commented Jan 4, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants