wraith-wireless / PyRIC

Python wireless library for Linux
http://wraith-wireless.github.io/PyRIC
Other
93 stars 51 forks source link

Issue obtaining Link Metrics with OpenWRT #50

Open phpaiva opened 4 years ago

phpaiva commented 4 years ago

I run the following code, to see mode and properies of the wlan1 interface:

from __future__ import print_function 
import argparse as ap              
import sys         
import pyric        
import pyric.pyw as pyw               
from pyric.utils.channels import rf2ch 

w0 = pyw.getcard('wlan1') 

print (pyw.modeget(w0)) #averiguar modo

link=pyw.link(w0) #mostrar info de enlaces

for d in link:
    print (d, link[d])

But it raises the following:

AP Traceback (most recent call last): File "/tmp/Desarrollo_GauchoMesh/pyric/lib/libnl.py", line 247, in nlrecvmsg = nlmsg_fromstream(sock.recv()) File "/tmp/Desarrollo_GauchoMesh/pyric/lib/libnl.py", line 152, in recv return self['sock'].recv(self.rx) socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/tmp/Desarrollo_GauchoMesh/pyric/pyw.py", line 1688, in link rmsg = nl.nl_recvmsg(nlsock) File "/tmp/Desarrollo_GauchoMesh/pyric/lib/libnl.py", line 255, in nl_recvmsg raise error(-1,"Socket timed out") libnl.error: [Errno -1] Socket timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "pruebas_nl80211.py", line 23, in link=pyw.link(w0) #mostrar info de enlaces File "/tmp/Desarrollo_GauchoMesh/pyric/pyw.py", line 1675, in link if nlsock is None: return nlstub(link, card) File "/tmp/Desarrollo_GauchoMesh/pyric/pyw.py", line 2279, in nlstub return fct(*argv) File "/tmp/Desarrollo_GauchoMesh/pyric/pyw.py", line 1692, in link raise pyric.error(e.errno, e.strerror)

Look that the first line says "AP", which is the mode of the interface, that is OK. The problem is with the link method.

Any clue or suggestion is welcome.

Thanks in advance.

Pablo.