genl_ctrl_resolve() / nla_alloc_cache errors
James Simmons
jsimmons at casper.infradead.org
Tue Nov 14 10:35:42 PST 2023
Hi!
I have some code that creates a nl socket and then calls genl_ctrl_resolve() to retrieve the family id. I keep the same nl socket and attempt to call genl_ctrl_resolve() multiple times
but the second time calling ends in failure. I couldn't resolve the failure so I moved to the cache API. I also tried creating a new socket for each genl_ctrl_resolve() call.
Still the same problem. Here is the debug logs:
DBG<2> ././lib/cache.c:213 nl_cache_alloc: Allocated cache 0x560f50418150 <genl/family>.
DBG<2> ././lib/cache.c:371 nl_cache_clear: Clearing cache 0x560f50418150 <genl/family>...
DBG<2> ././lib/cache.c:654 nl_cache_request_full_dump: Requesting update from kernel for cache 0x560f50418150 <genl/family>
DBG<2> ././lib/msg.c:284 __nlmsg_alloc: msg 0x560f50419860: Allocated new message, maxlen=4096
DBG<2> ././lib/msg.c:360 nlmsg_alloc_simple: msg 0x560f50419860: Allocated new simple message
DBG<2> ././lib/msg.c:431 nlmsg_reserve: msg 0x560f50419860: Reserved 4 (4) bytes, pad=4, nlmsg_len=20
DBG<2> ././lib/msg.c:458 nlmsg_append: msg 0x560f50419860: Appended 4 bytes with padding 4
DBG<4> ././lib/nl.c:350 nl_sendmsg: sent 20 bytes
DBG<4> ././lib/msg.c:571 nlmsg_free: Returned message reference 0x560f50419860, 0 remaining
DBG<2> ././lib/msg.c:579 nlmsg_free: msg 0x560f50419860: Freed
DBG<2> ././lib/cache.c:1061 nl_cache_refill: Updating cache 0x560f50418150 <genl/family> for family 0, request sent, waiting for reply
DBG<2> ././lib/cache.c:695 __cache_pickup: Picking up answer for cache 0x560f50418150 <genl/family>
DBG<3> ././lib/nl.c:843 recvmsgs: Attempting to read from 0x560f503e3570
DBG<3> ././lib/nl.c:852 recvmsgs: recvmsgs(0x560f503e3570): Read 460 bytes
DBG<3> ././lib/nl.c:856 recvmsgs: recvmsgs(0x560f503e3570): Processing valid message...
DBG<2> ././lib/msg.c:284 __nlmsg_alloc: msg 0x560f50417c30: Allocated new message, maxlen=460
DBG<3> ././lib/nl.c:902 recvmsgs: recvmsgs(0x560f503e3570): Increased expected sequence number to 1699713016
DBG<4> ././lib/nl.c:981 recvmsgs: recvmsgs(0x560f503e3570): RTNETLINK responded with 34 (Numerical result out of range)
DBG<1> ././lib/attr.c:271 nla_parse: netlink: 4 bytes leftover after parsing attributes.
DBG<4> ././lib/msg.c:571 nlmsg_free: Returned message reference 0x560f50417c30, 0 remaining
DBG<2> ././lib/msg.c:579 nlmsg_free: msg 0x560f50417c30: Freed
DBG<2> ././lib/cache.c:706 __cache_pickup: While picking up for 0x560f50418150 <genl/family>, recvmsgs() returned -8: Input data out of range
DBG<3> ././lib/cache.c:416 nl_cache_free: Decremented cache 0x560f50418150 <genl/family> reference count, 0 remaining
DBG<2> ././lib/cache.c:371 nl_cache_clear: Clearing cache 0x560f50418150 <genl/family>...
DBG<2> ././lib/cache.c:384 __nl_cache_free: Freeing cache 0x560f50418150 <genl/family>...
The strange part is the -ERANGE error. Anyone know what I'm doing wrong.
More information about the libnl
mailing list