Skip to content
This repository was archived by the owner on Dec 13, 2020. It is now read-only.
This repository was archived by the owner on Dec 13, 2020. It is now read-only.

KeyError exception in nl.py #22

@dclaffey

Description

@dclaffey

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions