fix payload size of Netlink message in route_get()#99
Conversation
The `len` parameter of `NLMSG_LENGTH` was size of Netlink header instead of RtNetlink header. Also make it more clear that the parameter of the macro is the payload size, which is RtNetlink message in this case.
|
Did you see any errors with the previous code? I'm not aware of any. Let me know why you believe the size is wrong please. |
|
The description for The Netlink message buffer contains [Netlink_hdr, Netlink_payload], where Netlink_payload is [RtNetlink hdr, RtNetlink_payload]. Also from the source code In the code the macro expands to something like Hope it's understandable at lest from one of the tree explanation attempts.
No. Because because the size of Netlink header is greater than Rtnetlink header. |
* Encoding fixes * CI Config (a few iterations) w/ Ubuntu and Windows target * Typo fixes * Fixes in icmp.h (#100 #101) - wrong size of fields for icmp4 timestamp message / 16bits are enough for Id/Seq. * Fix payload size of Netlink message (#99) - The `len` parameter of `NLMSG_LENGTH` was size of Netlink header instead of RtNetlink header. * python/dnet.pyx: fix incompatible-function-pointer-types for modern compiler (#104) * Cythonize with latest Cython (3.1) * Fix #109 PF_PACKET support detection to failure * tree-wide: regenerate autotools files
The
lenparameter ofNLMSG_LENGTHwas size of Netlink header instead of RtNetlink header.Also make it more clear that the parameter of the macro is the payload size, which is RtNetlink message in this case.