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

"Invalid parameter" when opening interface socket on devices with low rmem_max #41

Open
sm-Fifteen opened this issue Feb 7, 2018 · 2 comments

Comments

@sm-Fifteen
Copy link

When creating a new socket to claim an interface, pyric uses a default value for tx and rx BUFSZ of 32768 bytes. It also checks that the selected value is smaller than the configured maximum socket buffer size, but since BUFSZ is hardcoded, said default value may cause socket initialization to fail. I'm currently working on an embedded system where rmem_max is 163840, which puts the output of _maxbufsz_ at 8192.

Out of the box, this is what I get :

Traceback (most recent call last):
  File "./test_iw.py", line 5, in <module>
    iface = pyw.getcard('wlan0')
  File "/usr/lib/python2.7/site-packages/pyric/pyw.py", line 269, in getcard
    if nlsock is None: return _nlstub_(getcard, dev)
  File "/usr/lib/python2.7/site-packages/pyric/pyw.py", line 2238, in _nlstub_
    raise pyric.error(e.errno, pyric.strerror(e.errno))
pyric.error: [Errno 22] Invalid parameter

It's also not very helpful how _nlstub_ swallows any errors thrown by libnl and replaces them with this not very descriptive message and stack-trace instead.

@AchielC
Copy link

AchielC commented Aug 23, 2018

I also have this problem. Did you find a solution?

@sm-Fifteen
Copy link
Author

Instead of letting functions call _nlstub_, which is the part that initializes the netlink socket, you can just call nl_socket_alloc with your own values for rx and tx, and pass it to functions that require a netlink socket from then on.

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