1
0
mirror of https://github.com/vishvananda/netlink synced 2025-03-24 12:07:01 +00:00

Allow NLMSG_DONE with no data

certain implementations in kernel return NLMSG_DONE
with no data. If that is the case, assume no error occured.

Signed-off-by: adrianc <adrianc@nvidia.com>
This commit is contained in:
adrianc 2023-12-06 16:52:14 +02:00 committed by Alessandro Boch
parent 4287122432
commit 51f9bba1cd

View File

@ -565,6 +565,11 @@ done:
}
if m.Header.Type == unix.NLMSG_DONE || m.Header.Type == unix.NLMSG_ERROR {
// NLMSG_DONE might have no payload, if so assume no error.
if m.Header.Type == unix.NLMSG_DONE && len(m.Data) == 0 {
break done
}
native := NativeEndian()
errno := int32(native.Uint32(m.Data[0:4]))
if errno == 0 {