libnl icon indicating copy to clipboard operation
libnl copied to clipboard

KeyError exception in nl.py

Open dclaffey opened this issue 8 years ago • 2 comments

There is a bug when initializing the callback dictionary. When the kernel sends a NLM_F_DUMP_INTR flag this exception occurs:

File "/usr/lib/python2.7/site-packages/libnl/nl.py", line 462, in recvmsgs if cb.cb_set[NL_CB_DUMP_INTR]: KeyError: 10

Is the following patch the correct fix?

--- handlers-0.2.0.py 2015-10-13 15:46:32.479024312 -0400 +++ handlers.py 2015-10-13 15:46:37.935024458 -0400 @@ -160,7 +160,7 @@ return None cb = nl_cb() cb.cb_active = NL_CB_TYPE_MAX + 1

  • for i in range(NL_CB_TYPE_MAX):
  • for i in range(NL_CB_TYPE_MAX + 1): nl_cb_set(cb, i, kind, None, None) nl_cb_err(cb, kind, None, None) return cb

dclaffey avatar Oct 13 '15 20:10 dclaffey